Create a Renewal Order

The Create a 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).

Access to the current Reseller and downstream Resellers is determined by the Manager's token in the API request.

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

Arguments

Name

Parameter Type

Data type

Required/Optional

Description

X-Api-TokenheaderstringRequiredAPI token of the Manager that performs the operation (see Viewing and updating manager's information)
Content-TypeheaderstringRequiredIndicates the media type (text/html or text/JSON) of the request that is sent to the server by the client (browser)
AcceptheaderstringRequired

Information about data types that the client (browser) supports

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_idformintegerRequired ID of the Subscription to renew


plan_period_idformintegerRequiredID of the Period to renew


resourcesformobjectRequiredList of Resources in the Order



dataformarrayRequiredInformation about a Resource




plan_resource_idformintegerRequiredID of the Plan Resource




quantityformintegerRequiredTarget 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 the Reseller's Order Info by ID).

Errors

StatusError textComment
403This action is forbiddenCheck the list of available operations for the Subscription (see Get the Reseller's Subscription information by ID)
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 the Reseller's Plan information by ID)
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 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

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": "Subscription",
                    "target_type": "Subscription",
                    "type": "ProvisioningItem::Renew",
                    "status": "waiting_for_payment",
                    "description": "Clean CSPmonthly",
                    "quantity": "2023-03-06"
                },
                {
                    "id": 20159,
                    "target_id": "SubscriptionResource",
                    "target_type": "SubscriptionResource",
                    "type": "ProvisioningItem::Upgrade",
                    "status": "waiting_for_payment",
                    "description": "HDD",
                    "quantity": 1
                }
            ]
        },
        "relationships": {
            "charges": {
                "data": [
                    {
                        "id": "311809",
                        "type": "charges"
                    }
                ]
            }
        }
    }
}