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
.dartfile
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 toinitSDK()Parameter Type Description statusString Indicates the status of the payment. Possible values are: success,errorreferenceString This is a unique identifier for the payment created. It is only returned when the statusissuccess -
KaizaError: Exceptions are thrown during your integration process. There are mostly issues surronding the development process. Exceptions make use of the platform-specific
DartErrormodel which has the following parameters: following model:Parameter Type Description messageString This is a short description of the error
Libraries
- kaizapay_sdk_dart
- Support for doing something awesome.