Create a subscription
/api/subscriptions/
curl --request POST \
--url https://api.uselotus.io/api/subscriptions/ \
--header 'Authorization: <authorization>' \
--header 'X-API-KEY: <x-api-key>' \
--data '{
"customer_id": "<customer_id>",
"start_date": "<start_date>"
}'
A subscription associates one of your customers with one of your billing plans. You can safely give a customer multiple subscriptions to different plans.
If you want to give a single customer multiple subscriptions to the same plan (for example, one for each of their environments), you can do that using subscription_filters
. For more details on how to use them and what they do, see the subscription filters documentation.
If any of your usage components has a prepaid charge associated with it, you can specify how many untis they prepaid for as part of this call. If you don’t specify a value, the component’s default value will be used. If there was no default value, the susbcription creation will fail.
lotus.create_subscription(
customer_id='cust_6c237d6c149c47db8f64246b78ecac13',
plan_id='plan_f17c6153807d4f4b812265a09cf06680',
start_date='2022-02-23 03:30:00+00:00',
)
Authorizations
Token-based authentication with required prefix "Token"
Body
Whether the subscription automatically renews. Defaults to true.
The initial units for the plan components' prepaid fixed charges. This is only required if the plan has plan components where you did not specify the initial units.
The id provided when creating the customer
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.
A JSON object containing additional information about the subscription.
The Lotus plan_id, found in the billing plan object. We will make a best-effort attempt to find the correct plan version (matching preferred currencies, prioritizing custom plans), but if more than one plan version or no plan version matches these criteria this will return an error.
The date the subscription starts. This should be a string in YYYY-MM-DD format of the date in UTC time.
Add filter key, value pairs that define which events will be applied to this plan subscription.
Response
Whether the subscription automatically renews. Defaults to true.
The time the subscription starts. This will be a string in yyyy-mm-dd HH:mm:ss format in UTC time.
Whether this subscription came from a renewal or from a first-time. Defaults to true on creation.
The time the subscription starts. This will be a string in yyyy-mm-dd HH:mm:ss format in UTC time.
curl --request POST \
--url https://api.uselotus.io/api/subscriptions/ \
--header 'Authorization: <authorization>' \
--header 'X-API-KEY: <x-api-key>' \
--data '{
"customer_id": "<customer_id>",
"start_date": "<start_date>"
}'