izipay_payment 1.0.3 copy "izipay_payment: ^1.0.3" to clipboard
izipay_payment: ^1.0.3 copied to clipboard

A Flutter package to tokenize payment methods with Izipay. Integrates the native SDK to facilitate its use and improve the payment experience.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'dart:async';

import 'package:flutter/services.dart';
import 'package:flutter_json_view/flutter_json_view.dart';
import 'package:izipay_payment/izipay_payment.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({super.key});

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  final _izipayPaymentFlutterPlugin = IzipayPayment();
  String response = '';

  // Inicialización de pago
  Future<void> initPaymentIzipay() async {
    final config = {
      "environment": "SBOX", //TEST o PROD o SBOX
      "action": "register",
      "clientId": "<MERCHANT CODE>",
      "merchantId": "<public key>",
      "order": {
        "currency": "PEN",
        "amount": "11.00",
        "email": "[email protected]"
      },
      "billing": {
        "firstName": "Juan",
        "lastName": "Quispe",
        "email": "[email protected]",
        "phone": "930292619",
        "address": "Av. flores",
        "city": "Lima",
        "region": "Lima",
        "country": "PE",
        "postalCode": "33065",
        "idType": "DNI",
        "idNumber": "55555555"
      },
      "shipping": {
        "firstName": "Juan",
        "lastName": "Quispe",
        "email": "[email protected]",
        "phone": "930292619",
        "address": "Av. Alamo",
        "city": "Lima",
        "region": "Lima",
        "country": "PE",
        "postalCode": "33065",
        "idType": "DNI",
        "idNumber": "55555555"
      },
      "appearance": {
        "language": "ESP",
        "themeColor": "green",
        "primaryColor": "#333399",
        "secondaryColor": "#333399",
        "tertiaryColor": "#333399",
        "logoUrl":
            "https://logowik.com/content/uploads/images/shopping-cart5929.jpg"
      }
    };
    final paymentConfig = PaymentConfig.fromJson(config);
    try {
      response = await _izipayPaymentFlutterPlugin.startPayment(paymentConfig);
      setState(() {});
    } on PlatformException {
      response = 'Failed to get platform version.';
      setState(() {});
    }
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: SingleChildScrollView(
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              Row(
                mainAxisAlignment: MainAxisAlignment.center,
                children: [
                  TextButton(
                    onPressed: initPaymentIzipay,
                    child: const Text('Init IZIPAY'),
                  ),
                ],
              ),
              if(response.isNotEmpty)
              Padding(
                padding: const EdgeInsets.all(20.0),
                child: JsonView.string(
                  response,
                  theme: const JsonViewTheme(
                    backgroundColor: Colors.black12,
                    keyStyle: TextStyle(color: Colors.blue),
                    stringStyle: TextStyle(color: Colors.red),
                ),),
              ),
              if (response.isNotEmpty)
                Builder(
                  builder: (context) => TextButton(
                    onPressed: () {
                      Clipboard.setData(ClipboardData(text: response));
                      ScaffoldMessenger.of(context).showSnackBar(
                        const SnackBar(content: Text('Copied to clipboard')),
                      );
                    },
                    child: const Text('Copy to clipboard'),
                  ),
                ),
            ],
          ),
        ),
      ),
    );
  }
}
6
likes
0
points
23
downloads

Publisher

verified publishercreegplay.dev

Weekly Downloads

A Flutter package to tokenize payment methods with Izipay. Integrates the native SDK to facilitate its use and improve the payment experience.

Repository (GitHub)
View/report issues

Documentation

Documentation

License

unknown (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on izipay_payment

Packages that implement izipay_payment