POST
/
api
/
subscriptions
/
{subscription_id}
/
addons
/
{addon_id}
/
cancel
/
curl --request POST \
  --url https://api.uselotus.io/api/subscriptions/{subscription_id}/addons/{addon_id}/cancel/ \
  --header 'Authorization: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '{
  "flat_fee_behavior": "refund",
  "invoicing_behavior": "add_to_next_invoice",
  "usage_behavior": "bill_full"
}'
[
  {
    "addon": {
      "addon_id": "<string>",
      "addon_name": "<string>",
      "addon_type": "flat",
      "billing_frequency": "one_time"
    },
    "addon_subscription_id": "<string>",
    "auto_renew": true,
    "customer": {
      "customer_id": "<string>",
      "customer_name": "<string>",
      "email": "jsmith@example.com"
    },
    "end_date": "2023-11-07T05:31:56Z",
    "fully_billed": true,
    "metadata": {},
    "parent": {
      "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": {},
      "plan_detail": {
        "plan_id": "<string>",
        "plan_name": "<string>",
        "version": 123,
        "version_id": "<string>"
      },
      "start_date": "2023-11-07T05:31:56Z",
      "subscription_filters": [
        {
          "property_name": "<string>",
          "value": "<string>"
        }
      ],
      "subscription_id": "<string>"
    },
    "start_date": "2023-11-07T05:31:56Z"
  }
]
lotus.cancel_addon(
  subscription_id='sub_e953bfbf42a442ca90079c8f1656d306',
  addon_id='addon_5af61a194ca144478fb2721dd34c9049',
  flat_fee_behavior='charge_prorated',
  invoicing_behavior='invoice_now'
)

Authorizations

Authorization
string
headerrequired

Token-based authentication with required prefix "Token"

Path Parameters

addon_id
string
required

The ID of the addon within the subscription update.

subscription_id
string
required

The ID of the subscription to update.

Body

flat_fee_behavior
enum<string> | null

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,
invoicing_behavior
enum<string>
default: invoice_now

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
usage_behavior
enum<string>
default: bill_full

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

Response

200 - application/json
addon
object
required
addon_subscription_id
string
required
auto_renew
boolean
required

Whether the subscription automatically renews. Defaults to true.

customer
object
required
end_date
string
required

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

fully_billed
boolean
required
metadata
object
required
parent
object
required
start_date
string
required

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