API Responses

PayPal API calls return HTTP status codes. Some API calls also return JSON response bodies that include information about the resource.

All responses from FlexShopper share keys:

Key

Description

data

The full data from a successful request

error.statusCode

HTTP status code. Returned in Response to avoid errors if HTTP codes are intercepted (from a load balancer or firewall, for example).

error.code

Error identifier; only present if the request was an error.

error.message

Full error message; only present if the request was an error.

HTTP status codes

Each REST API request returns a success or error HTTP status code.

Success

All successful request response contains a data object with the full data response.

Response Example
{
  "data": {
    "userId": "1234-asdf-4321-fdsa",
    "decision": {
      "approved": true,
      "spendingLimit": 1300,
    }
  }
}

In the responses, FlexShopper returns these HTTP status codes for successful requests:

Status code

Description

200 OK

The request succeeded

Error

In the responses for failed requests, FlexShopper returns HTTP 4XX or 5XX status codes.

For all errors FlexShopper returns an error response body that includes additional error details in this format.

Error Example
{
  "error": {
    "statusCode": 409,
    "code": "UserAlreadyExists",
    "message": "The user could not be created, the user already exists"
    "data": {
      "email": "leonard@email.com"
    }
  }
}

In the responses, FlexShopper returns these HTTP status codes for failed requests:

Status code

Cause

400 Bad Request

The server could not understand the request. Indicates one of these conditions:

  • The data is not in the expected data format.

  • A required field is not available.

  • A simple data validation error occurred.

401 Unauthorized

The request requires authentication and the caller did not provide valid credentials.

404 Not Found

The server did not find anything that matches the request URI. Either the URI is incorrect or the resource is not available.

500 Internal Server Error

A system or application error occurred. Although the client appears to provide a correct request, something unexpected occurred on the server.

503 Service Unavailable

The server cannot handle the request for a service due to temporary maintenance.

In addition to common HTTP status codes that the REST APIs return, the API identify logic errors using a unique code click here to learn more

Last updated