BIAPAY PAYMENT GATEWAY SDK
BIAPAY Payment Gateway SDK is a high-level wrapper around the BIAPAY Payment Gateway API that provides strongly typed responses and exceptions.
Features
- BIAPAY Payment Gateway SDK for Flutter.
- Easy to use.
- Support for Android and iOS.
- No need to setup any additional configuration.
- Safe & Secure
- Instant Cashout
- End-to-end encryption
- Transparent Pricing
![]()
Getting Started
Installation
Install the latest version from pub.dev.
Add this biapay_gateway to your package's pubspec.yaml file:
dependencies:
biapay_gateway: [version]
or Run this command with your terminal:
$ flutter pub add biapay_gateway
Start to Code
Import package
Import the package into your dart file. If you are using Android Studio or VS Code, you can do this easily by pressing Alt+Enter and selecting the import package option. Otherwise, you can manually import the package by adding the following line to your dart file:
// Import package
import 'package:biapay_gateway/biapay_gateway.dart';
Example
Create a new instance of BiaPayGateway class. and pass required parameters. clientId, clientSecret, email, mobileNumber, orderId, amount, currencyCode, transactionId and transactionType are required parameters.
// Import package
import 'package:biapay_gateway/biapay_gateway.dart';
// Create a new instance of BiaPayGateway class.
final biapay = BiaPayGateway(
clientId: 'clientId',
clientSecret: 'clientSecret',
email: 'email',
mobileNumber: 'mobileNumber',
orderId: 'orderId',
amount: 'amount',
currencyCode: 'currencyCode',
transactionId: 'transactionId',
transactionType: 'transactionType',
);
- After creating a new instance of
BiaPayGatewayclass. calllaunchmethod to start payment process.launchmethod will return aFutureobject. You can useonSuccessandonFailedcallback functions to handle success and error response. - Inside
onSuccessandonFailedcallback functions you can access the data by using add parameter in callback function. You can use any name foronSuccessandonFailedcallback function parameters.
// Call launch method to start payment process.
biapay.launch(
onSuccess: (response) {
// Handle success response.
},
onFailed: (error) {
// Handle failed response.
},
);
- Access the
onSuccessandonFailedcallback response data. BothonSuccessandonFailedare return list of data withstatusandmessagekeys as aMapobject. It's like a JSON response. You can access the data by using key names. Key name represents the name of the data. - For example,
statusis a key name ofstatusdata. You can access thestatusdata by usingstatuskey name.
// Call launch method to start payment process.
await biapay.launch(
onSuccess: (response) {
// Handle success response.
final orderId = response['orderId'];
final status = response['status'];
final currency = response['currency'];
final amount = response['amount'];
final biapayTransactionId = response['biapayTransactionId'];
final transactionId = response['transactionId'];
final biapaySignature = response['biapaySignature'];
final message = response['message'];
// Do something with response data.
},
onFailed: (error) {
// Handle failed response.
final status = error['status'];
final message = error['message'];
// Do something with error data.
},
);
onSuccess is a callback function that will be called when payment process is completed successfully.
onFailed is a callback function that will be called when payment process is failed.
Both onSuccess and onFailed are return JSON response with status and message keys.
- You can check your payment signature by using
verifySignaturemethod.verifySignaturemethod will return aFutureobject. verifySignaturemethod requiredorderId,biapayTransactionId,transactionId,clientSecret, andbiapaySignatureparameters.verifySignaturemethod will return list of data withmessageof the signature verification process.verifySignaturemethod will returnorderIdbiapayTransactionIdtransactionIdbiapaySignaturegeneratedSignaturemessagekeys as aMapobject. It's like a JSON response. You can access the data by using key names. Key name represents the name of the data.
// Call verifySignature method to verify payment signature.
final value = await biapay.verifySignature(
orderIdVerify,
biapayTransactionIdVerify,
transactionIdVerify,
clientSecret,
biapaySignatureVerify
);
// Access the data by using key names.
final orderId = value['orderId'];
final biapayTransactionId = value['biapayTransactionId'];
final transactionId = value['transactionId'];
final biapaySignature = value['biapaySignature'];
final generatedSignature = value['generatedSignature'];
final message = value['message'];
Response
Success Response
onSuccesscallback function will return a list of data withstatusandmessagekeys.statuskey is a String value that will return status of payment process.messagekey is a String value that will return message of payment process.
{
"orderId": "xxx",
"status": "COMPLETED",
"currency": "USD",
"amount": 240,
"biapayTransactionId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"transactionId": "xxxxx",
"biapaySignature": "/*************",
"message": "Your payment has been successfully completed."
}
Error Response
onFailedcallback function will return a list of data withstatusandmessagekeys.statuskey is a String value that will return status of payment process.messagekey is a String value that will return message of payment process.
{
"status": "FAILED",
"message": "Your payment has been failed."
}
Verified Signature Response
{
"orderId": "xxx",
"biapayTransactionId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"transactionId": "xxxxx",
"biapaySignature": "xxxxxxxxxxxxxxxxxxxxxxx",
"generatedSignature": "xxxxxxxxxxxxxxxxxxxxxxx",
"message": "Signature verified successfully."
}
Additional information
For more information, see BIAPAY.
