Errors and retries
Every answer has the same envelope. A refusal adds error.code and a requestId to quote to All Out. Branch on the HTTP status and error.code, never on the message text.
Only 503 and a timeout are worth retrying unchanged, with the same Idempotency-Key. Every other code needs something to change first.
| HTTP | error.code | Do |
|---|---|---|
| 400 | INVALID_REQUEST | Fix the request. |
| 401 | UNAUTHORIZED | Get a new token. |
| 403 | PARTNER_DISABLED | Your account is suspended. Contact All Out. |
| 404 | NOT_FOUND | Check the id and the route. |
| 409 | REFERENCE_CONFLICT, PAYMENT_REFERENCE_CONFLICT, IDEMPOTENCY_CONFLICT | Use a new reference or key, or check your references. |
| 409 | AVAILABILITY_NOT_CONFIRMED, AVAILABILITY_EXPIRED | Do not hold. Release a hold already placed, then make a new request. |
| 409 | INVALID_PAYMENT_TRANSITION, CANCELLATION_NOT_ALLOWED | Read the booking and check its state. |
| 413 | INVALID_REQUEST | Send a smaller body or picture. |
| 422 | PAYMENT_AMOUNT_MISMATCH | Release. Never hold a different amount. |
| 422 | UNPRICEABLE | Contact All Out. |
| 429 | RATE_LIMITED | Wait the seconds in Retry-After. |
| 503 | UNAVAILABLE | Retry with the same key, or read the booking. |