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.
- Mobile payments
- Bank payments
- Get payment partners
- Request payment link
- Disbursements
- Pay bills
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
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.
// 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}');
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.
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
- Neurotech-HQ/azampay: Python Wrapper to Azampay Payment Gateway
- flexcodelabs/azampay: NodeJs SDK to help you easily and seamlessly integrate with Azampay APIs
Contributions are welcome! If you have suggestions for improvements or new features, please open an issue or submit a pull request.
This project is licensed under the BSD 3-Clause License. See the LICENSE file for details.