Flutter SDK
The hundredpay Flutter package lets you accept crypto payments in iOS and Android apps with a single method call. It opens the 100Pay Checkout UI inside your app using a native webview.
- Supports Android and iOS
- Minimal setup — just pass customer and billing info
- Built on
webview_flutterunder the hood
Package: pub.dev/packages/hundredpayÂ
Getting Started
Create a 100Pay Account
Sign up or log in to your 100Pay account and obtain your Public API Key from the Developer Settings .
Add the Dependency
In your pubspec.yaml:
dependencies:
hundredpay: ^latestThen run:
flutter pub getAndroid Compatibility
Your minSdkVersion must be 19 or higher. Open android/app/build.gradle and update:
android {
defaultConfig {
applicationId "com.yourapp.id"
minSdkVersion 19 // Must be 19 or higher
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionVersion
}
}Make a Payment
Import the package and call HundredPay.makePayment():
import 'package:hundredpay/hundredpay.dart';
// Generate a unique reference ID per transaction
final String refId = DateTime.now().millisecondsSinceEpoch.toString();
await HundredPay.makePayment(
customerEmail: "[email protected]",
customerPhoneNumber: "0800000000",
customerName: "Jane Doe",
customerUserId: "user_123", // Your internal user ID
amount: "49.99",
userId: "12345", // Your 100Pay user/app ID
refId: refId, // Unique per transaction
description: "Monthly subscription",
apiKey: "LIVE;PK;your_public_key", // From Developer Settings
currency: "NGN", // e.g. "USD", "NGN", "GHS"
country: "NG", // ISO country code
chargeSource: "api",
callBackUrl: "https://yourapp.com/payment/callback",
onError: (error) {
print("Payment error: $error");
},
onComplete: ({ completed }) {
if (completed) {
print("Payment completed successfully!");
// Verify payment on your backend using the refId
}
},
context: context,
);Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
customerEmail | String | ✅ | Customer’s email address |
customerPhoneNumber | String | ✅ | Customer’s phone number |
customerName | String | ✅ | Customer’s display name |
customerUserId | String | ✅ | Your app’s internal user ID |
amount | String | ✅ | Payment amount as a string (e.g. "49.99") |
userId | String | ✅ | Your 100Pay user/app identifier |
refId | String | ✅ | Unique transaction reference — generate a new one per payment |
description | String | ✅ | Short description of the payment |
apiKey | String | ✅ | Your Public API Key from the Developer Settings — format: "LIVE;PK;..." |
currency | String | ✅ | Currency code (e.g. "NGN", "USD", "GHS") |
country | String | ✅ | ISO 3166-1 alpha-2 country code (e.g. "NG", "US") |
chargeSource | String | ✅ | Always "api" for SDK-initiated payments |
callBackUrl | String | ✅ | URL invoked after payment completes |
onError | Function(error) | ✅ | Called if an error occurs during payment |
onComplete | Function({completed}) | ✅ | Called on completion — completed: true means the user finished the flow |
context | BuildContext | ✅ | Flutter BuildContext from the calling widget |
onComplete fires when the checkout UI closes — not necessarily when the payment is confirmed. Always verify the payment on your server using the refId before fulfilling orders or granting access.
API Key Format
Your API key includes a mode prefix. It looks like:
LIVE;PK;eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...LIVE— production mode (TESTfor sandbox)PK— public key type (SKfor secret key — never use server-side keys here)- The token after the second
;is the actual key payload
Copy the full string from your Developer Settings .
After Payment: Verify on Your Server
The onComplete callback is client-side only. Use the refId you passed in to verify the payment via your backend:
onComplete: ({ completed }) async {
if (completed) {
final result = await http.post(
Uri.parse("https://yourapp.com/api/verify-payment"),
body: jsonEncode({ "refId": refId }),
headers: { "Content-Type": "application/json" },
);
final data = jsonDecode(result.body);
if (data["success"] == true) {
// Unlock feature / navigate to success screen
}
}
},See Verify Payments for the server-side verification guide using the 100pay.js SDK.
Dependencies
The hundredpay package relies on:
| Package | Purpose |
|---|---|
webview_flutter | Renders the checkout UI inside a native webview |
http | HTTP client for API communication |
flutter_spinkit | Loading indicators |
plugin_platform_interface | Flutter plugin interface |
Next Steps
- Verify Payments — confirm payments server-side after checkout
- Pay Checkout JS — web equivalent of this SDK
- 100pay.js — server-side Node.js SDK for transfers, subaccounts, and more