A simple implementation of bKash payment gateway in flutter with tokenized checkout feature.
- A Simple App with a button to
Checkout
- Pressing the button initiates bKash payment dialogs
- Returns a success message with tranId if payment is successful
Official link for API documentation and demo checkout
Replace the credentials for production uses in app_constants.dart
with your own bKash credentials and change the flag isProduction = true
.
static const String username = 'app_username';
static const String password = 'app_password';
static const String appKey = 'app_key';
static const String appSecret = 'app_secret';
Basically this the implementation of payment without an agreement. Use the makePayment
method to pay
final result = await makePayment(
amount: '50.0',
payerReference: '01770618575',
merchantInvoiceNumber: 'invoice02',
);
{
"trxId": "BBE40GR28Q",
"paymentId": "TR0011QoLvETc1707888323866",
"executeTime": "2024-02-14T11:25:40:749",
"payerReference": "01770618575",
"customerMsisdn": "01770618575",
"merchantInvoiceNumber": "invoice02"
}
In case of any error it's throw PaymentException
. You can handle the exception using a try-catch block.
try {
// Make a payment
} on PaymentException catch (e) {
// Handle the error
log(e.message);
}
bkash_demo.mp4
Contributions to this project you always are welcome. Please note the standard guidelines before submitting your pull request.