Create renewal order

The Create renewal order method is used to create a renewal order for a subscription for the current reseller or any of its downstream resellers. The standard logic of the platform is used (see Manual renewing of a Subscription).

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.

POST {base_url}/api/v3/resellers/{reseller_id}/renewal_order

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
reseller_idpathintegerRequiredID of the current reseller or any of its downstream resellers (see Viewing and updating Reseller general information)
dataformobjectRequiredInformation about the attributes of the operation

attributesformobjectRequiredAttributes of the operation


subscription_idformintegerRequiredID of the subscription to renew


plan_period_idformintegerRequiredID of the period to renew


resourcesformobjectOptionalList of resources in the order. Required if at least one resource has non-zero included or additional amount (see Plan Resources)



dataformarrayOptionalInformation about resources in the order. Required for resources with non-zero included or additional amount




plan_resource_idformintegerOptionalID of the plan resource




quantityformintegerOptionalTarget amount of the plan resource


promo_codeformstringOptionalPromo-code for a discount

Response model

If no errors are encountered, the method returns data as the information about the created order (see the response model in Get order). Status: 201 Created.

Errors

StatusError textComment
403This action is forbiddenCheck the list of available operations for the subscription (see Get subscription)
422There are ordered invalid amount of resourcesThe total amount of a resource with the additional amount should fit the range defined in the plan (see Get plan)
The period id is not available for ordering in planThe plan period is not available for renewing due to one of the following reasons:
  • The plan period is not available in the target plan.
  • The plan period with the specified ID does not exist.
The resource id is not available for ordering in planThe resource is not available in the current plan
The resource id must be orderedIt is necessary to add the required resource in the order because, in the plan, the resource has the minimal amount greater than 0
The order cannot be completed: the order total has exceeded the credit limit for this subscriptionTo create the order, it is necessary to increase the credit limit of the account (see Viewing and updating an Account's details) or individual credit limit of the subscription (see Viewing and updating Subscription's details)
There are ordered invalid amount of resources, quantity must be N for plan resource idThe amount of the resource with the specified ID must be equal to the current amount of the resource in the subscription
Order for the selected account is not available due to restrictions imposed on the account or resellerThe validation service (see Managing the Validation Service) determined that restrictions are imposed on the reseller or account. Creating an order is not available for the product linked to the specified subscription (see Get subscription)
Order for the selected service is not available. service for checking the restrictions imposed on the account or reseller is not available. Please try to place order laterThe validation service (see Managing the Validation Service) failed to check the reseller and account. To create an order, try again later or contact the support team
The account or reseller does not have the INN attributeTo create an order, create and specify the INN attribute for the reseller or account (see Managing Attributes) and then try again

Request example

POST /api/v3/resellers/1/renewal_order
Host: test.activeplatform.com
Content-Type: application/vnd.api+json
X-Api-Token: vY5fwetestK3gJXZH5uHCw
Accept: application/vnd.api+json
{
    "data": {
        "attributes": {
            "subscription_id": 3007529,
            "plan_period_id" : 2808,
            "resources": {
                "data": [
                    {
                        "plan_resource_id": 4340,
                        "quantity": 5
                    }
                ]
            },
            "promo_code": ""
        }
    }
}

Response example

{
    "data": {
        "id": "11769",
        "type": "renewal_orders",
        "attributes": {
            "created_at": "2021-03-06T00:43:54.987+03:00",
            "updated_at": "2021-03-06T00:43:55.439+03:00",
            "document_id": "RN002623",
            "status": "waiting_for_provisioning",
            "account_id": 710,
            "type": "RenewalOrder",
            "closed_at": null,
            "expiration_date": "2023-03-06",
            "provisioning_date": "2022-03-06",
            "total": "14.52",
            "promo_code": null,
            "payment_id": null,
            "manager_id": 225,
            "requester_ip": null,
            "custom_price": false,
            "created_by": "#225 Adam Manager",
            "subscription_id": 3007529,
            "items": [
                {
                    "id": 20158,
                    "target_id": 3007529,
                    "target_type": "Subscription",
                    "type": "ProvisioningItem::Renew",
                    "status": "waiting_for_payment",
                    "description": "Clean CSPmonthly",
                    "quantity": "2023-03-06"
                },
                {
                    "id": 20159,
                    "target_id": 49964,
                    "target_type": "SubscriptionResource",
                    "type": "ProvisioningItem::Upgrade",
                    "status": "waiting_for_payment",
                    "description": "HDD",
                    "quantity": 1,
                    "resource_id": 152581
                }
            ]
        },
        "relationships": {
            "charges": {
                "data": [
                    {
                        "id": "311809",
                        "type": "charges"
                    }
                ]
            }
        }
    }
}