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:
-
An 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 the Operator Control Panel (see ).
-
An 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 the Operator Control Panel. The charges with the Waiting for refund status receive the Refunded status.
-
An order for the subscription plan switching stays in the Waiting for payment status. After the order is completed, the following occurs:Charges in 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 the Operator Control Panel.
PATCH {base_url}/api/v3/reseller/subscriptions/{subscription_id}/close_charges
Arguments
Response model
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/reseller/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
}
}
}
}