kaizapay_sdk_dart 1.0.3 copy "kaizapay_sdk_dart: ^1.0.3" to clipboard
kaizapay_sdk_dart: ^1.0.3 copied to clipboard

A KaizaPay package for accepting payments in your Dart application.

KaizaPay Dart SDK #

A KaizaPay plugin for accepting payments in your Dart application.

Support #

Android iOS MacOS Web Linux Windows

Requirements #

KaizaPay Dart SDK builds upon the recent patterns in the Android and iOS, thus your app should target:

  • Dart >= 3.10.3

Getting Started #

  • Install the dependency in your project
dart pub get kaizapay_sdk_dart
  • Import the kaizapay SDK into your .dart file
import 'package:kaizapay_sdk_dart/kaizapay_sdk_dart.dart';
  • Use the package
final _apiKey = "your_api_key";
final _apiSecret = "your_api_secret";
final _kaiza = Kaiza(
  apiKey: _apiKey,
  apiSecret: _apiSecret,
);

 initialize(String publicKey) async {
    try {
      final response = await _kaiza.initSDK();
      if (response) {
        log("Sucessfully initialised the SDK");
      } else {
        log("Unable to initialise the SDK");
      }
    } on Exception catch (e) {
      log(e.message!);
    }
  }

  Future<Payment> launch() async {
    String reference = "";
    try {
      final payment = await _kaiza.initiatePayment(
        InitiatePaymentDTO(
          amount: 100,
          redirectURL: 'https://testredirecturl.com',
        ),
      );
      log(payment);
      return payment;
    } on PlatformException catch (e) {
      log(e.message!);
      rethrow;
    }
  }

Handling responses #

The SDK produces two categories of responses - Payment objects and KaizaError objects

  • Payment object. It is returned when a call to initiatePayment() is successful after a preceding call to initSDK()

    Parameter Type Description
    status String Indicates the status of the payment. Possible values are: success, error
    reference String This is a unique identifier for the payment created. It is only returned when the status is success
  • KaizaError: Exceptions are thrown during your integration process. There are mostly issues surronding the development process. Exceptions make use of the platform-specific DartError model which has the following parameters: following model:

    Parameter Type Description
    message String This is a short description of the error
0
likes
140
points
20
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

A KaizaPay package for accepting payments in your Dart application.

Repository (GitHub)

License

BSD-3-Clause (license)

Dependencies

dartz, dio

More

Packages that depend on kaizapay_sdk_dart