Errors
Errors use conventional HTTP status codes and a single JSON envelope:
{ "error": { "type": "invalid_request_error", "code": "amount_invalid", "message": "amount must be a positive decimal string like \"59.90\"", "param": "amount", "request_id": "req_01J…" }}typeis a stable category (below). Branch on it in code.codeis a more specific machine-readable reason. New codes may be added; treat unknown codes by theirtype.paramnames the offending field when there is one.messageis for humans and may change — do not parse it.request_idmatches theRequest-Idresponse header.
Error types
Section titled “Error types”type |
Typical status | Meaning | What to do |
|---|---|---|---|
invalid_request_error |
400, 422 | Malformed JSON, unknown field, invalid value | Fix the request; do not retry unchanged |
authentication_error |
401 | Missing, invalid or revoked credentials | Check the key and environment |
permission_error |
403 | Authenticated but not allowed (scope, role, store restriction) | Use a key with the right scope |
not_found_error |
404 | The object does not exist or is not visible to your organization | Check the id and environment |
conflict_error |
409 | The object’s state does not allow the action (e.g. cancel after a transfer was observed) | Re-read the object and decide |
idempotency_error |
409, 422 | Idempotency-Key reused with different parameters |
Use a new key for a new operation |
rate_limit_error |
429 | Too many requests; see Retry-After |
Back off and retry |
feature_unavailable_error |
403 | The feature is not available yet: live payments have not started on the platform, payouts are not enabled, the network is disabled or a fiat partner is not in place | Do not retry; the capability is not enabled |
api_error |
500 | Unexpected server error (logged with the request id) | Retry with backoff using the same Idempotency-Key |
Unknown fields in request bodies are rejected with invalid_request_error / parameter_unknown rather than
silently ignored, so typos surface immediately.
When a live feature is switched off
Section titled “When a live feature is switched off”Live payments are on. If the platform switches a live feature off, expect these codes:
code |
type |
When |
|---|---|---|
live_keys_disabled |
feature_unavailable_error |
Creating a live API key while live keys are switched off |
live_mode_disabled |
feature_unavailable_error |
Using live mode, with a live API key or in the dashboard, while production is switched off |
live_processing_unavailable |
feature_unavailable_error |
Creating a payment intent while live payment processing is switched off |
payouts_unavailable |
feature_unavailable_error |
Requesting a payout while payouts are switched off (they are switched separately from live payments) |
payment_method_unavailable |
feature_unavailable_error |
Accepting PIX (allowed_methods with pix) while PIX is switched off. See PIX (Brazil) |
payouts_live_only |
invalid_request_error (422) |
Managing payout addresses or payouts outside live mode. Payouts move real money |
test_mode_disabled |
feature_unavailable_error |
Creating or using a key that is not live, or creating a payment that is not live. Every key and payment is live, so create a live API key |
Retrying doesn’t fix any of them. Once the feature is back on, the request works.
Cross-tenant requests
Section titled “Cross-tenant requests”Requests for another organization’s objects return not_found_error, not permission_error. This avoids
confirming that an id exists.
SDK error classes
Section titled “SDK error classes”| SDK | Base class | Specific classes |
|---|---|---|
| TypeScript | FeitPayError |
FeitPayInvalidRequestError, FeitPayAuthenticationError, FeitPayPermissionError, FeitPayNotFoundError, FeitPayConflictError, FeitPayIdempotencyError, FeitPayRateLimitError, FeitPayFeatureUnavailableError, FeitPayAPIError, FeitPayConnectionError |
| Python | FeitPayError |
InvalidRequestError, AuthenticationError, PermissionDeniedError, NotFoundError, ConflictError, IdempotencyError, RateLimitError, FeatureUnavailableError, APIError, APIConnectionError |
| Go | *feitpay.Error |
inspect Type, Code, Param, Status, RequestID (or feitpay.ErrorType(err)) |
Connection errors (connection_error, status 0) mean no response was received; retrying with the same
Idempotency-Key is safe.