ercaspay 0.0.3+4 copy "ercaspay: ^0.0.3+4" to clipboard
ercaspay: ^0.0.3+4 copied to clipboard

A Flutter package for 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

  1. 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: 'ola@gmail.com',phoneNumber: '07023456789'),
        description: 'The description for this payment goes here',
        metadata: {
           "firstname": "Ola",
           "lastname": "Benson",
           "email": "iie@mail.com"
        },
        live: false
);

PaymentResponse? response = await ercaspay.chargeTransaction();
  1. 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
}
2
likes
100
points
0
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter package for ercaspay.

Repository (GitHub)
View/report issues

Documentation

API reference

License

unknown (license)

Dependencies

dio, flutter, flutter_inappwebview

More

Packages that depend on ercaspay