Subscriptions
Cancel a subscription
POST

/api/subscriptions/{subscription_id}/cancel/

X-API-KEY*
Authorization*
curl --request POST \
  --url https://api.uselotus.io/api/subscriptions/{subscription_id}/cancel/ \
  --header 'Authorization: <authorization>' \
  --header 'X-API-KEY: <x-api-key>'
lotus.cancel_subscription(
    subscription_id='sub_a623349004cd4947aca1851c64aa6fbd',
    flat_fee_behavior='charge_prorated',
    usage_behavior='bill_full',
    invoicing_behavior='invoice_now'
)

Authorizations

Authorization[header]required
string

Token-based authentication with required prefix "Token"

Path Parameters

subscription_idrequired
string

The ID of the subscription to cancel.

Body

flat_fee_behavior
string

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 - Refund
  • charge_prorated - Prorate
  • charge_full - Charge Full
Available options:
refund,
charge_prorated,
charge_full,
usage_behaviorDefault: "bill_full"
string

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 Full
  • bill_none - Bill None
Available options:
bill_full,
bill_none
invoicing_behaviorDefault: "invoice_now"
string

Whether to invoice now or invoice at the end of the billing period. Defaults to invoice now.

  • add_to_next_invoice - Add to Next Invoice
  • invoice_now - Invoice Now
Available options:
add_to_next_invoice,
invoice_now

Response

subscription_idrequired
string
start_daterequired
string

The time the subscription starts. This will be a string in yyyy-mm-dd HH:mm:ss format in UTC time.

end_daterequired
string

The time the subscription starts. This will be a string in yyyy-mm-dd HH:mm:ss format in UTC time.

auto_renewrequired
boolean

Whether the subscription automatically renews. Defaults to true.

is_newrequired
boolean

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

subscription_filtersrequired
array
customerrequired
object
billing_planrequired
object
fully_billedrequired
boolean
addonsrequired
array
metadatarequired
object