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

# Retries

> Network calls fail sometimes. Send the same reference again and you'll never pay or charge twice.

## References make retries safe

Every request that creates something takes a `reference`: your own ID for it, such as an order or payout ID. A reference can be used once per business. If a request times out and you don't know whether it went through, send it again with the same reference:

* If the first attempt went through, the retry gets `409` and nothing new is created. Look the original up by its reference.
* If it didn't, the retry creates it.

```bash cURL theme={null}
curl "https://api.pay.flipeet.io/api/v1/merchant/transactions/payout_5510" \
  -H "x-api-key: $FLIPEET_SECRET_KEY"
```

```javascript Node.js theme={null}
const response = await fetch("https://api.pay.flipeet.io/api/v1/merchant/transactions/payout_5510", {
  method: "GET",
  headers: {
    "x-api-key": process.env.FLIPEET_SECRET_KEY,
  },
});
const { data } = await response.json();
```

```python Python theme={null}
import os
import requests

response = requests.get(
    "https://api.pay.flipeet.io/api/v1/merchant/transactions/payout_5510",
    headers={"x-api-key": os.environ["FLIPEET_SECRET_KEY"]},
)
data = response.json()["data"]
```

## What to retry

| Status | Retry? |
| - | - |
| `429`, `500`, `502`, `503` | Yes, with the same reference and exponential backoff, such as 1, 2, 4 and 8 seconds. |
| `504` | Check the payment's status first; then retry with the same reference if it doesn't exist. |
| `400`, `401`, `403`, `404` | No. Change the request first. |
| `409` | No. The payment already exists. |

## Payouts we can't confirm

If a bank or network doesn't tell us clearly whether a payout went through, the withdrawal stays `processing` while we check it with them. We never refund a payout that may have gone through, and we never send it again on our own. You get the webhook once it settles.


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