Cancel a subscription
curl --request POST \
--url https://api.uselotus.io/api/subscriptions/cancel/ \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--data '{
"flat_fee_behavior": "refund",
"invoicing_behavior": "add_to_next_invoice",
"usage_behavior": "bill_full"
}'
[
{
"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.cancel_subscription(
customer_id='cust_0569173ee6654369',
subscription_filters=[
{
"property_name": "status",
"value": "active",
},
],
flat_fee_behavior='charge_prorated',
bill_usage=True,
invoicing_behavior='add_to_next_invoice',
)
lotus.cancel_subscription(
plan_id='plan_A',
subscription_filters=[
{
"property_name": "created_date",
"value": "2020-08-15",
},
],
flat_fee_behavior='charge_full',
bill_usage=False,
invoicing_behavior='invoice_now',
)
Authorizations
Token-based authentication with required prefix "Token"
Query Parameters
Filter to a specific customer.
Filter to a specific plan. If not specified, all plans will be included in the cancellation request.
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
When canceling a subscription, the behavior used to calculate the flat fee. If null or not provided, the charge's default behavior will be used according to the subscription's start and end dates. If charge_full, the full flat fee will be charged, regardless of the duration of the subscription. If refund, the flat fee will not be charged. If charge_prorated, the prorated flat fee will be charged.
refund
- Refundcharge_prorated
- Proratecharge_full
- Charge Full
refund
, charge_prorated
, charge_full
,
Whether to invoice now or invoice at the end of the billing period. Defaults to invoice now.
add_to_next_invoice
- Add to Next Invoiceinvoice_now
- Invoice Now
add_to_next_invoice
, invoice_now
If bill_full, current usage will be billed on the invoice. If bill_none, current unbilled usage will be dropped from the invoice. Defaults to bill_full.
bill_full
- Bill Fullbill_none
- Bill None
bill_full
, bill_none
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/cancel/ \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--data '{
"flat_fee_behavior": "refund",
"invoicing_behavior": "add_to_next_invoice",
"usage_behavior": "bill_full"
}'
[
{
"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>"
}
]