Change Subscription's Resources
The Change Subscription's Resources method creates a new Order to change Subscription's Resources and returns the ID and body of the created Order.
POST /api/vendor/v1/subscriptions/{id}/change.json?api_token={api_token}&resources[][id]={resourece_id}&resources[][quantity]={quantity}&promo_code={promo_code}
Arguments
Name | Parameter Type | Data type | Required/ Optional | Description |
---|---|---|---|---|
id | path | integer | Required | An ID of the existing subscription. |
api_token | query | string | Required | API token of the manager who perform the operation (see API Token Authentication). |
resources[][id] | query | integer | Required | An ID of the subscription's resource. |
resources[][quantity] | query | integer | Required | An amount of the additional resources. A negative value is used for the resource downgrading. |
promo_code | query | string | Optional | A promo code, which is used to get the discount. |
Response model
Name | Data type | Description |
---|---|---|
id | integer | An order ID. |
document_id | string | Order number. |
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 page (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, which was used to get the discount (see Managing promo codes 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/2005786/change?api_token=654321&resources[][id]=132341&resources[][quantity]=3
Response example
{
"id": 2010322,
"document_id": "CO000157",
"status": "waiting_for_payment",
"account_id": 2000532,
"type": "ChangeOrder",
"created_at": "2016-09-01T12:44:54.222+03:00",
"updated_at": "2016-09-01T12:44:54.538+03:00",
"expiration_date": "2016-09-01",
"total": 0.02,
"promo_code": null,
"payment_id": 2006917,
"items": [
{
"id": 16577,
"target_id": 132341,
"target_type": "SubscriptionResource",
"type": "ProvisioningItem::Upgrade",
"status": "waiting_for_payment",
"description": "Users"
}
],
"charges": [
{
"id": 754132,
"subscription_id": 2005786,
"subscription_resource_id": 132341,
"subscription_resource_name": "Users",
"plan_resource_id": 2000854,
"resource_id": 2002273,
"quantity": 3,
"operate_from": "2016-09-15",
"operate_to": "2016-09-26",
"duration": 0.367,
"description": "Upgrade resource (recurring fee) \"Users"\ for Subscription #2005786 \"Microsoft Exchange 2013\"",
"unit_price": 0.01,
"amount": 0.01,
"status": "new",
"type": "Charge::Recurring",
"order_id": 2010322,
"close_date": "2016-09-26",
"created_at": "2016-09-01T12:44:54.434384+0300",
"updated_at": "2016-09-01T12:44:54.434384+0300"
}
]
}