Close Charges for Subscriptions that were sold by a downline Reseller
The Close Charges method initiates closing Subscription Charges with the Blocked and Opened statuses and returns the request status.
If at the moment of the Charge closing via API, there is an Order in the Waiting for payment status related to the Subscription, then, depending on the Order type, the following occurs:
- Order for the Subscription Resources upgrade stays in the Waiting for payment status. After the Order is completed, the Charges are processed as in case of manual closing of Charges via Operator Control Panel (see Manual closing of the subscription charges).
- Order for the Subscription Resources upgrade and downgrade stays in the Waiting for payment status. After the Order is completed, the Charges for the Resources upgrading with the New status are processed as in case of manual closing of Charges via Operator Control Panel. The Charges with the Waiting for refund status receive the Refunded status.
- Order for the Subscription Plan switching stays in the Waiting for payment status. After the Order is completed, the following occurs:
- Charges with the New status receive the Refunded status.
- Charges for the unused period are not refunded, because they are already closed.
- When the customer creates an Order for the Subscription Resources upgrade and downgrade after that, all Charges, which are related to the switch Order and to the Resources upgrade and downgrade Order, are processed as in case of manual closing of Charges via Operator Control Panel.
PATCH {base_url}/api/v3/vendor/subscriptions/{subscription_id}/close_charges
Arguments
Name | Parameter type | Data type | Required/ | Description |
---|---|---|---|---|
subscription_id | path | integer | Required | ID of a Subscription, Charges for which should be closed |
X-Api-Token | header | string | Required | API token of a Manager (see Viewing and updating manager's information) |
Accept | header | string | Required | Information about data types that the client (browser) supports |
Content-Type | header | string | Required | Indicates the media type (text/html or text/JSON) of the request that is sent to the server by the client (browser) |
Response model
Name | Tupe | Description | |||
---|---|---|---|---|---|
data | object | Response data | |||
id | string | Subscription ID | |||
type | string | Response model type | |||
attributes | object | Subscription information | |||
created_at | string | Date and time of the Subscription creation | |||
updated_at | string | Date and time when the Subscription was updated | |||
auto_renewal | boolean | Subscription auto renew status:
| |||
billing_from | string | Subscription paid period start date | |||
expiration_date | string | Subscription expiration date | |||
name | string | Subscription name | |||
renew_point_days | number | Period in days before the Subscription expiration, when the manual Subscription renewal becomes available via Customer Control Panel | |||
start_date | string | Subscription activation date | |||
status | string | Subscription status (see Viewing the list of subscriptions for the list of statuses) | |||
payment_model | string | Subscription payment model:
| |||
payment_model_parameters | string | Payment model parameters | |||
credit_limit | number | The value of the Subscription debt, above which the postpaid Subscription will be stopped. For postpaid Subscription only (payment_model = postpay) | |||
current_debt | number | The Subscription debt that is calculated as the total amount of all blocked Charges for the Subscription for the current Billing period. For postpaid Subscription only (payment_model = postpay) |
Status codes:
- 200 — The request is processed successfully. Subscription Charges are closed.
- 401 — Unauthorized.
- 404 — the requested Subscription was not found.
- 422 — Unprocessable entity. Subscription Charges are not closed. In case of the 422 error, the Log contains detailed information.
Request example
PATCH /api/v3/vendor/subscriptions/3006017/close_charges
Host: test.activeplatform.com
Content-Type: application/vnd.api+json
X-Api-Token: vY5fwetest3gJXZH5uHCw
Accept: application/vnd.api+json
Response example
{
"data": {
"id": "3006017",
"type": "subscriptions",
"attributes": {
"created_at": "2020-07-27T05:01:39.591935+0300",
"updated_at": "2020-07-27T06:11:27.466827+0300",
"auto_renewal": false,
"billing_from": "2020-07-27",
"expiration_date": "2020-08-27",
"name": "auto provisioning with only one period",
"renew_point_days": 0,
"start_date": "2020-07-27",
"status": "active",
"payment_model": "postpay",
"payment_model_parameters": {
"credit_limit": 11000.0,
"current_debt": 0.0
}
}
}
}