Get a List of Charges
See also API v3 methods that can be called for the current Reseller or for any of its downstream Resellers by the specified Reseller ID (see Reseller Charges).
The Get List of Charges API v1 method returns the list of Charges for current Reseller.
You can view the list of Charges page by page. To request a page with the list of Charges, provide the following arguments:
- the page number (page).
- the number of items per page (per_page).
The list of Charges can be sorted by any field. To sort the list of Charges, provide the following arguments:
- the field name that is used for sorting (sorting[field]);
- the sort direction (sorting[reversed]):
- true — the list will be sorted in descending direction.
- false — the list will be sorted in ascending direction (by default).
The list of Charges can be filtered by:
- creation date (filters[created_at]).
- update date (filters[updated_at]).
- subscription identifier (filters[subscription_id]).
status (filters[status]).
The
{base_url}/api/vendor/v1/charges
method is deprecated. Use the following instead:
GET {base_url}/api/reseller/v1/charges.json?api_token={api_token}
Arguments
Name | Parameter Type | Data type | Required/Optional | Description |
---|---|---|---|---|
api_token | query | string | Required | API token of the Manager that performs the operation (see Viewing and updating manager's information). This token is used for determination of the current Reseller and authentication in the API service |
page | query | integer | Optional | Set the page number |
per_page | query | integer | Optional | Setting a number of items in the page |
sorting[field] | query | string | Optional | Sorting the list by a specified field |
sorting[reversed] | query | bool | Optional | Setting the sorting mode:
|
filters[created_at] | query | string | Optional | Filtering the list by a creation date |
filters[updated_at] | query | string | Optional | Filtering the list by an update date |
filters[subscription_id] | query | integer | Optional | Filtering the list by Subscription ID |
filters[status] | query | string | Optional | Filtering the list by a status |
Response model
Name | Data type | Description | |||
---|---|---|---|---|---|
id | integer | Charge ID | |||
subscription_id | integer | Subscription ID | |||
subscription_resource_id | integer | Resource ID in the Subscription | |||
subscription_resource_name | string | Resource name in the Subscription | |||
plan_resource_id | integer | Resource ID in the Plan of the selected Reseller | |||
resource_id | integer | Resource ID in the Application Template | |||
quantity | integer | Amount of ordered Resource or Service units | |||
operate_from | date | Start date of the period for which the Charge has been paid | |||
operate_to | date | End date of the period for which the Charge has been paid | |||
duration | float | Charge period duration in months. For example, 1 day equals to 0.033, 2 years equal to 24 | |||
description | string | Charge description | |||
unit_price | float | Service or Resource unit price for the selected Reseller | |||
amount | float | Charge total amount | |||
status | string | Charge status (see Charges attributes for the list of statuses) | |||
type | string | Charge internal type:
| |||
order_id | integer | ID of the corresponding Order | |||
close_date | date | Date when Charge will be closed | |||
original_amount | string | Charge total amount in the Plan currency | |||
original_amount_currency | string | Currency code of the Plan | |||
currency_rate | string | Exchange rate used for generating the Charge | |||
currency_unit | integer | Currency units used for generating the Charge | |||
created_at | date | Charge creation date | |||
updated_at | date | Charge update date |
Request example
GET https://test.activeplatform.com/api/reseller/v1/charges.json?api_token=Y5fwetest3gJXZH5uHCw&page=10&per_page=2&sorting[field]=amount&sorting[reversed]=true
Response example
[
{
"id": 75632,
"subscription_id": 3005821,
"subscription_resource_id": 31417,
"subscription_resource_name": "Ресурс4",
"plan_resource_id": 5833,
"resource_id": 272,
"quantity": 1,
"operate_from": "2020-11-01",
"operate_to": "2020-11-14",
"duration": 0.467,
"description": "Upgrade resource (recurring fee) \"Ресурс4\" for Subscription #3005821 \"Clean Reservation\"",
"unit_price": "10000000.0",
"amount": "2335000.0",
"status": "new",
"type": "Charge::Recurring",
"order_id": 8224,
"close_date": "2020-11-14",
"original_amount": "2335000.0",
"original_amount_currency": "BYN",
"currency_rate": "1.0",
"currency_unit": 1,
"created_at": "2019-11-15T12:22:01.318042+0300",
"updated_at": "2019-11-15T12:22:01.318042+0300"
},
{
"id": 17296,
"subscription_id": 3002088,
"subscription_resource_id": 10990,
"subscription_resource_name": "Max Storage Size (GB)",
"plan_resource_id": 2051,
"resource_id": 1016,
"quantity": 10011,
"operate_from": "2017-09-01",
"operate_to": "2017-09-22",
"duration": 0.733,
"description": "Upgrade resource (recurring fee) \"Max Storage Size (GB)\" for Subscription #3002088 \"OnlyOffice\"",
"unit_price": "100.0",
"amount": "733806.3",
"status": "closed",
"type": "Charge::Recurring",
"order_id": 1773,
"close_date": "2017-09-22",
"original_amount": "733806.3",
"original_amount_currency": "BYN",
"currency_rate": "1.0",
"currency_unit": 1,
"created_at": "2017-08-24T16:17:29.707136+0300",
"updated_at": "2017-10-19T01:03:44.803022+0300"
}
]