klasha_flutter_checkout 0.0.2 klasha_flutter_checkout: ^0.0.2 copied to clipboard
A Flutter plugin for making payments via Klasha Checkout Technology
klasha_flutter_checkout #
A Flutter plugin for making payments via Klasha Checkout Technology
About #
Klasha Flutter SDK allows you to build a quick, simple and excellent payment experience in your Flutter app. We provide powerful and customizable UI screens and elements that can be used out-of-the-box to collect your users' payment details via the Klasha Checkout Technology.
Installing #
In the pubspec.yaml
of your flutter project, add the following dependency:
dependencies:
klasha_flutter_checkout: ^0.0.1
How To Use #
- In your file add the following import:
import 'package:klasha_flutter_checkout/klasha_flutter_checkout.dart';
- Call the
checkout
method:
KlashaCheckout.checkout(
context,
email: _email,
amount: int.parse(_amount),
checkoutCurrency: _checkoutCurrency,
merhcnatKey: 'YOUR_MERCHANT_KEY',
);
- Handle the response of the
checkout
method
KlashaCheckout.checkout(
context,
// the onComplete callback returns the details of the just completed transaction
onComplete: (KlashaCheckoutResponse klashaCheckoutResponse) {
// the transaction reference of the just carried out transaction
print('checkout response transaction reference is ${klashaCheckoutResponse.transactionReference}');
// the status of the transaction
print('checkout response status is ${klashaCheckoutResponse.status}');
// a user readable message describing the status of the transaction
print('checkout response message is ${klashaCheckoutResponse.message}');
if (klashaCheckoutResponse.status) {
// show success dialog -> transaction successful
} else {
// show error dialog -> transaction not successful
}
},
);
Customizations #
Property | Description |
---|---|
The email of the customer. | |
amount | The amount to pay in the currency selected in [checkoutCurrency], if the [checkoutCurrency] is not provided, it defaults to [CheckoutCurrency.NGN]. |
checkoutCurrency | The checkout currency to use, if the [checkoutCurrency] is not provided, it defaults to [CheckoutCurrency.NGN]. |
environment | The environment to use, if it is not provided, it defaults to [Environment.TEST] |
onComplete | This returns the status, message and transaction reference about the just carried out transaction. |
merchantKey | The merchant key. |
Contributions #
Feel free to contribute to this project.
If you find a bug or want a feature, but don't know how to fix/implement it, please fill an issue. If you fixed a bug or implemented a feature, please send a pull request.