dart_azampay 0.0.4 copy "dart_azampay: ^0.0.4" to clipboard
dart_azampay: ^0.0.4 copied to clipboard

A simple and efficient way to integrate AzamPay payment gateway into your Dart/Flutter applications.

AzamPay Dart Package #

pub package GitHub Actions Workflow Status

Azampay Strata Logo

dart_azampay is a Dart package that provides a simple and efficient way to integrate AzamPay payment gateway into your Dart/Flutter applications. With Azampay, you can easily make mobile and bank payments, request payment link, disbursements, and pay bills.

Features #

  • Mobile payments
  • Bank payments
  • Get payment partners
  • Request payment link
  • Disbursements
  • Pay bills

Installation #

Add dart_azampay to your pubspec.yaml file:

dependencies:
  dart_azampay: latest_version

Run dart pub get to install the package, or, install it directly from the command line:

dart pub add dart_azampay

Getting Started #

Initialize and make requests #

Initialize the package with your app name, client ID, and secret key. You can find these details on your AzamPay portal. If you haven't registered yet, you can do so here. Register, verify your account, create an app and get your credentials.

Example: Mobile Payment Checkout

// initialize the AzamPay client
final azamPayClient = AzamPayClient(
   appName: 'My-App',
   clientId: '4a4c16d1-52cc-48eddf23-bfff',
   clientSecret: 'BR2USg29BIubf...vU5ErDtc=',
   sandbox: true, // set to false for production
);

// create an instance of the Checkout service
final checkoutService = Checkout(azamPayClient);

// Create a MNOCheckoutRequest
final mnoRequest = MnoCheckoutRequest(
   accountNumber: '255764XXXXXX',
   additionalProperties: {}, //optional
   amount: '1000',
   currency: 'TZS',
   externalId: 'external-id',
   provider: MnoProvider.mpesa, // or any other provider
);

// Example usage of the checkout service
final res = await checkoutService.mnoPayment(request: mnoRequest);
print('mno checkout response: ${res.data}');

Services #

This package allows you to use services based on your needs. For instance, you can use only the checkout service or the bill payment service.

Supported services #

1. Checkout service

// instance of the checkout service
final checkoutService = Checkout(azamPayClient);

// mobile payment checkout
final res = await checkoutService.mnoPayment(request: mnoRequest);
print('mno checkout response: ${res.data}');

// bank payment checkout
final res = await checkoutService.bankPayment(request: bankRequest);
print('bank checkout response: ${res.data}');

2. Partners service

// Instance of the partners service
final partnersService = Partners(azamPayClient);

// Get payment partners
final partners = await partnersService.getPaymentPartners();
print('Partners list: $partners'); // Prints the list of partners

// Request payment link
final res = await partnersService.requestPaymentLink(postCheckoutRequest);
print('Payment link: ${res.data}'); // Prints the payment link

Contributing #

Contributions are welcome! If you have suggestions for improvements or new features, please open an issue or submit a pull request.

License #

This project is licensed under the BSD 3-Clause License. See the LICENSE file for details.

1
likes
160
points
58
downloads

Publisher

verified publisherkaykhahima.com

Weekly Downloads

A simple and efficient way to integrate AzamPay payment gateway into your Dart/Flutter applications.

Repository (GitHub)

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

http

More

Packages that depend on dart_azampay