# Errors

Errors return an HTTP status and a JSON body:

```json
{ "error": { "type": "invalid_request_error", "code": "resource_missing", "message": "No such payment_intent: pi_...", "param": "id" } }
```

| Status | `type` | Meaning |
| --- | --- | --- |
| 400 | `invalid_request_error` | Bad or missing parameters; `param` names the field. |
| 401 | `authentication_error` | Missing or invalid key. |
| 402 | `card_error` / `api_error` | Card declined, or the gateway refused. |
| 403 | `authentication_error` | Wrong key type, or not allowed (agent scopes and limits). |
| 404 | `invalid_request_error` | Not found (or not yours). |
| 409 | `invalid_request_error` / `idempotency_error` | Conflict: already being confirmed, total changed, idempotency key reused. |
| 429 | `rate_limit_error` | Slow down. |
| 500 | `api_error` | Our problem; safe to retry with the same `Idempotency-Key`. |

Declines don't throw: confirm returns the payment intent with `status: "requires_payment_method"` and `last_error: {code, message, declined}`.
