Renew a Subscription
The Renew a Subscription method creates a new Order for subscription renewal and returns created Order's body.
POST /api/vendor/v1/subscriptions/:id/renew.json?api_token={api_token}&plan_period_id={plan_period_id}&promo_code={promo_code}
Arguments
Name | Parameter Type | Data type | Required/ Optional | Description |
---|---|---|---|---|
id | path | integer | Required | ID of the existing subscription. |
api_token | query | string | Required | API token of the manager who perform the operation (see API Token Authentication). |
plan_period_id | query | integer | Required | A plan period ID of the subscription (see Managing plans in the ActivePlatform. Operator Control Panel). |
promo_code | query | string | Optional | A promo code to get the discount. |
Response model
Name | Data type | Description |
---|---|---|
id | integer | An order ID. |
document_id | string | A number of the order (e.g. SO000329), which is configured in the platform settings (see System settings in the ActivePlatform. Operator Control Panel). |
status | string | One of the following statuses of the order:
|
account_id | integer | An account ID, which was used to pay for the order. |
type | string | One of the following types of order:
|
created_at | date | A date and time of the order's creation. |
updated_at | date | A date and time when the order was changed last time. |
expiration_date | date | A date, by which the order must be paid (the order status must be confirmed). The date is calculated using the grace period, which is set in the Plan Class (see Creating a service term in the ActivePlatform. Operator Control Panel). |
total | float | A total amount of the order. |
promo_code | string | A promo code that was used to get the discount (see Managing Promo Code discounts in the ActivePlatform. Operator Control Panel). |
payment_id | integer | A payment ID, which is linked to the order. |
items | array | A list of items in the order:
|
charges | array | A list of charges, which were created by the order:
|
Request example
POST http://billing.activeplatform.com:80/api/vendor/v1/subscriptions/2005882/renew?api_token=654321&plan_period_id=2001243
Response example
{
"id": 2010311,
"document_id": "RN002935",
"status": "waiting_for_payment",
"account_id": 2000532,
"type": "RenewalOrder",
"created_at": "2016-08-12T16:21:52.055+03:00",
"updated_at": "2016-08-12T16:21:52.950+03:00",
"expiration_date": "2016-08-12",
"total": 230,
"promo_code": null,
"payment_id": 2006907,
"items": [
{
"id": 16559,
"target_id": 2005882,
"target_type": "Subscription",
"type": "ProvisioningItem::Renew",
"status": "waiting_for_payment",
"description": "Fusion Manager"
}
],
"charges": [
{
"id": 754065,
"subscription_id": 2005882,
"subscription_resource_id": null,
"subscription_resource_name": null,
"plan_resource_id": null,
"resource_id": null,
"quantity": 1,
"operate_from": "2017-07-15",
"operate_to": "2017-07-30",
"duration": 0.484,
"description": "Renewal subscription (recurring fee) #2005882 \"Fusion Manager\"",
"unit_price": 20,
"amount": 9.68,
"status": "new",
"type": "Charge::Recurring",
"order_id": 2010311,
"close_date": "2017-07-30",
"created_at": "2016-08-12T16:21:52.823103+0300",
"updated_at": "2016-08-12T16:21:52.823103+0300"
}
]
}