HTTP codes and error handling

Prev Next

When you send a request to a PagoNxt Payments APIs, you receive an HTTP code as part of the response. This response code lets you know whether your request has been successful or has failed. This document explains the different HTTP response codes that PagoNxt Payments sends, and how you can react to error situations.

Sucessful response codes

PagoNxt Payments uses the 200, 201, 202, and 204 response codes to indicate a successful request. The following table describes what these codes mean when received in response to a POST, GET, PUT, DELETE, or PATCH request.

HTTP Code

Description

Cause

200

OK

POST: Successful, but the operation is idempotent, and the same request was submitted successfully previously
GET: Requested details were successfully retrieved
PUT: Update was successful
PATCH: Update was successful

201

Created

POST: New creation was successful

202

Accepted

POST: Successful, but processing has not yet been completed

204

No content

POST: Successful, but there is no response content to be displayed
GET: Request was successful but there is no retrieved data to be displayed
DELETE: Deletion was successful
PATCH: Update was successful

Client error response codes

PagoNxt Payments uses the 4XX response codes to indicate that there's a client-side error. The following table describes what these codes mean when received in response to a POST, GET, PUT, DELETE, or PATCH request.

HTTP Code

Description

Cause

400

Bad request

PagoNxt could not understand the request message. Check that you are not missing any parameters in your request header and that your request body is valid.

401

Unauthorized

There is an authentication error. Check that your access token and any JSON Web Token (JWT) Bearer tokens are valid.

403

Forbidden

You are not authorized to access the requested API.

404

Not found

The data you are trying to retrieve does not exist. Check that any path parameters are correct and make sure that you are sending the request to the correct API endpoint.

405

Method not allowed

Your request method is not supported by the API endpoint; for example, a GET request was sent to a POST API endpoint. Check your request method.

406

Not acceptable

Request content is not acceptable. Check the request content.

409

Conflict

Request could not be processed because it conflicts with the current state of the API. Check your request.

413

Payload too large

Request is larger than the API can process. Check the request size.

414

URI too long

URI is longer than the maximum size allowed by the server. Check the URI length.

415

Unsupported media type

The request has an unsupported format in the request header or body. Check that your request header and body are in the correct format.

422

Unprocessable entity

Request was well-formed but could not be followed due to semantic errors. Check the request for semantic errors.

429

Too many request

You have sent too many requests within a set amount of time. Wait before sending your request again.

Server error response codes

PagoNxt uses the 5XX range response codes to indicate that there was a server-side error. The following table describes what these codes mean when received in response to a POST, GET, PUT, DELETE, or PATCH request.

HTTP Code

Description

Cause

500

Internal server error

There was an error when processing the request.

503

Service unavailable

There was an error when processing the request, this may be due to the server being down for maintenance or temporarily offline.

504

Gateway timeout

We haven't sent a response in a timely manner.