Skip to content

Search API reference

Find an endpoint or a guide of the Sovgate API reference and jump straight to it.

Errors

How the API answers a request it can't carry out: the status, the error object and every code.

The API answers with a 2xx status when a request worked, 4xx when it can't be carried out as sent, and 5xx when something went wrong at Sovgate. An error answer has one shape:

An error
json
{  "error": {    "type": "invalid_request_error",    "code": "parameter_invalid",    "message": "A field of the request isn't valid.",    "param": "amount"  }}
FieldWhat it is
typeinvalid_request_error, card_error, idempotency_error or api_error.
codeA stable code for the refusal. Write your code against it, never against the message.
messageA fixed sentence, for a person.
paramThe field at fault, when there is one.
decline_codeFor a card decline: why the bank declined.

Statuses

StatusMeaning
200It worked.
400The request isn't valid, or the record's state doesn't allow it.
401No key, or an unknown, wrong or expired one.
402The card was declined, or couldn't be processed.
403The key isn't allowed to do this.
404No such record in this mode. A record of another business or mode reads the same.
409A conflict: the record changed, or a request like this one was made moments ago.
429Too many requests. Wait for Retry-After.
500Something went wrong at Sovgate. Retry with the same idempotency key.

Codes

CodeStatusWhen
parameter_invalid400A field isn't valid. param names it.
idempotency_key_missing400A write had no Idempotency-Key.
idempotency_key_reused400The key was used with another request.
invalid_state400The record's state doesn't allow this, such as refunding a held payment.
request_refused400The request was refused, such as a live session before your business is verified.
file_invalid400A file couldn't be read.
card_number_found400A field holds what looks like a card number. The value is never repeated.
no_consent, beyond_consent400A saved-card charge isn't covered by the customer's consent.
payer_presence_required400A charge needs the customer present.
card_declined402The card's bank declined it. See decline_code.
processing_error402The card couldn't be processed. Try again in a moment.
api_key_expired401The key has expired.
ip_not_allowed403The request came from an address the key doesn't allow.
secret_key_required403A publishable key can't make this request.
permission_missing403The key lacks the access this request needs.
approval_required403Your business needs a person to approve this. Finish it in the Dashboard.
resource_missing404No such record in this mode.
resource_changed409The record changed since you read it. Read it again.
possible_duplicate409The same charge or refund was made moments ago. Repeat with confirm_duplicate if it's meant.
rate_limit429Too many requests like this one.

Card declines

A declined payment is still recorded, with status failed. Its decline_code is generic_decline, insufficient_funds, lost_card, stolen_card, expired_card, incorrect_cvc or processing_error. For a lost or stolen card, or a payment blocked as fraud, tell your customer only that the card was declined.

What to retry

Retry a 5xx or a lost answer with the same idempotency key: the API won't do it twice. Don't retry a 4xx unchanged: fix the request first. Never retry a declined card again and again, as banks can block cards retried too often.