Search Documentation

Search across all documentation pages, APIs and guides.

Flutter Plugin Integration

Getting Started

Add the dependency in your pubspec.yaml:

dependencies:
ipg_flutter: ^1.1.3

Usage

var ipg = Ipg.init(
appToken: 'your_token',
appId: 'your_app_id',
firstName: 'John',
lastName: 'Doe',
email: 'john.doe@sample.com',
phoneNumber: '0000000000',
);
// Start card addition flow
ipg.addNewCard(context);
// Callback when card add flow completes
ipg.addCardEventCallback = (status, errorMessage) {
print("Adding card result: $status - $errorMessage");
};
// Retrieve customer list (saved cards)
ipg.getCustomers();
// Callback when customers are retrieved
ipg.getCustomersEventCallback = (customerList, errorMessage) {
print("Customers: $customerList");
};
// Make customer payment
// Valid Currency codes: LKR, USD
ipg.makeCustomerPayment(amount, currencyCode, customerCardToken);
// Listen to payment status
ipg.customerPaymentEventCallback = (status, errorMessage ) {
print("Payment Status: $status - $errorMessage");
};

Android Setup

Since this package communicates with the internet, make sure you have added the following permission in your AndroidManifest.xml file:

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

📦 Onepay Flutter Plugin Code Example

Clone the repo and run the example:

cd example
flutter create
flutter run
All Set! Your Flutter app is now ready to accept payments through Onepay.