alatpay_sdk 1.0.4 copy "alatpay_sdk: ^1.0.4" to clipboard
alatpay_sdk: ^1.0.4 copied to clipboard

A Flutter SDK for seamless Alat Pay integration, enabling secure, fast, and reliable in-app payments with simple APIs for payment initialization, confirmation, and tracking.

AlatPay SDK #

A performant SDK for integrating AlatPay payment services into your Flutter applications.

  1. Seamless payment initialization and verification for bank transfers, USSD and bank details
  2. UI customization with AlatPayTheme and branding image

All via a simple, unified function

Bank Transfer USSD
Bank Details OTP

Above: The included example app.

Basics #

Syntax #

To initiate a payment , call the AlatPaySdk.startPayment method, and specify the required props:

    AlatPaySdk.startPayment(
      context,
      request: PaymentRequest(
      businessId: "****************",
      amount: 100,
      currency: "NGN",
      customer: Customer(
      email: "jane.doe@email.com",
      phone: "09038818841",
      firstName: "Jane",
      lastName: "Doe",
        ),
    ),
      secretKey: "****************",
      onPaymentComplete: (result) {
        Navigator.pop(context);
        ScaffoldMessenger.of(context).showSnackBar(
          SnackBar(
            backgroundColor: Colors.green,
            content: Text("Successful payment ${result?.message}"),
          ),
        );
      },
      onPaymentError: (panic) {
        Navigator.pop(context);
        ScaffoldMessenger.of(context).showSnackBar(
          SnackBar(
            backgroundColor: Colors.red,
            content: Text(panic.toString()),
          ),
        );
      },
    );

It also adds an AlatPayTheme class, which allows you to customize the look and feel of the payment screens.

AlatPayTheme (
  primaryColor: Colors.blue,
  secondaryColor: Colors.blueAccent,
  )

Branding #

You have optional branding parameter to replace the AlatPay logo with your own image.

      branding: "assets/images/branding.png",

Events & callbacks #

AlatPaySdk.startPayment includes the following callbacks:

  • onPaymentComplete: the payment was completed successfully, the call back returns a PaymentResult object
  • onPaymentError: the payment failed, the call back returns a String error message, this callback only covers errors during the payment process, network errors, invalid parameters, etc

Errors such as invalid otp, invalid bank details, insufficient funds, etc are handled within the payment flow itself and do not trigger this callback.

Installation #

Grab it from pub.dev.

1
likes
160
points
61
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

A Flutter SDK for seamless Alat Pay integration, enabling secure, fast, and reliable in-app payments with simple APIs for payment initialization, confirmation, and tracking.

Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

cupertino_icons, flutter, http

More

Packages that depend on alatpay_sdk