API Reference
- GETAPI Overview
- SDK Setup
- Events
- Customers
- Entitlements
- Subscriptions
- Plans
- Invoices
- Credits
Subscriptions
Switch a subscription's plan
Upgrade or downgrade the susbcription’s plan.
POST
/
api
/
subscriptions
/
{subscription_id}
/
switch_plan
/
Copy
Ask AI
curl --request POST \
--url https://api.uselotus.io/api/subscriptions/{subscription_id}/switch_plan/ \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '{
"switch_plan_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"invoicing_behavior": "invoice_now",
"usage_behavior": "transfer_to_new_subscription",
"component_fixed_charges_initial_units": [
{
"metric_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"units": 5000000000
}
]
}'
Copy
Ask AI
{
"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": {}
}
Keep in mind that Lotus internally updates the subscription ID when you upgrade or downgrade a subscription. This means that the old ID will no longer be valid.
Copy
Ask AI
lotus.switch_subscription_plan(
subscription_id='sub_a623349004cd4947aca1851c64aa6fbd',
switch_plan_id='plan_b5fe8a2603a24c4fa05ffb3fb382fe6d',
invoicing_behavior='add_to_next_invoice',
usage_behavior='transfer_to_new_subscription', # or 'keep_separate'
)
Authorizations
Token-based authentication with required prefix "Token"
Path Parameters
The ID of the subscription which will have its plans switched.
Body
Response
200 - application/json
The response is of type object
.
Copy
Ask AI
curl --request POST \
--url https://api.uselotus.io/api/subscriptions/{subscription_id}/switch_plan/ \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '{
"switch_plan_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"invoicing_behavior": "invoice_now",
"usage_behavior": "transfer_to_new_subscription",
"component_fixed_charges_initial_units": [
{
"metric_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"units": 5000000000
}
]
}'
Copy
Ask AI
{
"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": {}
}
Assistant
Responses are generated using AI and may contain mistakes.