On-demand charges
Charge selected one-off product items on top of an existing subscription whenever you need to: a one-time setup fee, an extra package, or an add-on bought at the click of a button.
Why this matters
Some product items aren’t billed on a recurring schedule; they’re charged when the customer asks for them. Flagging a one-off product item pricing as on-demand (the on_demand flag on its pricing item config) lets you retrieve the on-demand items available for a subscription and charge one or more of them on a separate invoice, with an optional preview first.
Listing the available on-demand items
To know which on-demand items can be charged for a subscription, fetch them per pricing plan schedule with GET /v1/pricing-plan-schedules/{id}/on-demand-pricing-items. Pass the optional timestamp query parameter to evaluate the schedule’s pricing at a specific point in time; it defaults to now.
The response mirrors a pricing plan version, filtered to the product item pricings that are ONE_OFF and flagged on-demand:
The same endpoint is available in the Customer Portal API, so you can present on-demand items to your customers and let them buy directly from the portal.
Charging an on-demand item
Charge one or more on-demand items with POST /v1/invoices/charge-on-demand-pricing-items:
pricing_items accepts the same pricing_item_id more than once. Each occurrence charges its own line and carries its own invoice date, and both lines land in the same invoice group. For example, an item priced at 100 USD granting a fixed 500 credits, listed twice, charges 200 USD and grants 1000 credits.
A one-off item priced FLAT bills a unit price times a count, so the request states the count in units. It is required for such an item and must be positive. There is no fallback to the item’s default_units: that value prefills your ordering screen, while the request states what the customer actually ordered. Ordering zero units is rejected. See One-off pricing.
The response is an invoice containing the charged on-demand lines:
Use preview: true to show the customer what the charge will look like before they confirm. A preview is never persisted and never finalized, regardless of finalize_immediately.
Typical flow
List the available items
Call GET /v1/pricing-plan-schedules/{id}/on-demand-pricing-items and show the available items to the customer.
See also: Wallet top-ups, which uses on-demand items to sell credits, One-off pricing, Add-ons, Invoices and One-off invoices.