Last updated:
0 purchases
nagad payment gateway
Nagad Online Payment
API Integration Flutter Package
This is a Flutter package for the merchants and service providers that want to
incorporate a new online payment method provided by Nagad.
Note : Get your merchant credentials by contacting Nagad.
Credentials to be provided by Nagad #
final merchantID = "Specific Merchant id"
final merchantPrivateKey = "Merchant Private Key"
final pgPublicKey = "Nagad Payment Gateway public Key"
copied to clipboard
Initialize the Nagad instance: #
Create an instance of Credentials and provide it to the Nagad Instance:
Nagad nagad = Nagad(
credentials: const Credentials(
merchantID: merchantID,
merchantPrivateKey: merchantPrivateKey,
pgPublicKey: merchantPrivateKey,
isSandbox: true)); // switch to false for production
copied to clipboard
Note: Make sure to replace the provided credentials with your Nagad Sandbox or production credentials.
Set Additional Merchant Info #
Additional Merchant Info Fields
Length
Description
serviceName
25
Service Name Provided by Merchant
serviceLogoURL
1~1024
Publicly accessible logo URL
additionalFieldName EN
20
Additional Field Name to be shown in Payment Page for Locale EN
additionalFieldName BN
20
Additional Field Name to be shown in Payment Page for Locale BN
additionalFieldValue
20
Value of Additional Field in English
Map<String, dynamic> additionalMerchantInfo = {
“serviceName” : “T Shirt”,
“serviceLogoURL” : “tinyurl.com/sampleLogoUrl”,
“additionalFieldNameEN” : “Color”,
“additionalFieldNameBN” : “রং”,
“additionalFieldValue” : “White”
};
nagad.setAdditionalMerchantInfo(additionalMerchantInfo);
copied to clipboard
N.B: additionalMerchantInfo must be in Map<String, dynamic> type. Additional Merchant Info can be anything and will be saved for further usage. However only these fields will be shown in the payment page.
Regular Payment #
To make a regular merchant payment, use the pay method:
Request
final nagadResponse = await nagad.regularPayment(context, amount: 10.25, orderId: orderId);
copied to clipboard
Parameters #
amount: The amount for payment. Recommended as double.
orderID: This is unique identifier to place order for payment. You can use current millisecondsSinceEpoch for uniqueness.
DateTime now = DateTime.now();
String orderId = 'order${now.millisecondsSinceEpoch}';
copied to clipboard
Response
nagadResponse contains:
merchantId
orderId
paymentRefId
amount
clientMobileNo
merchantMobileNo
orderDateTime
issuerPaymentDateTime
issuerPaymentRefNo
additionalMerchantInfo
status
statusCode
cancelIssuerDateTime
cancelIssuerRefNo
serviceType
N.B: Save the required information to your database if needed
License #
nagad_payment_gateway package is licensed under the GNU General Public License (GPL) version 3.0.
©2024
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.