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:
| Field | What it is |
|---|---|
type | invalid_request_error, card_error, idempotency_error or api_error. |
code | A stable code for the refusal. Write your code against it, never against the message. |
message | A fixed sentence, for a person. |
param | The field at fault, when there is one. |
decline_code | For a card decline: why the bank declined. |
Statuses
| Status | Meaning |
|---|---|
| 200 | It worked. |
| 400 | The request isn't valid, or the record's state doesn't allow it. |
| 401 | No key, or an unknown, wrong or expired one. |
| 402 | The card was declined, or couldn't be processed. |
| 403 | The key isn't allowed to do this. |
| 404 | No such record in this mode. A record of another business or mode reads the same. |
| 409 | A conflict: the record changed, or a request like this one was made moments ago. |
| 429 | Too many requests. Wait for Retry-After. |
| 500 | Something went wrong at Sovgate. Retry with the same idempotency key. |
Codes
| Code | Status | When |
|---|---|---|
parameter_invalid | 400 | A field isn't valid. param names it. |
idempotency_key_missing | 400 | A write had no Idempotency-Key. |
idempotency_key_reused | 400 | The key was used with another request. |
invalid_state | 400 | The record's state doesn't allow this, such as refunding a held payment. |
request_refused | 400 | The request was refused, such as a live session before your business is verified. |
file_invalid | 400 | A file couldn't be read. |
card_number_found | 400 | A field holds what looks like a card number. The value is never repeated. |
no_consent, beyond_consent | 400 | A saved-card charge isn't covered by the customer's consent. |
payer_presence_required | 400 | A charge needs the customer present. |
card_declined | 402 | The card's bank declined it. See decline_code. |
processing_error | 402 | The card couldn't be processed. Try again in a moment. |
api_key_expired | 401 | The key has expired. |
ip_not_allowed | 403 | The request came from an address the key doesn't allow. |
secret_key_required | 403 | A publishable key can't make this request. |
permission_missing | 403 | The key lacks the access this request needs. |
approval_required | 403 | Your business needs a person to approve this. Finish it in the Dashboard. |
resource_missing | 404 | No such record in this mode. |
resource_changed | 409 | The record changed since you read it. Read it again. |
possible_duplicate | 409 | The same charge or refund was made moments ago. Repeat with confirm_duplicate if it's meant. |
rate_limit | 429 | Too 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.