POST
/
api
/
subscriptions
/
cancel
/
curl --request POST \
  --url https://api.uselotus.io/api/subscriptions/cancel/ \
  --header 'Authorization: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '{
  "flat_fee_behavior": "refund",
  "usage_behavior": "bill_full",
  "invoicing_behavior": "invoice_now"
}'
[
  {
    "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": {}
  }
]
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

Authorization
string
header
required

Token-based authentication with required prefix "Token"

Query Parameters

customer_id
string | null
required

Filter to a specific customer.

Minimum length: 1
plan_id
string

Filter to a specific plan. If not specified, all plans will be included in the cancellation request.

subscription_filters
object[]

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

Response

200 - application/json

The response is of type object[].