Olympus PayDevelopers

Errors

Olympus Pay uses standard HTTP status codes. Error bodies are JSON.

{
  "error": "This API key does not have the payouts:create scope.",
  "code": "permission_denied",
  "request_id": "req_4f9c2b7e1a8d40c39b6e2f1a"
}
FieldMeaning
errorA message for a person. For invalid input it is an object: { "formErrors": [], "fieldErrors": { "amount": ["Number must be greater than or equal to 0.01"] } }. Do not parse it.
codeA stable identifier to branch on in code
request_idAlso sent as the X-Request-Id header. Give it to support.

Errors never contain internal detail, stack traces or database messages.

Codes#

StatuscodeMeaningWhat to do
400invalid_requestInvalid input, a business rule was not met (sandbox key on payouts, insufficient balance, refund larger than what remains)Fix the request. Do not retry unchanged.
401authentication_failedBad, missing, revoked or expired key, or IP not allowedCheck the key. See Authentication.
403permission_deniedMissing scope, business not verified, or bankDetails do not match the saved accountAdd the scope, finish verification, or fix the destination.
404not_foundNo such object for your businessCheck the id and the environment (sandbox versus live).
409conflictThe object changed underneath you, for example a concurrent refundRead the object again and decide.
413payload_too_largeBody too largeSend less.
429rate_limitedToo many requestsWait for Retry-After, then retry with backoff.
500internal_errorSomething went wrong on our sideRetry with backoff. Report the request_id if it persists.
501not_implementedNot available for that currency or path yetDo not retry.
502internal_errorThe payment provider failed or could not be reachedRetry with backoff, after checking whether the operation took effect.
503unavailableTemporarily unavailableRetry with backoff.

A 202 is not an error: the operation is waiting for a second person in your business to approve it.

Handling errors well#

  • Branch on code and the HTTP status, never on the text of error.
  • Log request_id with every failure.
  • For 5xx on anything that moves money, first check whether it worked (GET /payouts, GET /payments/{id}) or use an idempotency key, then retry.