The HTTP status code, included in the header of every response, indicates the status of the communication between your system and the API E-commerce.
Success responses (2xx)
| HTTP codes | Description | Example |
|---|---|---|
| 200 OK | Your request was received and processed successfully. | Returned for query (GET), capture (PUT), and void (PUT) operations. |
| 201 Created | Your request to create a resource was successful. | Returned when creating a payment transaction (POST /1/sales), for all payment methods. |
Examples of credit card transaction responses:
{
(...)
"Payment": {
(...)
"Status": 1,
"ReturnMessage": "Operation Successful",
"ReturnCode": "4",
}
}{
(...)
"Payment": {
(...)
"Status": 3,
"ReturnMessage": "Autorizacao negada",
"ReturnCode": "51",
}
}Client error responses (4xx)
These responses indicate a problem with your request. In most cases, you must correct the error before resubmitting the request.
| HTTP codes | Description | Example | Response body |
|---|---|---|---|
| 400 Bad Request | The request is malformed or contains invalid data. | JSON syntax error in the request payload; invalid PaymentId in a query operation. | Generally includes the Code and Message fields with details about the error. |
| 401 Unauthorized | Authentication error. The credentials (MerchantId and MerchantKey) are incorrect or were not provided. | Sending an incorrect MerchantId or MerchantKey in the request header. | Does not return a body. |
| 403 Forbidden | Access denied. | The source IP address of the request is not included in the list of IP addresses authorized on the Cielo website. | Does not return a body. |
| 404 Not Found | The requested resource was not found. | Incorrect endpoint; query for a PaymentId that does not exist or belongs to another merchant; query for a PaymentId older than three months. | Does not return a body. |
| 405 Method Not Allowed | The HTTP method (GET, POST, PUT) used is incorrect for the endpoint. | Using GET on the transaction creation endpoint (/1/sales), which expects a POST request. | Does not return a body. |
Example of an HTTP 400 (Bad Request) error:
HTTP 400 (Bad Request) errors typically include the Code and Message fields in the response body:
[
{
"Code": 132,
"Message": "MerchantKey is invalid"
}
]Code represents the error code, equivalent to ReturnCode, and Message represents the corresponding error message, equivalent to ReturnMessage.
See the values returned in
CodeandMessagein theReturnCodeandReturnMessagetable.
Server Error Responses (5xx)
These indicate an internal failure in the Cielo servers, the card brand, or the issuer; the unavailability of a payment method; or high latency. In these cases, it is recommended to wait and, if the error persists, contact support.
| HTTP code | Description |
|---|---|
| 500 Internal Server Error | An unexpected server error occurred. |
| 502 Bad Gateway | The server acting as a gateway received an invalid response from an upstream server. |
| 503 Service Unavailable | The server is not ready to handle the request (for example, due to overload or maintenance). |
Check the API status to verify service availability.