Payrix API Syntax & Structure
The following content outlines the framework for building an API request. This includes specifying servers, providing values for placeholders, and understanding the overall structure for effective communication with the Payrix API.
Payrix Sandbox Server
https://test-api.payrix.com/
Payrix Production Server
https://api.payrix.com/
To simplify, all following references to the base URL will use {server}
as a placeholder variable for Payrix Sandbox or Production server subdomains.
Note: The base URL’s subdomain (api), primary domain (payrix), and top level domain (.com) will change from Facilitator to Facilitator.
HTTP Methods
Available Methods | Description |
---|---|
| Retrieve resources for an endpoint all at once or by ID. |
| Update resources for an endpoint all at once or by ID. |
| Add a new resource to an endpoint. |
| Delete a specific resource from an endpoint. |
Headers
Required Headers | Required Value(s) |
|
|
|
|
Authentication
Required Headers | Required Value | Description |
|
| This can be found on the Portal Settings page. |
|
| User your login ID that begins with |
Endpoints
All Payrix server endpoints follow directly after the base URL and all endpoint titles are always pluralized (merchants, entities, etc.).
https://{server}.payrix.com/{endpoint}
Example: https://test-api.payrix.com/entities
Resource IDs
You can add /{id}
after an endpoint, replacing the placeholder with that unique resource ID, to specify a certain resource when making the API request.
Example: https://test-api.payrix.com/entities/p1_ent_12a3bcd45e67f89gh012345
Most API endpoint resources on the server will generate or be assigned a specific identifier (ID) after being created.
API Endpoint Request Example
In the below example, we’re retrieving information for the specific entity who’s ID we’ve provided:
Server URL & Required Headers |
API Query Structure
After structuring your base URL and endpoint, optionally adding a resource ID, you can also add further queries to the request.
Basic Single Query Structure
Multi-Query Structure
Query | Description | Examples |
---|---|---|
| Represents the operation or calculation to be performed. |
|
| Represents the attribute or field where the operation will be performed. |
|
| Represents the specific value used in the operation or search. This could be IDs, statuses, dates, numbers, strings, or other specific data. |
|
| Represents the name of the related server resource you want to expand or include, corresponding to a field, endpoint, or entity. |
|
Resource Nesting
Parent Resource
Represents the main or higher-level resource.
Typically contains information or parameters that reference other related resources.
When expanding a parent resource, you must specify the field where the related resource is referenced.
Child Resource
Represents the related resource that is connected to the parent resource.
Typically contains information related to the parent resource.
When expanding a child resource, you must use the name of the resource itself.
Expand
By default, when a resource points to another resource, the ID of the parent resource will be included in the child resource. To return the full object you can use expand.
You can also use expand to return resources that point to the resource being queried:
When expanding a resource, you must specify the object field name of parent resources.
If there are no child resources, nothing will be expanded.
You can further expand an already-expanded resource
Page (Paginate)
You can navigate multiple pages using pagination.
By default, the API returns the first 30 records queried (page). To find more records, you will have to query additional pages:
Valid Operators | Description | Notes |
---|---|---|
| The number for the page of records returned.
|
|
| The maximum number of records returned per page | Maximum is |
You can add pagination to expanded child resources by specifying the resource path.
Search
You can compare key values against pre-defined criteria to return resources based on the operator.
Valid Operators | Query Structure | Description | Notes |
---|---|---|---|
|
| Checks for truthy matches |
|
|
| Checks for exact matches |
|
|
| Checks for IDs, dates, numbers, and number strings that are greater than the value. |
|
|
| Checks for IDs, dates, numbers, and number strings that are less than the value. |
|
|
| Checks for truthy matches for multiple values. |
|
|
| Checks for partial string matches |
|
|
| Checks for partial string matches |
|
| | Checks for different matches. |
|
|
| Checks for negative matches of multiple values. |
|
You can filter the results of the request by adding a Search header and setting the value to the search
The default search query returns all searches using an
and
logic. Useor
as an operator to perform anor
logic search.To search through child or parent resources, add them to the resource name path.
Advanced Search
You can perform a more advanced search using additional query conditions within outer containers[]
, as shown below:
Sort
You can sort returned resource records by newest (descending) or oldest (ascending) order, with descending being the default.
Valid Operators | Description |
---|---|
| Return the newest value of the |
| Returns the oldest value of the |
You can further modify the sorted response by adding search to the sort request to the value of the search header.
Totals
You can return totals of the API call by adding a Totals header
Totals will include the totals for the request and not just what is returned on the page
Valid Operators | Description | Note |
---|---|---|
| Returns the sum of the values of the | Can only be run on IDs, dates, numbers, and number strings
|
| Returns the count of the non-zero values of the |
|
| Returns the minimum value of the values of the | Can only be run on IDs, dates, numbers, and number strings
|
| Returns the maximum value of the values of the | Can only be run on IDs, dates, numbers, and number strings
|
| Flag transaction to skip the model items retrieval data | Use it along with other totals operators when only the totals operation result is required. Skips the SQL query that retrieves |
Totals will be returned under
response.details.totals.{operator}.{key}