klasha_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_checkout: ^0.0.1

How To Use

  1. In your file add the following import:
import 'package:klasha_checkout/klasha_checkout.dart';
  1. Call the checkout method:
    KlashaCheckout.checkout(
      context,
      email: _email,
      amount: int.parse(_amount),
      checkoutCurrency: _checkoutCurrency,
    );
  1. 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

PropertyDescription
emailThe email of the customer.
amountThe amount to pay in the currency selected in checkoutCurrency, if the checkoutCurrency is not provided, it defaults to CheckoutCurrency.NGN.
checkoutCurrencyThe checkout currency to use, if the checkoutCurrency is not provided, it defaults to CheckoutCurrency.NGN.
environmentThe environment to use, if it is not provided, it defaults to Environment.TEST
onCompleteThis returns the status, message and transaction reference about the just carried out transaction.

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.

Libraries

klasha_checkout