Search for Payment
The Search Payments API offers a means of locating an existing payment by specifying one or more possible properties. A specific Payment ID does not have to be known to perform the search, as the response will return all results that fit the criteria. However, if a Payment ID is not provided then an Order ID is required instead, so one of those values must be known to get a list of payments.
The .json address above can be used to access the schema within Postman. An example use of the Payment API follows below, or view the schema or the sample Postman Collection.
The request itself is built within the URL by adding a “/?” to the call followed by specific parameters joined by the “&” symbol. For instance, searching for the payment for a particular order and retailer would use the following format:
- https://integration.shopatron.com/api/v2/payment/?orderID=[Order ID]&retailerID=[Retailer ID]
In the case of performing a search with multiple terms of the same parameter, such as retrieving multiple order IDs at once, use a comma-separated list as shown below.
- https://integration.shopatron.com/api/v2/payment/?orderID=[Order ID One],[Order ID Two],[Order ID Three]
GET calls that support pagination for numerous results, such as when searching, also accept a perPage parameter that defines how many results can be returned on each page. The default is 10 and the maximum is 100. Switch between pages of results by appending the page parameter to the call. For example:
- https://integration.shopatron.com/api/v2/payment/?orderID=[Order ID]&perPage=2&page=2
This example case creates a call that will search for the payment used for a specific order. The request will specify:
- Payment for Order #1000000
This guide will demonstrate how to put together each section of the request to find the appropriate payments.
A variety of possible properties can be used to locate an existing payment. The API call always requires at least one of the following to reference as a search term:
|orderID||integer||A unique identifier for the order. The minimum value is “1”.|
|paymentID||integer||A unique identifier for the payment. The minimum value is “0”.|
|page||integer|| The page number to begin listing the results from. The default and minimum value is “1”. While this parameter is technically required, this default means that it does not have to be provided in the request unless a different page is specifically desired. Also, note that the page cannot be the sole parameter in the search query – if provided, there must be at least one of the other parameters in this table.|
The API can also search for any of these additional elements:
|manufacturerID||string||A single or list of manufacturerIDs. They must be positive integers.|
|retailerID||string||A single or list of retailerIDs. They must be positive integers.|
|perPage||integer||The (max) number of items to return per results page. The minimum value is “1” and the maximum value is “100”. The default is “10”.|
|sortBy||string||The field(s) to sort results by, use a minus (-) in front of field name for descending, a plus (+) for ascending. The minimum length is 1.|
The Full Request
Using the URL format as outlined above, the entire call is fairly simple to put together. This sample will search for payments matching the example’s parameters. Any amount of additional parameters could be appended if desired.
The Full Response
The API returns the following response. The object returned is a Collection, which contains all of the payment results that fit the provided information. The response details all of the information associated with Order 1000000. It follows the same organizational structure as the standard Get Payment Information response.
In this case, the search returned a single result.