SDK Flutter
This SDK is designed to allow the integration of KKiaPay into your Flutter mobile application. To set it up you will need to create an account on kkiapay.me platform and follow the process here describes :
Install the KKiaPay Flutter SDK
To install this plugin you will have to add kkiapay_flutter_sdk to the pubspec.yml file contained in your project.
Practical guide for installing a package with Flutter : Installing a package.
2. Import the KKiaPay's package
3. Create a KKiaPay's instance
Attribute | Type | Description |
amount | Numeric | The amount to be paid (in XOF) |
phone | String | A valid money mobile number (MTN or MOOV) Ex: 22997000000 Ex: 22995000000 |
name | String | The first and last name of the initiator of the payment |
apikey | String | The public key linked to your KKiaPay account |
sandbox | Boolean | Allows you to switch from the test environment to the production environment. The value true for this attribute means that you are in a test environment |
data | String | The data or information related to a transaction and interpretable by your system |
successCallback | Function | The callback function called only when the payment was successful |
The successCallback function called at the end of a success type payment can be used to notify the backend that the transaction has been successfully completed; redirect the user to another view of the mobile application; or generate an invoice. It all depends on the workflow of the mobile application. The parameters of the function are :
The context of the payment widget
The response, which is an object containing the amount and the transaction identifier (transactionId)
In order to verify a payment transaction, choose to configure a webhook.
4. Create a KKiaPay's instance
In order to add the KKiaPay payment button in your mobile application you will need to create a Flutter KkiapaySample widget. A click on the said button will call the KKiaPay instance defined above and will trigger the display of the KKiaPay widget with the specified payment information.
Replace the body attribute of your Flutter App starter by the KkiapaySample widget implemented below:
Example
For more informations on the SDK please follow the link below : KKiaPay Flutter SDK.
Last updated