Requirements
If you don't know how to get your API credentials in the Dashboard, please consult Getting your API Key (opens in a new tab) documentation.
To Get Started with this SDK, Make sure you have a Flutter application ready. Also make sure you subscribe to the various payment providers you want
dependencies
pay_unit_sdk: ^2.0.20
allprojects {
repositories {
google()
mavenCentral() <---
jcenter()
}
}
Get all your packages Using:
terminal
flutter pub get
Using the SDK
Import PayUnit in the required widget
import "package:pay_unit_sdk/payunitpackage.dart"
Use the pay button as a widget.
// @dart=2.9 <-- put this to your main.dart before importation list to avoid null-safety
import...
PayUnitButton(
apiUser:"<Your apiuser>",
apiPassword: "<Your apiPassword>",
apiKey: "<Your apiKey>",
transactionId: "<The id of your transaction>",
mode: 'sandbox' // sandbox or live,
transactionCallBackUrl:"<Your transactionCallBackUrl url>",
notiFyUrl: "<Your notification url>",
transactionAmount: "<Your transaction amount>",
currency:"XAF", //// The currency of your transaction : XAF for FCFA or USD for $ ect ...
buttonTextColor: "<Custom the color of the text PayUnit button>",
productName:"<The name of the product>",
color: "<Custom the color of PayUnit button>",///the colors of the PayUnit Button text DEFAULT WHITE,
actionAfterProccess: (transactionId, transactionStatus) {
//here is the action who start after the end of the paiement , you can perform
//some operation here , like display a alertDialog after the end of the payment.
},
),
Then in your view a PayUnit button will appear. When clicked, performs the actual payment.
Demo
Watch demo video here https://youtu.be/QrcgV2g8LzE (opens in a new tab)
Last updated on December 7, 2022