Subscription

Subscription

⚠️

Important distinction between Subscription and Plan

Subscription stays with the user even after a user switches to a new Plan. Whereas, a new Plan object is created each time a customer re-customizes their Plan.

Each Webshare account has 1 subscription and 1 active plan associated with it. There may be multiple in-active plans.

Subscription object holds general information about the user subscription
e.g. start/end dates.

See the Plan API.

Subscription Object

AttributesTypeDescription
idint

Unique identifier of the subscription instance. This ID should not change for the user

planint

Unique identifier of the active plan instance. This ID will change whenever a user re-customizes their plan

payment_methodint

Unique identifier of the payment method

free_creditsfloat

Free credits available in for the account in USD

termstring

Used to determine the amount to charge in the next renewal. Can be monthly or yearly.

start_datestring

The start date of the current renewal term. The difference between end/start dates are always 30 days even in yearly subscriptions.

end_datestring

The end date of the current renewal term. The difference between end/start dates are always 30 days even in yearly subscriptions.

renewals_paidint

Number of 30 day increment renewals paid. yearly terms pay for 12 renewals at once while monthly terms pay for 1 renewal at a time.

failed_payment_timesint

Number of times an automated renewal payment failed.

account_discount_percentageint

Discount percentage for the account. 0 means no discount. 30 means all prices are 30% discounted.

promotion_available_first_time_renewal_25_offbool

Whether the 25% off for renewals is available.

created_atstring

The timestamp of when this instance was created.

updated_atstring

The timestamp when this instance was last updated.

In JSON format

{
  "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,
  "failed_payment_times": 0,
  "account_discount_percentage": 0,
  "promotion_available_first_time_renewal_25_off": false,
  "created_at": "2022-06-14T11:58:10.246406-07:00",
  "updated_at": "2022-06-14T11:58:10.246406-07:00"
}

Get Subscription

This endpoint returns the subscription object associated with the account. There is only 1 subscription associated with each account.

GET https://proxy.webshare.io/api/v2/subscription/

Requests & Response

get_subscription.py
import requests
 
response = requests.get(
    "https://proxy.webshare.io/api/v2/subscription/",
    headers={"Authorization": "Token APIKEY"}
)
 
response.json()

The commands above return JSON structured like this:

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,
  "failed_payment_times": 0,
  "account_discount_percentage": 0,
  "promotion_available_first_time_renewal_25_off": false,
  "created_at": "2022-06-14T11:58:10.246406-07:00",
  "updated_at": "2022-06-14T11:58:10.246406-07:00"
}