Reference
Errors and limits
What each API error means, when it is safe to try again, and how many requests you can send.
Errors
{
"statusCode": 400,
"message": ["amount must not be less than 0.01"],
"error": "Bad Request"
}message can be text or a list, so your code must accept both. Don't make decisions based on its words, because they can change.
| Status | What it means | What to do |
|---|---|---|
400 | Something in the request is wrong, or a field is not known | Read the message and fix the request. Do not send it again unchanged |
401 | The key is missing, wrong, disconnected or for the other API version | Check the key |
403 | The key does not have permission | Connect again with the permission you need |
404 | It does not exist, or it belongs to another account or network | Check the address, ID and key |
409 | It conflicts with something else, such as stock that has sold out | Get the latest details, then let the person decide |
429 | Too many requests | Wait for the time in Retry-After |
5xx | Switro had a problem | See below before you try again |
When to try again
- Getting information: you can try again. Wait a little longer each time.
- Creating a link, invoice or store order: send the same details with the same
idempotency_key. - Creating an API v1 checkout: sending it again can create another checkout. If the answer was lost, do not send the customer to more than one.
- Anything else: check what was saved before you send it again.
Do not ask a customer to pay again straight away
If a payment's result is not clear, it may still succeed. Check the payment first.
Limits
| Limit | Default |
|---|---|
| All requests | 120 a minute, then a 60-second block |
400 and 404 answers | 20 a minute, then a block |
| Starting connections | 10 a minute |
| Checking connections | 30 a minute |
| Store images | 30 a minute, up to 5 MB each |
| A page of results | Up to 100 |
These limits can change, so always follow Retry-After. Save products for about a minute so you don't need to request them each time, but never save the result of a payment check this way. Limit how often each visitor can make your server call Switro.