Skip to main content

Getting started

To start collecting payment with Payaza install payaza widget by adding as a in pubspec.yaml dependency
dependencies:
    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

ParameterDescriptionFormat
emailThe email address of the customer.string
firstNameThe first name of the customer.string
lastNameThe last name of the customer.string
phone_numberThe phone number of the customer. It must be international standard i.e. +2348012345678string
transactionReferenceThis is the transaction reference that you generated for the transaction. This unique and no 2 transactions can have the same reference..string
merchantKeyThis is your public API Key.string
connectionModeMode of session (LIVE_CONNECTION_MODE or TEST_CONNECTION_MODE).string
amountThe amount the customer is expected to pay.double
currencyCodeIt refers to the code of the currency.(NGN, USD etc.).string