ercaspay

Last updated:

0 purchases

ercaspay Image
ercaspay Images
Add to Cart

Description:

ercaspay

Flutter plugin for ercaspay SDK
Getting started #
To use this plugin, add ercaspay as a dependency in your pubspec.yaml file.
How to Use #
This plugin uses two APIs

Create a Ercaspay instance by calling the constructor Ercaspay. The constructor accepts a required instance of the following:
context, token, amount, paymentReference, redirectUrl, currency, feeBearer, paymentMethods, customerDetails It returns an instance of Ercaspay which we then call the async method .chargeTransaction() on.

import 'package:ercaspay/ercaspay.dart';

final ercaspay = Ercaspay(
context: context,
token: 'ECRS-TEST-SKldkjsdwehweuh3u4h3h42uh3UeoOhSK5mPB',
amount: 100,
paymentReference: 'R5md7gd9b4s3h2j5d2q',
redirectUrl: 'https://omolabakeventures.com',
currency: 'NGN',
feeBearer: 'customer',
paymentMethods: 'card,bank-transfer,ussd,qrcode',
customerDetails: CustomerDetails(name: 'Ola',email: '[email protected]',phoneNumber: '07023456789'),
description: 'The description for this payment goes here',
metadata: {
"firstname": "Ola",
"lastname": "Benson",
"email": "[email protected]"
},
live: false
);

PaymentResponse? response = await ercaspay.chargeTransaction();
copied to clipboard

Handle the response
Calling the .chargeTransaction() method returns a Future
of PaymentResponse which we await for the actual response as seen above.

PaymentResponse? response = await ercaspay.chargeTransaction();

if (response != null) {
if(response.success!) {
//handle success response
} else {
//Handle not successful
}
} else {
//User cancelled checkout
}
copied to clipboard

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.