Auto-renewal
You can use these API endpoints to manage the auto-renewal setting for a subscription.
⚠️
Auto-renewal cannot be modified for free plans.
Cancel auto-renewal
This endpoint cancels the auto-renewal for the subscription. When auto-renewal is cancelled, the subscription will not be automatically renewed at the end of the current term and the payment method will be removed.
Request & Response
DELETE https://proxy.webshare.io/api/v2/subscription/renewal/cancel_auto_renewal.py
import requests
response = requests.delete(
"https://proxy.webshare.io/api/v2/subscription/renewal/",
headers={"Authorization": "Token APIKEY"}
)
response.json()The commands above return a subscription object with renewals_enabled set to false:
response.json
{
"id": 1,
"plan": 2,
"payment_method": null,
"free_credits": 13.37,
"term": "monthly",
"start_date": "2022-06-14T11:19:14.489458-07:00",
"end_date": "2022-07-14T11:19:14.489461-07:00",
"renewals_paid": 0,
"renewals_enabled": false,
"failed_payment_times": 0,
"account_discount_percentage": 0,
"promotion_available_first_time_renewal_25_off": false,
"customizable": true,
"paused": false,
"reactivation_date": null,
"reactivation_period_left": null,
"promo_type": null,
"promo_value": null,
"throttled": false,
"created_at": "2022-06-14T11:58:10.246406-07:00",
"updated_at": "2022-06-14T11:58:10.246406-07:00"
}Enable auto-renewal
This endpoint enables the auto-renewal for the subscription. A payment method must already be associated with the subscription before auto-renewal can be enabled.
Request & Response
PUT https://proxy.webshare.io/api/v2/subscription/renewal/enable_auto_renewal.py
import requests
response = requests.put(
"https://proxy.webshare.io/api/v2/subscription/renewal/",
headers={"Authorization": "Token APIKEY"}
)
response.json()The commands above return a subscription object with renewals_enabled set to true:
response.json
{
"id": 1,
"plan": 2,
"payment_method": 1,
"free_credits": 13.37,
"term": "monthly",
"start_date": "2022-06-14T11:19:14.489458-07:00",
"end_date": "2022-07-14T11:19:14.489461-07:00",
"renewals_paid": 0,
"renewals_enabled": true,
"failed_payment_times": 0,
"account_discount_percentage": 0,
"promotion_available_first_time_renewal_25_off": false,
"customizable": true,
"paused": false,
"reactivation_date": null,
"reactivation_period_left": null,
"promo_type": null,
"promo_value": null,
"throttled": false,
"created_at": "2022-06-14T11:58:10.246406-07:00",
"updated_at": "2022-06-14T11:58:10.246406-07:00"
}