nano_payment_gateway 0.2.2 nano_payment_gateway: ^0.2.2 copied to clipboard
A Flutter package allows you to easily implement the payment gateway integration.
nano_payment_gateway #
A Flutter package allows you to easily implement the payment gateway integration.
Installing #
-
Add dependency to pubspec.yaml Get the latest version in the 'Installing' tab on pub.dartlang.org
dependencies: nano_payment_gateway: <latest_version>
-
Import the package
import 'package:nano_payment_gateway/nano_payment_gateway.dart';
-
Adding PaymentWidget
- With required parameters
PaymentWidget( requestBody: requestBody, onTapConfirmAfterOTP: onTapConfirmAfterOTP, );
- With optional parameters
PaymentWidget( requestBody: requestBody, onTapConfirmAfterOTP: onTapConfirmAfterOTP, showAddress: true, );
- requestBody should pass in Map<String,dynamic> format.It should like
Map<String, dynamic> requestBody = { "merchantId": "$merchantId", "merchantName": "$merchantName", "currencyCode": "$currencyCode", "amount": "$price", "merchantPublicKey":"$merchantPublicKey" "orderId": "$orderId", "cartId": "$cartId", "billingAddress": jsonEncode(billingAddress), "shippingAddress": jsonEncode(shippingAddress), "customerId": "$customerId", };
Sample JSON is
requestBody = { "merchantId": "1", "merchantName": "EzKart ECOM Provider", "currencyCode": "AED", "amount": "1000", "merchantPublicKey": "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC5whV5aZ1mPiohGkE7GT2dYpr0iAW6STLbrE2yuT4DPAFRpXgeLJEPCGr2jakHlzEujzX+mr9ZHdY9ukp0ebyWBibWGPpqyVuSqGOx4BAukviltqPCmA+DGffxRcDh7cl+5HPwFCryiD7zKo1BOHCLLZFpck1ClgWETXIqbu8YEQIDAQAB", "orderId": "Y665JG", "cartId": "2", "billingAddress": jsonEncode(billingAddress), "shippingAddress": jsonEncode(shippingAddress), "customerId": "0000000000001", };
- billingAddress sample is
Map<String, dynamic> billingAddress = { "billingName": "$billingName", "billingZip": "$billingZip", "billingState": "$billingZip", "billingCountry": "$billingCountry", "billingTel": "$billingTel", "billingEmail": "$billingEmail", "billingCity": "$billingCity", "billingAddress": "$billingAddress" };
- shippingAddress sample is
Map<String, dynamic> shippingAddress = { "deliveryName": "$deliveryName", "deliveryState": "$deliveryState", "deliveryCountry": "$deliveryCountry", "deliveryTel": "$deliveryTel", "deliveryZip": "$deliveryZip", "deliveryCity": "$deliveryCity", "deliveryAddress": "$deliveryAddress" };
- With required parameters
- onTapConfirmAfterOTP method can pass from users for customized action after entering OTP
- showAddress parameter is used for showing UI having address fields.Users can update their address from here also if they want to update the given address
Additional Information #
The nano_payment_gateway package is using flutter_dotenv pacakge for retrieving API key from application's .env file.Application should contain .env file with APIKEY.sample APIKEY is
APIKEY=http://sandboxdev.omaemirates.com:9507
How to use #
Check out the example app in the example directory or the 'Example' tab on pub.dartlang.org for a more complete example.
Getting Started #
This project is a starting point for a Dart package, a library module containing code that can be shared easily across multiple Flutter or Dart projects.