nano_payment_gateway 0.1.0 copy "nano_payment_gateway: ^0.1.0" to clipboard
nano_payment_gateway: ^0.1.0 copied to clipboard

A Flutter package allows you to easily implement the payment gateway integration.

example/lib/main.dart

import 'dart:convert';

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

void main() => runApp(const MySample());

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

  @override
  State<StatefulWidget> createState() => MySampleState();
}

class MySampleState extends State<MySample> {
  void onTapConfirmAfterOTP(ResponseModel response) {
    Navigator.of(context).pushReplacementNamed('/shopping', arguments: {
      'description': response.data!['responseMessage'],
      'statusCode': response.status
    });
  }

  RequestBodyModel getRequestBody() {
    Map<String, dynamic> billingAddress = {
      "billingName": "",
      "billingZip": "",
      "billingState": "",
      "billingCountry": "",
      "billingTel": "",
      "billingEmail": "",
      "billingCity": "",
      "billingAddress": ""
    };

    Map<String, dynamic> shippingAddress = {
      "deliveryName": "",
      "deliveryState": "",
      "deliveryCountry": "",
      "deliveryTel": "",
      "deliveryZip": "",
      "deliveryCity": "",
      "deliveryAddress": ""
    };

    Map<String, dynamic> objectBody = {
      "merchantId": "1",
      "merchantName": "Ingenico Training",
      "currencyCode": "AED",
      "amount": "1000",
      "merchantPublicKey":
          "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC5whV5aZ1mPiohGkE7GT2dYpr0iAW6STLbrE2yuT4DPAFRpXgeLJEPCGr2jakHlzEujzX+mr9ZHdY9ukp0ebyWBibWGPpqyVuSqGOx4BAukviltqPCmA+DGffxRcDh7cl+5HPwFCryiD7zKo1BOHCLLZFpck1ClgWETXIqbu8YEQIDAQAB",
      "orderId": "1",
      "cartId": "2",
      "paymentType": "ONE-TIME-PAYMENT",
      "billingAddress": jsonEncode(billingAddress),
      "shippingAddress": jsonEncode(shippingAddress),
      "customerId": "0000000000001",
      "device": "MOBILE"
    };

    RequestBodyModel requestBody =
        requestBodyModelFromJson(jsonEncode(objectBody));

    return requestBody;
  }

  @override
  Widget build(BuildContext context) {
    return PaymentScreenWidget(
      requestBody: getRequestBody(),
      onTapConfirmAfterOTP: onTapConfirmAfterOTP,
      showAddress: true,
    );
  }
}
1
likes
0
points
28
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter package allows you to easily implement the payment gateway integration.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

encrypt, flutter, flutter_dotenv, http, pin_code_fields, provider

More

Packages that depend on nano_payment_gateway