Getting started
To start collecting payment with Payaza install payaza widget by adding as a in pubspec.yaml dependencydependencies:
payaza: ^1.0.0
Usage
Initialize SDK anywhere before use//...
Payaza.init('<public key>');
runApp(const MyApp());
//...
// ...
import 'package:payaza/payaza.dart';
// ...
void handleSuccess(PayazaSuccessResponse response) async {
await showAlert(
message: response.data.payazaReference ?? '',
title: 'Payment Successful');
if (context.mounted) {
Navigator.of(context).pop();
}
}
void handleError(PayazaErrorResponse response) async {
await showAlert(message: response.data.message, title: 'Error');
if (context.mounted) {
Navigator.of(context).pop();
}
}
void handleClose() {
print('Payaza widget was closed');
}
void onSubmit() {
Payaza.createTransaction(
context,
config: PayazaConfig(
amount: 110,
connectionMode: PayazaConnectionMode.LIVE_CONNECTION_MODE,
email: "example@example.com",
firstName: "<first name>",
lastName: "<last name>",
phoneNumber: "<+12345678900>",
transactionReference: "transaction_reference",
currencyCode: <NGN>,
),
onSuccess: handleSuccess,
onError: handleError,
onClose: handleClose,
);
}
Arguments
| Parameter | Description | Format |
|---|---|---|
| The email address of the customer. | string | |
| firstName | The first name of the customer. | string |
| lastName | The last name of the customer. | string |
| phone_number | The phone number of the customer. It must be international standard i.e. +2348012345678 | string |
| transactionReference | This is the transaction reference that you generated for the transaction. This unique and no 2 transactions can have the same reference.. | string |
| merchantKey | This is your public API Key. | string |
| connectionMode | Mode of session (LIVE_CONNECTION_MODE or TEST_CONNECTION_MODE). | string |
| amount | The amount the customer is expected to pay. | double |
| currencyCode | It refers to the code of the currency.(NGN, USD etc.). | string |