> For the complete documentation index, see [llms.txt](https://developers.bead.xyz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developers.bead.xyz/faqs-and-troubleshooting/payments-faqs/resolving-403-forbidden-when-creating-payments.md).

# Resolving “403 Forbidden” When Creating Payments

Use this guide to troubleshoot `403 Forbidden` errors returned by Payments endpoints such as `POST /Payments`. The same guidance applies to the deprecated `POST /Payments/crypto`.

A `403` usually means your request was authenticated, but the credential you used is not permitted to create a payment for the merchant or terminal in your request.

Related:

* `401 Unauthorized` usually means the API key is missing, invalid, masked, or no longer current after a reset.
* `400 Bad Request` usually means the request body failed validation.

### 1) Confirm you are using the correct authentication method

Payments use header based authentication with the terminal API key.

Required headers:

* `X-Api-Key: {apiKey}`
* `Content-Type: application/json`

Common mistakes:

* Using `Authorization: Bearer ...` for Payments (Payments does not accept bearer tokens)
* Using the wrong header name (must be exactly `X-Api-Key`)
* Copying a maskedApiKey value instead of the real apiKey value

#### Example request

```bash
curl -s -X POST "https://api.test.devs.beadpay.io/Payments" \
  -H "Content-Type: application/json" \
  -H "X-Api-Key: {apiKey}" \
  -d '{
    "merchantId": "{merchantId}",
    "terminalId": "{terminalId}",
    "requestedAmount": 1.00,
    "reference": "ORDER-123"
  }'
```

### 2) Understand the Payments credential set (API key model)

With API key auth, the credential set is:

* `apiKey` (terminal API key)
* `merchantId` (the merchant you are creating a payment for)
* `terminalId` (the terminal that will host the payment page)

These values must match the same configured relationship in the environment you are calling. A valid API key used with the wrong merchantId or terminalId is one of the most common causes of `403 Forbidden`.

Practical rule:

* If you change `terminalId`, you must use the API key issued for that terminal.
* Do not mix IDs across different partners, merchants, or terminals.

### 3) Confirm you are calling the right environment

Mixing Sandbox and Production values will often produce a `403`.

* Sandbox base URL: `https://api.test.devs.beadpay.io`
* Production base URL: `https://api.devs.beadpay.io`

Rules:

* Sandbox apiKey works only in Sandbox
* Production apiKey works only in Production
* Sandbox merchantId and terminalId work only in Sandbox
* Production merchantId and terminalId work only in Production

### 4) Common 403 causes and fixes

| Cause                                 | Check                                                                                                     | Fix                                                                                                                                            |
| ------------------------------------- | --------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
| Valid apiKey, wrong merchantId        | Confirm the merchantId you are sending is the one associated with the terminal credential you were issued | Use the merchantId that matches the terminal key set                                                                                           |
| Valid apiKey, wrong terminalId        | Confirm the terminalId you are sending is the one associated with the apiKey                              | Use the terminalId that matches the apiKey, or reset the key on the terminal you want with `POST /Terminals/{id}/api-keys` and use the new key |
| Mixing environments                   | Confirm your base URL and IDs are all for the same environment                                            | Use Sandbox IDs with Sandbox base URL and Production IDs with Production base URL                                                              |
| Terminal not permitted or not enabled | Confirm the terminal is configured for Payments in that environment                                       | Verify terminal configuration with your Bead contact                                                                                           |
| Request sent with a Bearer token      | Confirm you are not using `Authorization: Bearer ...`                                                     | Use `X-Api-Key` for `POST /Payments`                                                                                                           |
| Caching the wrong credential          | Confirm your app is not reusing an apiKey from a different terminal                                       | Store apiKey per terminal and select the correct one at runtime                                                                                |

### 5) Still blocked?

When escalating a `403`, include the following so support can trace the request quickly:

1. Timestamp (with timezone)
2. Environment (Sandbox or Production)
3. Endpoint called (for example `POST /Payments`)
4. merchantId and terminalId you sent
5. The request ID from response headers (if present)
6. The full response body (do not include your apiKey)

Tip:

* Do not paste the apiKey into tickets or chat. Treat it like a password.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://developers.bead.xyz/faqs-and-troubleshooting/payments-faqs/resolving-403-forbidden-when-creating-payments.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
