Get Transactions by Subscription ID
Use Recurring Billing to get the transactions of one subscription.
Use this guide to get the data of all transactions for one subscription and to add parameters that filter and restrict the result. See Get Transactions by Subscription ID in our API Reference for field definitions.
Prerequisites
-
See Create a Sandbox Account to sign up and log in to the Maast Manager portal.
-
Follow the steps in Get Your API Credentials to save a sandbox ID and API key.
-
See Authentication to format the credentials and generate your API token. (Alternatively, use the credentials as-is to test this endpoint with our 'Try It!' feature.)
-
Follow the steps in the Add a Subscription guide to create a subscription. Save the
subscription_id
value from the request response.
Implement
Write a GET request. For the request endpoint, append your subscription_id
value to the end of /platform/subscription/transactions/.
The resulting endpoint is /platform/subscription/transactions/subscription_id
, where the value replaces subscription_id
.
See the sample code below:
curl --request GET \
--url 'https://api-test.maast.com/platform/subscription/transactions/1189317?count=10&order_on=tran_time&order_by=desc&page=0' \
--header 'accept: application/json' \
--header 'authorization: Basic OjllZGVjMjFhMzFjMHh5ejc4OWUzMGEzNDE2YWJjMTIz'
The above code requests all transactions for the subscription, using default sorting and no filtering.
The following sections describe several query parameters that you can add to your request to sort and filter the response. To add these parameters, append them to the request endpoint URL, preceded by ?
and separated by &
.
Sort
Use the following parameters to sort the data in the response:
- order_on - Include this to sort results by a certain field. For example, to sort by transaction time, write
order_on=tran_time
. All available fields are listed in the response model of this request's API Reference. - order_by - Include this to sort the specified field by ascending order (
asc
) or descending order (desc
).
Filter
Use the following parameters to filter the response:
- filter - Include this to narrow results by requiring certain fields to meet specified values. You can combine multiple filters. Each filter contains three properties, packed together with commas:
- field name - All available fields are listed in the response model of this request's API Reference.
- filter conditional - Find supported filter conditionals in About Our APIs: Filters.
- the value on which to filter
- count - Include this to set the number of records in the result.
- page - Include this to choose a page to display when there are more results than the count parameter.
- merchant_id - If you are sending this request on behalf of another merchant, include their merchant ID here.
When placing strings in URLs, be sure to use your development language's URL encoding methods (e.g., for hexadecimal, use
%2C
in lieu of a comma).
Example Request
Once configured, the code for your request will resemble the following sample code:
curl --request GET \
--url 'https://api-test.maast.com/platform/subscription/transactions/1189317?count=10&order_on=tran_time&order_by=desc&page=0&filter=tran_date%2CBETWEEN_DATES%2C2016-01-09%2C2016-01-10&merchant_id=0' \
--header 'accept: application/json' \
--header 'authorization: Basic OjllZGVjMjFhMzFjMHh5ejc4OWUzMGEzNDE2YWJjMTIz'
Integrate
Once you have written and sent your GET request, you will receive a response like this from the Maast server:
{
"code": 0,
"message": "Success",
"totalPages": 1,
"totalRecords": 1,
"data": [
{
"merchant_id": 210000000289,
"tran_time": "2025-05-14T08:07:03-07:00",
"tran_status": "P",
"auth_code": "T29611",
"rcode": "000",
"rmsg": "Approved T29611",
"card_number": "411111xxxxxx1111",
"card_type": "VS",
"purchase_id": "JOHNDOE_SUBSCRIPTION_BILL",
"pg_id": "efgbe295c41611edb32402171867ecb2",
"cardholder_first_name": "JOHN",
"cardholder_last_name": "DOE",
"amt_tran": 20.05,
"tran_currency": "840",
"dispute_flag": false,
"amt_refunded": 0,
"batch_number": 25,
"customer_id": "JOHNDOE",
"subscription_id": 1189317,
"merch_ref_num": "",
"batch_id": 7571981,
"batch_date": "2025-05-14",
"settle_date": "2025-05-14",
"amt_funded": 20.05,
"funded_currency": "840"
}
]
}
Check the code
field in the request response: 0
confirms a successful transaction. If the value is something other than 0
, check Platform API Response Codes in Reference.
The data
field shows an array of transactions' data. The sample response above shows one transaction's data. See Get Transactions by Subscription ID in API Reference for response field definitions.
Test and Go Live
See our Test and Go Live guide to test your API integration and to start transacting with an active production account.
Updated about 1 year ago