API Requests

To make a REST API request, you combine the HTTP GET, POST, PUT, PATCH, or DELETE method, the URL to the API service, the URI to a resource to query, submit data to, update, or delete, and one or more

The URL to the API service is either:

  • Sandbox: https://sandbox.smartfastpay.com

  • Live: https://api.smartfastpay.com

Optionally, you can include query parameters on GET calls to filter, limit the size of, and sort the data in the responses.

Most GET, POST, PUT, and PATCH calls require a JSON request body.

This sample request lists transactions:

curl -v --location --request GET 'https://sandbox.smartfastpay.com/transactions' \
        --header "Content-Type: application/json" \
        --header "Authorization: Bearer <Access-Token>"

Query parameters

For most REST GET calls, you can include one or more query parameters on the request URI to filter, limit the size of, and sort the data in an API response. For filter parameters, see the individual GET calls.

To limit, or page, and sort the data that is returned in some API responses, use these, or similar, query parameters:

Note: Not all pagination parameters are available for all APIs.

ParameterTypeDescription

limit

integer min: 1 | max: 40

The number of items to return in the response.

page

integer min: 1 | max: 9999999

The page number indicates which set of items will be returned in the response. So, the combination of page=1 and limit=20 returns the first 20 items. The combination of page=2 and limit=20 returns items 21 through 40.

sort

string Format: item,(asc|desc)

Sorts the items in the response by filter in ascending or descending order. Eg.: sort=id,desc (This combination returns a list in descending order based on id.)

start_time

string Internet date and time format

The start date and time for the range to show in the response, in Internet date and time format. Eg.: start_time=2021-09-05T11:00:00Z.

end_time

string Internet date and time format

The end date and time for the range to show in the response, in Internet date and time format. Eg.: end_time=2021-09-05T11:00:00Z.

customer_id

string min: 1 | max: 255

Sorts the items in the response by looking for the customer_id that was once provided by your system.

transaction_id

string

Sorts the items in the response by looking for the transaction_id that was once provided by your system. To get multiple transaction_id, send each transaction_id separating by comma (,). Eg.: 8fecdfcc-4e4d-11ee,8fece5ee-4e4d-11ee,d42953be-4e4d-11ee

For example, the Transaction API returns details for ten transactions starting with the second page sorted by descending id in the response:

curl -v --location --request GET 'https://sandbox.smartfastpay.com/transactions?limit=10&page=2&sort=id,desc' \
        --header "Content-Type: application/json" \
        --header "Authorization: Bearer < Access-Token >"

HTTP request headers

The commonly used HTTP request headers are:

Content-Type

The response format, which is required for operations with a response body. The syntax is:

Content-Type: application/format

Where format is json.

Authorization

Required to get an access token or make API calls:

  • Get an access token

    When you create a sandbox or live REST API app, SmartFastPay generates a set of OAuth 2.0 client ID and secret credentials for the sandbox or live environment. When you make a get an access token call, set the Authorization header to these credentials for the environment in which you're making the call.

    In exchange for these credentials, the SmartFastPay authorization server issues a bearer access token that you use for authorization when you make REST API requests.

    A bearer token enables you to complete actions on behalf and with the approval of the resource owner.

  • Make REST API calls

    Include the access token in the Authorization header with the Bearer authentication scheme:

    Authorization: Bearer <Access-Token>

Last updated