> ## Documentation Index
> Fetch the complete documentation index at: https://docs.payaza.africa/llms.txt
> Use this file to discover all available pages before exploring further.

# Flutter

> Payaza’s Flutter SDK makes it easy for you to start accepting payments from your customers when they visit your applications. The checkout SDK can be integrated in very easy steps, making it the easiest way to start accepting payments.

## 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

| Parameter            | Description                                                                                                                               | Format |
| -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | ------ |
| email                | 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 |
