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 '{
  "start_date": "2023-11-07T05:31:56Z",
  "end_date": "2023-11-07T05:31:56Z",
  "auto_renew": true,
  "is_new": true,
  "subscription_filters": [
    {
      "value": "<string>",
      "property_name": "<string>"
    }
  ],
  "customer_id": "<string>",
  "plan_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}'
{
  "subscription_id": "<string>",
  "start_date": "2023-11-07T05:31:56Z",
  "end_date": "2023-11-07T05:31:56Z",
  "auto_renew": true,
  "is_new": true,
  "subscription_filters": [
    {
      "value": "<string>",
      "property_name": "<string>"
    }
  ],
  "customer": {
    "customer_name": "<string>",
    "email": "jsmith@example.com",
    "customer_id": "<string>"
  },
  "billing_plan": {
    "plan_name": "<string>",
    "plan_id": "<string>",
    "version_id": "<string>",
    "version": 123
  },
  "fully_billed": true,
  "addons": [
    {
      "addon_subscription_id": "<string>",
      "start_date": "2023-11-07T05:31:56Z",
      "end_date": "2023-11-07T05:31:56Z",
      "addon": {
        "addon_name": "<string>",
        "addon_id": "<string>",
        "addon_type": "flat",
        "billing_frequency": "one_time"
      },
      "fully_billed": true
    }
  ],
  "metadata": {}
}

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

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.

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.

auto_renew
boolean

Whether the subscription automatically renews. Defaults to true.

is_new
boolean
subscription_filters
object[]

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

customer_id
string | null
required

The id provided when creating the customer

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.

Response

200 - application/json
subscription_id
string
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.

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.

auto_renew
boolean
required

Whether the subscription automatically renews. Defaults to true.

is_new
boolean
required

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

subscription_filters
object[]
required
customer
object
required
billing_plan
object
required
fully_billed
boolean
required
addons
object[]
required
metadata
object
required