palbaseDocs

Palbase Payments · API

POST/payments/subscriptions/{subscription_id}/quantity

Change a subscription's quantity

Makes the subscription of another quantity (seats). Seats added are charged at once for the days left of the period — off session: nobody is on a payment page when a server asks — and added only when that charge is paid. Not paid, nothing is added and nothing is left waiting at the provider: a card that declines is 402 seat_payment_failed (ask again once the customer has a card that pays); a card that asks for its customer's own confirmation of every charge — 3-D Secure, which a server's call cannot give — is 402 seat_payment_requires_action (ask again once the customer pays with a card that asks for none, or add them with proration next_invoice — added at once, their charge put on the next invoice). A card confirmed once, when the customer paid at checkout or saved it, is charged without asking again. Fewer give no money back: the seats stay until the period's end (quantity), and the next renewal bills the fewer (renewal_quantity). proration asks otherwise. Asked again, the call sets the quantity it names and charges nothing twice: no refusal of it is kept against an Idempotency-Key, and a call that failed is asked again the same way. A quantity changed on the provider's own pages (its customer portal, where that is turned on) is followed — more at once, fewer from the next renewal — and settled by the provider's settings, not by this call's rules. The subscription must be paid for and running (409 subscription_not_active), on a channel whose capabilities say subscription_quantity (422 quantity_not_supported); one change is made at a time (409 subscription_busy: ask again). Tells payments.subscription.changed.

Called by your server, with the project's secret key.

Path

subscription_idstring · requiredSubscription UUID.

Request body

quantityinteger · requiredHow many the subscription is to be of.
proration"charge_now" | "next_invoice" | "none" · optionalWhat becomes of the money. Seats added: `charge_now` (the default) invoices the days left and charges them at once, off session, and adds nothing if the charge is not paid (with a payment method that takes days to pay, a bank debit, they are added at once and their charge is in process: if the debit later fails, the provider follows it by its own rules for a failed payment of the subscription, which can end it); `next_invoice` adds them at once and puts the days left on the next invoice; `none` is refused (`400 invalid_proration`) — seats are sold, now or on the next invoice. Fewer: `none` (the default) gives no money back, keeps the seats until the period's end and bills the fewer from the next renewal; `next_invoice` takes them off at once and credits the days left on the next invoice; `charge_now` is refused (`400 invalid_proration`). Back up to what the subscription has, nothing is charged whatever is asked.
curl
curl -X POST "https://<your-ref>.palbase.studio/payments/subscriptions/<subscription_id>/quantity" \
  -H "apikey: $PALBASE_SECRET_KEY" \
  -H "content-type: application/json" \
  -d '{"quantity":1}'

Responses

200OK

defaultStandard Palbase JSON error envelope (`error` and `error_description`).

Operation ChangeSubscriptionQuantity of payments's contract.