POST
/
api
/
subscriptions
/
{subscription_id}
/
components
/
{metric_id}
/
change_prepaid_units
/
curl --request POST \
  --url https://api.uselotus.io/api/subscriptions/{subscription_id}/components/{metric_id}/change_prepaid_units/ \
  --header 'Authorization: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '{
  "units": 0,
  "invoice_now": true
}'
{
  "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.change_prepaid_units(
    subscription_id='sub_a623349004cd4947aca1851c64aa6fbd',
    metric_id='metric_a47ac0bf',
    units=32,
    invoice_now=true
)

In Lotus, you can define a certain number of units to be “prepaid” for a subscription. For example, if your business uses seats as a metric, you could define that your plan has 5 seats “prepaid” for each subscription. This means that the subscription will have 5 seats available for use, and you can add more seats as needed.

This feature lets you have the benefits or charging flat fees in advance, while still metering the usage of the metric and allowing you to add more units as needed.

This API is not currently available in our SDKs, but please contact us if you would like to use it as part of your workflow.

If the change decreases the number of prepaid units, then the difference is awarded to the customer as a credit. If it icnreases, then you can choose between invoicing the difference immediately or adding it to the next invoice.

Authorizations

Authorization
string
header
required

Token-based authentication with required prefix "Token"

Path Parameters

metric_id
string
required

The ID of the metric to alter the prepaid usage for.

subscription_id
string
required

The ID of the subscription which will have its plans switched.

Body

Response

200 - application/json

The response is of type object.