Update a subscription
curl --request POST \
--url https://api.uselotus.io/api/subscriptions/update/ \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--data '{
"end_date": "2023-11-07T05:31:56Z",
"invoicing_behavior": "add_to_next_invoice",
"replace_plan_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"turn_off_auto_renew": true,
"usage_behavior": "transfer_to_new_subscription"
}'
[
{
"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>"
}
]
lotus.update_subscription(
customer_id='cust_0569173ee6654369',
plan_id="plan_123",
replace_plan_id="plan_456",
invocing_behavior="add_to_next_invoice",
turn_off_auto_renew=True
)
lotus.update_subscription(
customer_id='cust_0569173ee6654369',
plan_id="plan_123",
subscription_filters=[{"property_name": "status", "value": "active"}],
end_date=datetime.date(2022, 12, 8),
)
Authorizations
Token-based authentication with required prefix "Token"
Query Parameters
Filter to a specific customer.
Filter to a specific plan.
Filter to a specific set of subscription filters. If your billing model only allows for one subscription per customer, you very likely do not need this field. Must be formatted as a JSON-encoded + stringified list of dictionaries, where each dictionary has a key of 'property_name' and a key of 'value'.
Body
Change the end date for the subscription.
The invoicing behavior to use when replacing the plan. Invoice now will invoice the customer for the prorated difference of the old plan and the new plan, whereas add_to_next_invoice will wait until the end of the subscription to do the calculation.
add_to_next_invoice
- Add to Next Invoiceinvoice_now
- Invoice Now
add_to_next_invoice
, invoice_now
[DEPRECATED] Will currently perform a best-effort attempt to find the correct plan version to replace the current plan with. If more than one plan version matches the criteria, this will return an error. Use the change_plan method of a subscription instance instead.
Turn off auto renew for the subscription
The usage behavior to use when replacing the plan. Transfer to new subscription will transfer the usage from the old subscription to the new subscription, whereas keep_separate will reset the usage to 0 for the new subscription, while keeping the old usage on the old subscription and charging for that appropriately at the end of the month.
transfer_to_new_subscription
- Transfer to New Subscriptionkeep_separate
- Keep Separate
transfer_to_new_subscription
, keep_separate
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/update/ \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--data '{
"end_date": "2023-11-07T05:31:56Z",
"invoicing_behavior": "add_to_next_invoice",
"replace_plan_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"turn_off_auto_renew": true,
"usage_behavior": "transfer_to_new_subscription"
}'
[
{
"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>"
}
]