> For the complete documentation index, see [llms.txt](https://developer.browpay.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.browpay.com/payments/collect-payments/initialize-transaction.md).

# Initialize Transaction

**Always verify transactions before you give value**; if you provide a callback in your payload we will be sending your transaction reference via a HTTP `get` request with a query `?reference=your_transaction_reference`.

<details>

<summary>Sample Payload</summary>

```json
{
    "reference": "egobetter4u247",
    "callback_url": "https://yourcallback.com",
    "expires_in": 3,
    "currency": "NGN",
    "products": [
        {
            "name": "Toyota Avenza 2013 model",
            "description": "3.5litre turbo V6 with 2k mileage, Silver Colour",
            "amount": 630000000
        },
        {
            "name": "Nike Air Max pro",
            "description": "Factory signed, Size 40(EU)",
            "amount": 40000000
        }
    ],
    "customer": {
            "name": "Ciroma Alade",
            "email": "ciroma@alade.com",
            "phone": "08101234567"
        },
    "metadata": {
        "location": "Abuja",
        "dispatch": [
            {
                "name": "Sender's Logistics ",
                "package": "Express Mini"
            }
        ] 
    }
}
```

</details>

<mark style="color:green;">`POST`</mark> `{{base_url}}/payment/initialize`

{% hint style="info" %}
Fields with <mark style="color:red;">\*</mark> are required
{% endhint %}

#### Headers

| Name                                            | Type   | Value                        |
| ----------------------------------------------- | ------ | ---------------------------- |
| Authorization<mark style="color:red;">\*</mark> | String | Bearer {{your\_secret\_key}} |
| Content-Type                                    | String | Application/json             |

#### Request Body

| Name                                                   | Type    | Description                                                                                                                                                                                                                                                                        |
| ------------------------------------------------------ | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| reference<mark style="color:red;">\*</mark>            | String  | Your unique Alphanumeric reference                                                                                                                                                                                                                                                 |
| expires\_in<mark style="color:red;">\*</mark>          | Integer | A single-digit integer value between 0 - 30 days. You can make your customers define it but we prefer you do for consistency sake. However communicate this to your customers clearly before collecting payment. NOTE: for non-escrow/instant payments/settlements, set this at 0. |
| currency<mark style="color:red;">\*</mark>             | String  | We only allow "NGN" at the moment                                                                                                                                                                                                                                                  |
| products<mark style="color:red;">\*</mark>             | Array   | An array of objects                                                                                                                                                                                                                                                                |
| products.name<mark style="color:red;">\*</mark>        | String  | The product you are selling                                                                                                                                                                                                                                                        |
| products.description<mark style="color:red;">\*</mark> | String  | A description of the product. Use clear terms. e.g. XL Natural Wool Male White Top                                                                                                                                                                                                 |
| products.amount<mark style="color:red;">\*</mark>      | Integer | We expect a multiple of 100. That is, if your customer is paying 500 NGN  we expect an input of 500 x 100. 50000 kobo                                                                                                                                                              |
| customer<mark style="color:red;">\*</mark>             | Object  | An object of the customer information which consists of the `name`, `email` and `phone` keys                                                                                                                                                                                       |
| customer.name<mark style="color:red;">\*</mark>        | String  | Your customer's first and last name.                                                                                                                                                                                                                                               |
| customer.email<mark style="color:red;">\*</mark>       | String  | Your customer's email                                                                                                                                                                                                                                                              |
| customer.phone<mark style="color:red;">\*</mark>       | String  | An 11 character long string in this format "09101234567"                                                                                                                                                                                                                           |
| metadata                                               | Object  | Additional Information you would like to add e.g {location : "Abuja"}                                                                                                                                                                                                              |
| callback\_url                                          | URL     | Your callback endpoint for this transaction.                                                                                                                                                                                                                                       |

{% tabs %}
{% tab title="200: OK Your request is valid" %}

```json
{
    "authorization_url": "https://checkout.browpay.com/0xGuq2ZLIDCZsVI",
    "success": true,
    "payment_reference": "egobetter4u247"
}
```

{% endtab %}

{% tab title="500: Internal Server Error Duplicate reference found" %}

```json
{
    "success": false,
    "error": {},
    "message": "Request failed with status code 422"
}
```

{% endtab %}

{% tab title="403: Forbidden " %}

{% endtab %}
{% endtabs %}
