Gideon Chukwuoma
Gideon Chukwuoma
All work

AlatPayFlutter

A payment gateway in one widget.

Open-source Flutter SDK for WEMA Bank's AlatPay gateway: drop-in checkout widget with transaction and close callbacks.

Role
Author and maintainer
Period
Jan 2024
Platforms
Android, iOS, Web
  • Flutter
  • Dart
  • WebView

dart

// simplified
AlatPayFlutter(
  apiKey: config.apiKey,
  businessId: config.businessId,
  email: customer.email,
  phone: customer.phone,
  firstName: customer.firstName,
  lastName: customer.lastName,
  currency: 'NGN',
  amount: '5000',
  // …

AlatPayFlutter is an open-source Flutter SDK for WEMA Bank's AlatPay payment gateway. It gives a Flutter app a drop-in checkout widget that runs AlatPay's checkout in a WebView and reports back through two callbacks: one when a transaction completes and one when the checkout is closed. It works on Android, iOS and the web, and it's published on pub.dev.

01Problem

Payment gateways usually ship a web checkout and leave mobile developers to wire it up themselves: open a WebView, watch for the result, parse it and handle failures. Every app that integrates AlatPay would repeat that work, and each copy is a place for a payment bug to hide.

02Role

I wrote the package and published it on pub.dev in January 2024 as open source.

03Stack

Flutter and Dart, with a WebView for the hosted checkout. One package targets Android, iOS and the web.

04Decisions

A widget, not a set of instructions

The SDK is a single widget. A developer passes in the payment and customer details and two callbacks, and the widget handles the checkout. The app only decides what happens when a transaction comes back or the customer closes the checkout.

dart
// simplified
AlatPayFlutter(
  apiKey: config.apiKey,
  businessId: config.businessId,
  email: customer.email,
  phone: customer.phone,
  firstName: customer.firstName,
  lastName: customer.lastName,
  currency: 'NGN',
  amount: '5000',
  onTransaction: (response) => showReceipt(response),
  onClose: () => Navigator.of(context).pop(),
);

Use the gateway's own checkout

Running AlatPay's hosted checkout inside a WebView keeps payment details on the gateway's own page, not in the app's UI. The package doesn't rebuild the payment form, so it doesn't have to keep up with changes to it.

Two exits, both explicit

The widget exposes onTransaction for the gateway's response and onClose for when the customer leaves the checkout. The app decides what each one means for its own flow, rather than the SDK guessing.

05Outcome

A published package that a Flutter developer adds as one dependency, with the source open for anyone to read. Source and docs are on pub.dev.