> For the complete documentation index, see [llms.txt](https://startbutton.gitbook.io/startbutton-product-api/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://startbutton.gitbook.io/startbutton-product-api/collections/accept-payments-overview.md).

# Accept Payments — Overview

Initialize a collection transaction to accept a customer payment.

See [Authentication](/startbutton-product-api/getting-started/authentication.md) before making requests.

### Endpoint

`POST /transaction/initialize`

### Headers

| Header        | Value               |
| ------------- | ------------------- |
| Authorization | `Bearer PUBLIC_KEY` |
| Content-Type  | `application/json`  |

Find your public key in **Settings** on the Startbutton dashboard.

### Parameters

| Parameter     | Required | Description                         |
| ------------- | -------- | ----------------------------------- |
| `email`       | Yes      | Payer email address.                |
| `amount`      | Yes      | Amount in fractional units.         |
| `currency`    | Yes      | Collection currency.                |
| `partner`     | No       | A configured partner value.         |
| `reference`   | No       | Your unique collection identifier.  |
| `metadata`    | No       | Your custom transaction data.       |
| `redirectUrl` | No       | URL for the customer after payment. |

On success, the API returns an authorization URL for the customer.

### Sample request

Find test numbers to aid your checkout test [Test Numbers for Collections](/startbutton-product-api/testing/test-numbers-for-collections.md).

{% tabs %}
{% tab title="Required parameters" %}

```json
{
  "amount": 30000,
  "currency": "GHS",
  "email": "test@customer.com"
}
```

Use a supported collection currency.
{% endtab %}

{% tab title="Optional parameters" %}

```json
{
  "amount": 30000,
  "currency": "GHS",
  "email": "test@customer.com",
  "reference": "be6eaxxxxxxx"
}
```

The `reference` value returns as `userTransactionRef` in the webhook payload.
{% endtab %}

{% tab title="Metadata" %}

```json
{
  "amount": 30000,
  "currency": "KES",
  "email": "test@customer.com",
  "reference": "BUY781",
  "metadata": {
    "name": "ade",
    "location": "Nigeria"
  }
}
```

{% endtab %}
{% endtabs %}

### Sample response

```json
{
  "success": true,
  "message": "Encrypted",
  "data": "pay.startbutton.tech/#/{paymentCode}"
}
```
