# Initialize Payment

## Start Payment

<mark style="color:green;">`POST`</mark> `https://a1pay.net/`api/merchantapi/initialize-payment

Make a call to the endpoint above and pass the payload below in the request body

#### Request Headers

#### Request Body

| Name             | Type   | Description                                                                                                                                           |
| ---------------- | ------ | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
| transType        | string | Short description of the type of transaction e.g School Fees                                                                                          |
| customerName     | string | User's full name concatenated as firstName + space + lastName                                                                                         |
| paymentReference | string | Your unique transaction reference.                                                                                                                    |
| phoneNumber      | string | User's Phone number                                                                                                                                   |
| emailAddress     | string | User's email address                                                                                                                                  |
| amount           | number | How much the user is expected to pay for the goods or service in Naira not Kobo. Ensure the value is formatted as currency having two decimal points. |

{% tabs %}
{% tab title="200 If call is successful, A1Pay will load the payment form" %}

```javascript
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
Ensure that you have your **CallbackURL** and **ReturnURL** ready to receive responses from A1Pay. Once a transaction is successful, A1Pay will redirect the user to your ReturnURL with URL parameter **Ref** which is the A1Pay transaction reference along with URL parameter Response which will be **00** if the transaction is successful.

Another URL parameter **MerchantRef** will also be passed to your ReturnURL. This will hold your unique transaction reference, and you can query A1Pay with this parameter. [See more on this here](https://blended.gitbook.io/a1pay/accept-payment-using-a1pay/query-status-with-your-reference).

A1Pay will also send a post request to your CallbackURL with the transaction status
{% endhint %}

{% hint style="danger" %}
Always ensure to call the A1Pay Query secure endpoint to confirm the transaction status received by the ReturnURL, this is the recommended practice to prevent malicious users from circumventing your system.
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://blended.gitbook.io/a1pay/accept-payment-using-a1pay/initialize-payment.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
