intram_sdk_flutter

pub package License: MIT Platform

A Flutter package for integrating Intram mobile payments via WebView. Supports Android and iOS.

Features

  • Mobile money payment (MTN, Moov, Wave, etc.)
  • Sandbox (test) and production modes
  • Customizable brand colors and logo
  • Success / cancellation / error callbacks
  • No native dependencies beyond webview_flutter

Installation

Add to your pubspec.yaml:

dependencies:
  intram_sdk_flutter: ^2.1.0

Then run:

flutter pub get

Import

import 'package:intram_sdk_flutter/intram_sdk_flutter_webview.dart';

Getting your API keys

  1. Create or log in to your Intram Business account
  2. Go to Developers → API in the left-hand menu
  3. Copy your PUBLIC_KEY, PRIVATE_KEY, SECRET_KEY, and MERCHANT_KEY
  4. Toggle between Sandbox and Live mode as needed

Security note: Only publicKey is used client-side. Keep privateKey, secretKey, and merchantKey on your backend.

Usage

Initialize the SDK

final intramSdk = IntramSdkPayment(
  'YOUR_PUBLIC_KEY',
  'YOUR_PRIVATE_KEY',   // kept for API compatibility, not used client-side
  'YOUR_SECRET_KEY',    // kept for API compatibility, not used client-side
  'YOUR_MERCHANT_KEY',  // kept for API compatibility, not used client-side
  false,
  {},
);

Make a payment

final result = await intramSdk.makePayment(
  context,
  5000,                              // amount in XOF
  true,                              // sandbox: true = test, false = production
  'My Store',                        // store name displayed on the payment screen
  '#29b3a6',                         // brand color (hex)
  'https://example.com/logo.png',    // store logo URL
);

Handle the result

if (result['success'] == true) {
  final transactionId = result['transaction_id'];
  final data = result['data'];
  // Payment succeeded
} else if (result['cancelled'] == true) {
  // User cancelled the payment
} else {
  final error = result['error'];
  // Payment failed
}

Return values

Key Type Description
success bool true if payment succeeded
transaction_id String? Intram transaction ID
data Map? Full response object from the Intram JS SDK
timestamp String? ISO 8601 timestamp of the transaction
cancelled bool? true if the user closed the payment screen
error String? Error message if the payment failed

Optional: callback URL

final result = await intramSdk.makePayment(
  context,
  5000,
  true,
  'My Store',
  '#29b3a6',
  'https://example.com/logo.png',
  callbackUrl: 'https://your-backend.com/webhook/payment',
);

Test numbers

Network Number
MTN 61000000
Moov 94000000

Android configuration

Ensure your AndroidManifest.xml has internet permission:

<uses-permission android:name="android.permission.INTERNET" />

iOS configuration

No additional configuration required. Internet access is allowed by default.

Dependencies

Package Version
webview_flutter ^4.5.0
webview_flutter_android ^3.16.0
webview_flutter_wkwebview ^3.13.0

Contributing

Contributions are welcome. Please open an issue or submit a pull request on GitHub.