DuevanceAPI documentation

Errors

The one error envelope, its types and codes.

Every response from the API host with a status outside 2xx has the same JSON body, whatever went wrong, including an unknown path, a wrong method, a body that is too large or a rate limit. The one exception is a declined or failed charge: its 402 body is the payment itself (see Statuses).

{
    "error": {
        "type": "invalid_request_error",
        "code": "validation_failed",
        "message": "Invalid value: invalid type: floating point `19.99`, expected i64.",
        "param": "amount"
    }
}
  • type is one of the values below. Branch on it; the set only grows with a changelog entry.
  • code is a stable, more specific reason, such as not_found or rate_limited.
  • message is for people. Don't parse it.
  • param names the request field at fault, when there is one, as a dotted path such as customer.country or metadata.note.
  • payment_id names the payment the error is about, when there is one: the payment already holding a reference, or the payment an operation was refused on.

Types

typeTypical statusMeaning
invalid_request_error400, 404, 405, 409, 413, 422The request is malformed, names something that doesn't exist, or fails validation.
authentication_error401No valid API key or signature.
permission_error403The key may not do this (scope), or the merchant or project is suspended.
idempotency_error409, 422The Idempotency-Key was used with another amount, currency or endpoint, or its first request is still running.
rate_limit_error429Too many requests. Wait for the number of seconds in Retry-After.
acquirer_error502, 504The acquirer could not be reached, or did not confirm the operation.
api_error500, 503Something failed on our side. Retry with the same Idempotency-Key.

Codes

CodeStatusMeaning
bad_request400The body is not valid JSON, or the request can't be parsed
idempotency_key_required400A money request has no Idempotency-Key
idempotency_key_invalid400The key is not 1–255 visible ASCII characters
missing_credentials, invalid_key, key_environment_mismatch, timestamp_out_of_range, invalid_signature, replayed_request401See Authentication
insufficient_scope, account_suspended403See Authentication
not_found404No such path, or no such object in this project and environment
method_not_allowed405The path takes other methods; see the Allow header
duplicate_reference409The reference is used by another payment; payment_id names it
payment_in_progress409Another capture, refund or void on this payment is running
idempotency_key_in_use409The first request with this key is still running
payload_too_large413The body is over 2 MB
validation_failed422A field is missing, of the wrong type, too long or out of range; see param
routing_unavailable422No payment channel takes this charge (currency, amount, environment). Nothing was created
invalid_payment_state422The payment can't take this operation now, such as capturing a declined payment
operation_declined422The acquirer declined the capture, refund or void
idempotency_key_mismatch422The key was used with a different amount or currency
idempotency_key_reused422The key was used on another endpoint
rate_limited429See Rate limits
internal_error500Our failure; retry with the same Idempotency-Key
acquirer_unavailable502The operation never reached the acquirer; nothing changed
acquirer_outcome_unknown502The acquirer didn't confirm the operation; check the payment before retrying
service_unavailable503The request took too long or we are overloaded; retry with the same key

A 405 carries an Allow header listing the methods the path accepts. A 429 carries Retry-After.

Health

GET /v1/health answers {"status": "ok"} without a key. It checks only that the API is up.