[POST] Modify Subscription Expiration Date (AR/PMR)
Request Description
POST /v1/subscription/modify_expiration_date
The request allows you to modify current expiration dates of subscriptions (AR/PMR).
NOTE: The request affects only one subscription of one individual customer. The product expiration date remains unchanged.
After applying the update to a subscription, the system automatically recalculates the remaining related upcoming event dates of the subscription (renewal reminder date / child order creation date, renewal payment date, etc.).
More details on:
- How to calculate core dates for auto-renewable subscriptions (AR) and recalculate when changing dates.
- How to calculate core dates for pre-filled manual renewals (PMR). The rules for calculating the date change are the same as for AR subscriptions. However, the calculation timescales related to the subscription expiration date are different.
Please contact our support team if you need help in changing the dates.
You can change the date if:
- The status of a subscription is active. Otherwise, if a renewal order has been created and is pending payment (subscription status is not_paid), or the subscription is cancelled (subscription status is cancelled), you cannot update its current expiration date. You can find out current statuses of subscriptions through the request used for getting subscription data.
- If you want to shorten the subscription expiration date, the new subscription expiration date must comply with some requirements. They are necessary to provide enough time for creation of a renewal order after the system recalculates the rest of the dates.
If you want to change a date to test how a subscription works, you can contact our support team to instantly initiate creation of a renewal order and its payment.
Connection Data
- Endpoint URL:
- Production environment: https://api.ecommerce.noventiq.com/v1/subscription/modify_expiration_date
- Test environment: https://api.ecommerce.noventiq.com.demoslweb.com/v1/subscription/modify_expiration_date
- Request Method: POST
- Format: JSON
- Authorization: token-based
- Format:
Bearer [token]
- Where [token] is substituted by the token value obtained through the authentication API.
Format: NN_MM, where NN is an identifier of the order that initiates subscriptions (parent order).
You can get it from:
- Webhook (subscription.id)
- Orders API request response
- Format: YYYY-MM-DDThh:mm:ss±hh:mm.
- If you want to shorten the validity period for a subscription, its new expiration date must comply with the following requirement: the calculated renewal reminder date must fall on the day that follows the request completion day, at least. Otherwise, no renewal order can be created.
More details on:
- Product validity period (product term) < 6 months – in this case, the expiration date value must be 5 days (or more) greater than the request send date value.
E.g., if the request is sent on January 1, then the expiration date must be January 6 or later. - Product validity period (product term) ≥ 6 months - in this case, the expiration date value must be 26 days (or more) greater than the request send date value.
E.g., if the request is sent on January 1, then the expiration date must be January 27 or later.
Request Example
{
"id": "111111_22222",
"expiration_date": "2022-08-13T09:16:35+03:00"
}
Response Description
In response to the request, you receive the server response code corresponding to the processing result. Depending on the code, the response body may contain additional parameters.
Successful Response
If processing is successful, the following will return in response server response code: HTTP/1.1 200 ОК.
Error Response
If an error occurs while processing the request, you receive a server response code corresponding to the result of processing.
Depending on the code, the response body may contain additional parameters.
HTTP Server Response Error Code
HTTP code | Description |
HTTP/1.1 400 Bad Request | The request is not valid (error in parameters; necessary data is not transferred, etc.). An additional error code (one or more) will be transferred in the response bodу. |
HTTP/1.1 401 Unauthorized | Unsuccessful authorization. An additional error code (one or more) will be transferred in the response bodу. |
HTTP/1.1 404 Not found | Invalid request URL or no subscription having the identifier transferred is found. If no subscription is found, an additional additional error code will return in the response body. |
HTTP/1.1 500 Request Error | Internal Server Error. Please try again later or contact support. |
Additional Error Codes for HTTP 400
Error | Message | Description |
If at least one error from the list below is found, then it returns in response to a request, other errors are not validated. | ||
110 | JSON is not valid. | The request cannot be processed. Request field structure is not valid. Check the fields in the request body against the JSON format. |
111 | Invalid data format (Content-type). | The request cannot be processed. Invalid request header. Content-type must be equal to application/json. |
7000 | No access to subscription management. Please contact technical support. | During processing, we could not identify your account setting unambiguously. Please contact support team. |
If at least one error from the list below is found, then request validation is not interrupted. Several errors may return in response. | ||
7010 | Invalid field value: [parametr name] | The request is not valid, e.g., the required parameter is not filled out, the parameter name is incorrect, the parameter value does not match with the data type provided, or the value format is incorrect. Moreover, the error will return if null is transferred in the parameter, and this value option is not set as valid in the parameter description. |
7110 | Impossible to change the subscription expiration date. The subscription status is not_paid (payment pending). | The system cannot update the subscription expiration date. The reason is that a renewal order has already been created. The subscription status is not_paid. |
7120 | Impossible to change the subscription expiration date. The subscription status is cancelled (cancelled). | The system cannot update the subscription expiration date. The reason is that the subscription has been cancelled. The subscription status is cancelled. |
7130 | Impossible to change the subscription expiration date. No renewal order can be created for a new subscription expiration date. | The system cannot update the subscription expiration date. The transferred data (expiration_date) does not meet the requirements. |
7900 | Failed to execute the action with the subscription. Please contact Technical Support. |
The system failed to execute the action with the subscription due to technical issues on our end. Please try again later or contact our support team. |
Additional Error Codes for HTTP 401
The errors are the same for all the APIs that use token authorization.
Additional Error Codes for HTTP 404
Error | Message | Description |
If at least one error from the list below is found, then it returns in response to a request, other errors are not validated. | ||
7400 | Subscription not found. | No subscription with the identifier transferred is found, or you do not have the rights to get the data. |
Example of Error Response
{
"errors": [{
"error": 7110,
"message": "Impossible to change the subscription expiration date. The subscription status is not_paid (payment pending)."
}, {
"error": 7130,
"message": "Impossible to change the subscription expiration date. No renewal order can be created for a new subscription expiration date."
}
]
}