Skip to main content

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.

Request example
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:

Successful response
{
"message": "OK",
"code": 200,
"current_time": "2021-04-15T07:12:36+0200",
"response_field": "example response"
}

An error response will have a similar structure:

Error response
{
"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:

CodeMessageExplanation
200OKEverything worked as expected
400Bad RequestThe request was unacceptable, often due to missing a required parameter
401UnauthorizedNo valid API key provided
402FailedThe requested resource doesn't exist
403UnauthenticatedApi key or signature are incorrect or they are not being sent as they should
404Not FoundThe parameters were valid but the request failed
409ConflictThe request conflicts with another request
429Too Many RequestsToo many requests hit the API too quickly
500Server ErrorsSomething went wrong on services end
502Server ErrorsSomething went wrong on services end
503Server ErrorsSomething went wrong on services end
504Server ErrorsSomething went wrong on services end