REST API
API Usage
The Paylands API is based on a REST service and uses standard HTTP response codes to indicate errors that occur when making API requests.
curl --include \
--request POST
--header "Content-Type: application/json" \
--header "Authorization: Basic c2tfdGVzdF9CUW9raWtKT3ZCaUkySGxXZ0g0b2xmUTI6"
--data-binary "{
"amount": 1000,
"operative": "AUTHORIZATION",
"signature": "c6f00988430dbc8e83a7bc7ab5256346",
"customer_ext_id": "user1024",
"description": "Subscripción mensual",
"url_post": "https://mysite.com/payment/result",
"url_ok": "https://mysite.com/payment/success",
"url_ko": "https://mysite.com/payment/error"
}" \
'https://api.paylands.com/v1/sandbox/payment'
At Paylands all our responses are served in JSON format, including responses containing error messages.
An example of a successful response is as follows:
{
"message": "OK",
"code": 200,
"current_time": "2021-04-15T07:12:36+0200",
"response_field": "example response"
}
An error response will have a similar structure:
{
"message": "Bad Request",
"code": 400,
"details": "Service not found: F46ER1Q8"
}
For the API to accept the requests you make, they must be properly authenticated. In the following section we explain how to authenticate the requests to our API.
You can check the available endpoints in the API reference
Such responses may not always have the same structure due to progressive changes that may include new fields within the API response. It is therefore recommended not to strictly validate the entire response.
API error codes
The codes that can be received from Paylands endpoints will be the following:
Code | Message | Explanation |
---|---|---|
200 | OK | Everything worked as expected |
400 | Bad Request | The request was unacceptable, often due to missing a required parameter |
401 | Unauthorized | No valid API key provided |
402 | Failed | The requested resource doesn't exist |
403 | Unauthenticated | Api key or signature are incorrect or they are not being sent as they should |
404 | Not Found | The parameters were valid but the request failed |
409 | Conflict | The request conflicts with another request |
429 | Too Many Requests | Too many requests hit the API too quickly |
500 | Server Errors | Something went wrong on services end |
502 | Server Errors | Something went wrong on services end |
503 | Server Errors | Something went wrong on services end |
504 | Server Errors | Something went wrong on services end |