alatpay_sdk 2.0.0
alatpay_sdk: ^2.0.0 copied to clipboard
A Flutter SDK for seamless Alat Pay integration, enabling secure, fast, and reliable in-app payments using the official ALATPay checkout popup.
ALATPay SDK #
A Flutter SDK for integrating the official ALATPay payment checkout into your Flutter applications.
The SDK launches the ALATPay payment popup inside a WebView, supporting all payment methods (bank transfer, USSD, card, etc.) via the official ALATPay checkout page.
Basics #
Installation #
Add the dependency to your pubspec.yaml:
dependencies:
alatpay_sdk: ^2.0.0
Or grab it from pub.dev.
Usage #
To initiate a payment, call the AlatPaySdk.startPayment method with the required parameters:
AlatPaySdk.startPayment(
context,
request: PaymentRequest(
businessId: "your-business-id",
amount: 100,
currency: "NGN",
customer: Customer(
email: "jane.doe@email.com",
phone: "09038818841",
firstName: "Jane",
lastName: "Doe",
),
),
apiKey: "your-alatpay-public-key",
color: "#01070e", // Optional: customize the payment page color
onPaymentComplete: (result) {
if (result.success) {
print("Payment successful: ${result.message}");
print("Transaction data: ${result.raw}");
} else {
print("Payment failed: ${result.message}");
}
},
onClose: () {
print("Payment popup closed");
},
);
Parameters #
PaymentRequest #
| Parameter | Type | Required | Description |
|---|---|---|---|
businessId |
String |
Yes | Your ALATPay business ID |
amount |
double |
Yes | Payment amount |
currency |
String |
No | Currency code (default: "NGN") |
description |
String? |
No | Transaction description |
customer |
Customer |
Yes | Customer details (see below) |
Customer #
| Parameter | Type | Required | Description |
|---|---|---|---|
email |
String |
Yes | Customer email address |
phone |
String? |
No | Customer phone number |
firstName |
String |
Yes | Customer's first name |
lastName |
String |
Yes | Customer's last name |
metadata |
String? |
No | Additional metadata |
startPayment Options #
| Parameter | Type | Required | Description |
|---|---|---|---|
apiKey |
String |
Yes | Your ALATPay public API key |
color |
String? |
No | Hex color for the payment popup (e.g. "#01070e") |
onPaymentComplete |
Function(PaymentResult) |
Yes | Called when transaction completes |
onClose |
Function()? |
No | Called when user closes the popup |
Events & Callbacks #
AlatPaySdk.startPayment provides the following callbacks:
-
onPaymentComplete: Called when the payment transaction finishes. Receives aPaymentResultobject with:success: Whether the payment was successfulmessage: A descriptive messageraw: The raw transaction response data from ALATPay
-
onClose: Called when the user dismisses the payment popup without completing payment.
Platform Setup #
Android #
Ensure your minSdkVersion is at least 20 in android/app/build.gradle:
android {
defaultConfig {
minSdkVersion 20
}
}
iOS #
No additional configuration required. The WebView is supported out of the box.