Close charges

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 Manual closing of the subscription charges).
  • 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.

An API token of a manager is required for authorization. To get an API token via the Operator Control Panel, see Viewing and updating manager's information

The manager's API token specified in an API request determines:

  • The role and access level of the manager, which determine the availability of a method.
  • The current reseller and downstream resellers accessible within a method.

PATCH {base_url}/api/v3/reseller/subscriptions/{subscription_id}/close_charges

Arguments

Name

Parameter type

Data type

Required/ 
Optional

Description

X-Api-TokenheaderstringRequiredAPI token of a manager that performs the operation (see Viewing and updating manager's information)
Content-TypeheaderstringRequiredMedia type of the request. Specify the following: application/vnd.api+json
AcceptheaderstringRequired

Supported media types of the answer. Specify the following: application/vnd.api+json

base_urlpathstringRequiredActivePlatform URL

subscription_id

path

integer

Required

ID of a subscription, charges for which should be closed

Response model

NameTupeDescription
dataobjectResponse data

idstringSubscription ID

typestringResponse model type

attributesobjectSubscription information


created_atstringDate and time of the subscription creation


updated_atstringDate and time when the subscription was updated


auto_renewal

boolean

Subscription auto-renew status:

  • true — auto-renew is on.
  • false — auto-renew is off.


billing_from

stringSubscription paid period start date


expiration_date

stringSubscription expiration date


name

stringSubscription name


renew_point_days

number

Period in days before the subscription expiration, when the manual subscription renewal becomes available via the Customer Control Panel



start_date

stringSubscription activation date


status

stringSubscription status (see Viewing the list of subscriptions for the list of statuses)


payment_model

string

Subscription payment model:

  • prepay
  • postpay


payment_model_parameters

stringPayment model parameters



credit_limit

numberThe value of the subscription debt, above which the postpaid subscription will be stopped. For postpaid subscriptions 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 subscriptions 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/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
            }
        }
    }
}