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

# Errors and payment state

> Handle HTTP failures, retries, receipt status, and idempotency safely.

## HTTP errors

Errors use an appropriate HTTP status and currently return a plain-text, user-safe message.

| Status | Meaning |
| - | - |
| `400` | Invalid input, insufficient balance or allowance, expired data, or an invalid payment state |
| `401` | Missing, invalid, or unauthorized bearer credential |
| `409` | The requested operation conflicts with the current resource state |
| `500` | The service could not complete the request |
| `503` | A required dependency such as an RPC endpoint is unavailable |

Do not parse human-readable error text into business logic. Branch on the HTTP status and the payment receipt state.

## Retry policy

* Retry `429` and transient `5xx` responses with exponential backoff and jitter.
* Do not automatically retry a payment submission after a timeout unless you have first checked whether a receipt was created.
* Do not retry `400` or `401` without changing the request or credential.
* In context to payment gateway integration, persist your merchant order ID (for marketplace) and the UniFi pay receipt ID together.

## Receipt state

`Processing` is not a failure; the web app presents this state as **Submitted**. `Confirmed` and
`Finalized` represent different settlement confidence. `Failed` and `Reorged` require explicit
handling.

> [!WARNING]
>
> The public payment endpoint does not accept a caller-supplied idempotency
> key. Prevent duplicate submissions in your own order state machine.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.