nagad_payment_gateway 0.1.1 copy "nagad_payment_gateway: ^0.1.1" to clipboard
nagad_payment_gateway: ^0.1.1 copied to clipboard

A Flutter package for Nagad Online Payment API (Sandbox) Integration

Nagad Logo

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"

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

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
Expample:

{
    “serviceName” : “T Shirt”,
    “serviceLogoURL” : “tinyurl.com/sampleLogoUrl”,
    “additionalFieldNameEN” : “Color”,
    “additionalFieldNameBN” : “রং”,
    “additionalFieldValue” : “White”
}

N.B: 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:

Parameters #

amount: The amount for payment
orderID: This is unique identifier to place order for payment. You can use current millisecondsSinceEpoch for uniqueness.

Request

DateTime now = DateTime.now();
String orderId = 'order${now.millisecondsSinceEpoch}';
StatusAPIResponse statusAPIResponse =
                    await nagad.pay(context, amount: 10.0, orderId: orderId);

Response: StatusAPIResponse contains

  1. merchantId
  2. orderId
  3. paymentRefId
  4. amount
  5. clientMobileNo
  6. merchantMobileNo
  7. orderDateTime
  8. issuerPaymentDateTime
  9. issuerPaymentRefNo
  10. additionalMerchantInfo
  11. status
  12. statusCode
  13. cancelIssuerDateTime
  14. cancelIssuerRefNo
  15. 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

3
likes
0
points
64
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter package for Nagad Online Payment API (Sandbox) Integration

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

encrypt, flutter, hex, http, intl, url_launcher, webview_flutter

More

Packages that depend on nagad_payment_gateway