Skip to main content
POST
Sets a new period total for one prepaid feature of the customer’s plan ("credits" for its credit pool), the included amount counted. Send an Idempotency-Key that identifies this one change, and reuse it on every retry.
  • A raise is a prorated change on the customer’s Stripe bill: one invoice with Stripe’s credit for the old packs and charge for the new ones, to the period end, charged to the saved card. Once it’s paid, the customer holds the new quantity and is granted the extra units prorated by the time left in the period, rounded down. The next renewal bills and grants the new quantity in full.
  • The same quantity changes nothing: { itemChangeId: null, status: "unchanged" }.
  • A decrease waits for the renewal: { status: "scheduled" }, with the new total in pendingQuantity. Nothing is refunded and this period keeps its packs and grant; the renewal bills the lower packs and grants the lower quantity. A later change replaces it: another decrease, or the held quantity again to drop it. A raise while one waits is 409 subscription_change_pending.
The quantity is checked as attach checks it: at least the included amount, whole packs above it (400 invalid_request at quantities.N.quantity), and at most maxQuantity (400 max_purchase_exceeded). One feature changes per request. The customer must hold the plan on an active paid bill (409 plan_not_held), with no other change pending on it (409 subscription_change_pending). An entity’s own plan sells no prepaid units, so entityId is 400 invalid_request. Needs the Billing permission.

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Headers

idempotency-key
string

Required: a raise changes what the customer pays now. Identifies this one intended change: reuse it on every retry, and use a new one for the next. A key lasts 24 hours.

Required string length: 1 - 255

Body

application/json
customerId
string
required

Your ID for the customer, such as your user ID.

Required string length: 1 - 255
Example:

"user_123"

planId
string
required

The customer's plan whose prepaid quantities change.

Required string length: 1 - 255
Example:

"pro"

quantities
object[]
required

The new period totals, one entry per prepaid feature; send only the one that changes. A raise is charged now, a decrease waits for the renewal.

Required array length: 1 - 50 elements
entityId
string

An entity's own plan sells no prepaid units, so sending one is 400 invalid_request.

Required string length: 1 - 255

Response

The change and the quantities the customer holds. A raise is charged now, prorated (Stripe's credit for the old packs and charge for the new), and grants the extra units prorated by the time left in the period; a decrease is scheduled for the renewal, with no refund and this period untouched; the same quantity changes nothing (unchanged).

itemChangeId
integer | null
required

The change on the customer's bill, or null when nothing changed.

status
enum<string>
required

applied: paid and granted. pending_payment: the card needs the customer (open paymentUrl). processing: Stripe hasn't settled it; retry with the same key. closed: Stripe voided it. scheduled: a decrease, billed and granted from the renewal (pendingQuantity until then). unchanged: the quantities asked for are the ones held.

Available options:
applied,
pending_payment,
processing,
closed,
scheduled,
unchanged
paymentUrl
string | null
required
quantities
object[]
required

The quantities held now: the new ones once applied, the old ones before.