POST
/
api
/
subscriptions
/
add
/
curl --request POST \
  --url https://api.uselotus.io/api/subscriptions/add/ \
  --header 'Authorization: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '{
  "auto_renew": true,
  "customer_id": "<string>",
  "end_date": "2023-11-07T05:31:56Z",
  "is_new": true,
  "plan_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "start_date": "2023-11-07T05:31:56Z",
  "subscription_filters": [
    {
      "property_name": "<string>",
      "value": "<string>"
    }
  ]
}'
{
  "addons": [
    {
      "addon": {
        "addon_id": "<string>",
        "addon_name": "<string>",
        "addon_type": "flat",
        "billing_frequency": "one_time"
      },
      "addon_subscription_id": "<string>",
      "end_date": "2023-11-07T05:31:56Z",
      "fully_billed": true,
      "start_date": "2023-11-07T05:31:56Z"
    }
  ],
  "auto_renew": true,
  "billing_plan": {
    "plan_id": "<string>",
    "plan_name": "<string>",
    "version": 123,
    "version_id": "<string>"
  },
  "customer": {
    "customer_id": "<string>",
    "customer_name": "<string>",
    "email": "jsmith@example.com"
  },
  "end_date": "2023-11-07T05:31:56Z",
  "fully_billed": true,
  "is_new": true,
  "metadata": {},
  "start_date": "2023-11-07T05:31:56Z",
  "subscription_filters": [
    {
      "property_name": "<string>",
      "value": "<string>"
    }
  ],
  "subscription_id": "<string>"
}

A subscription associates one of your customers with one of your billing plans. You can define multiple subscriptions of the same plan for a single customer by using the subscription filters.

lotus.create_subscription(
  customer_id='cust_0569173ee6654369',
  plan_id='premium_plan_7ui9op',
  start_date='2020-01-01',
)

Authorizations

Authorization
string
headerrequired

Token-based authentication with required prefix "Token"

Body

auto_renew
boolean

Whether the subscription automatically renews. Defaults to true.

customer_id
string | null
required

The id provided when creating the customer

end_date
string

The date the subscription ends. This should be a string in YYYY-MM-DD format of the date in UTC time. If you don’t set it (recommended), we will use the information in the billing plan to automatically calculate this.

is_new
boolean
plan_id
string

The Lotus plan_id, found in the billing plan object. This field has been deprecated in favor of version_id for the sake of being explicit. If used, a best effort will be made to find the correct plan version (matching preferred currencies, prioritizing custom plans), but if more than one plan versions matches this criteria this will return an error.

start_date
string
required

The date the subscription starts. This should be a string in YYYY-MM-DD format of the date in UTC time.

subscription_filters
object[]

Add filter key, value pairs that define which events will be applied to this plan subscription.

Response

200 - application/json
addons
object[]
required
auto_renew
boolean
required

Whether the subscription automatically renews. Defaults to true.

billing_plan
object
required
customer
object
required
end_date
string
required

The time the subscription starts. This will be a string in yyyy-mm-dd HH:mm:ss format in UTC time.

fully_billed
boolean
required
is_new
boolean
required

Whether this subscription came from a renewal or from a first-time. Defaults to true on creation.

metadata
object
required
start_date
string
required

The time the subscription starts. This will be a string in yyyy-mm-dd HH:mm:ss format in UTC time.

subscription_filters
object[]
required
subscription_id
string
required