Idempotency
Retry requests safely, without charging or paying out twice.
Networks fail, and sometimes you do not know whether the API received your request. Send the Idempotency-Key header with a unique value per operation: repeating the request returns the original resource, without creating another one.
| Route | Idempotency-Key |
|---|---|
POST /v1/payouts | Required |
POST /v1/charges | Optional, recommended |
Request with a key
curl -X POST "https://api.raspay.io/v1/payouts" \
-H "Authorization: Bearer $GATEWAY_API_KEY" \
-H "Idempotency-Key: payout-supplier-77" \
-H "Content-Type: application/json" \
-d '{
"amount": 50000,
"pixKey": "finance@example.com",
"pixKeyType": "email"
}'How it works
- The key has up to 200 characters and is valid per account and per environment, with no expiration.
- Use a value from your domain, such as the order ID. A UUID generated before the first attempt also works.
- Same key and same parameters return the existing resource, with the same HTTP status as the creation.
- Same key with different parameters returns
409 idempotency_conflict. - On charges, while the first request has not finished, repetitions get
409 idempotency_in_progress. - A payout refused for insufficient funds does not consume the key: after receiving balance, the same key can be used.
- A charge that failed on creation releases the key. Repeating the request creates a new charge.