billing

POST /v1/subscriptions/{subscriptionId}/prepay

Create the order to pay for several billing periods at once.

Све billing крајње тачке

Сва документација за програмере →

Аутентификација

Пошаљите API кључ као bearer токен. Кључ мора имати дозволу billing.payment.manage; кључ без ње се одбија уз 403, а не 404.

Ова крајња тачка не прихвата id организације. Ваш кључ већ идентификује организацију којој припада, а одговор је ограничен на њу.

Испробајте

Замените све што је у угластим заградама сопственим вредностима, а чувар места кључа кључем са своје контролне табле.

curl -X POST https://api.zinndigital.com/v1/subscriptions/{subscriptionId}/prepay \
  -H "Authorization: Bearer zdk_live_…" \
  -H "Content-Type: application/json" \
  -d '{ "periods": <integer> }'

Пријављени сте? API конзола на вашој контролној табли попуњава ваш прави id организације и ваш сопствени кључ, и покреће захтев према живом API-ју како бисте могли да видите стварни одговор. Отворите ову крајњу тачку у API конзоли

Детаљи

Mints an unpaid order for N whole billing periods. ⛔⛔ No money is taken here. The client then settles that order through POST /v1/orders/{orderId}/pay, which already knows how to pay from account balance, from a gateway, or from both. That separation is the point rather than an implementation detail: it is what lets a customer with no chargeable mandate use this at all — somebody paying in crypto, or in a market whose regulator forbids an off-session charge. They top up once and pay six months from their balance, with no card anywhere in the flow. Replaying the same request returns the same order rather than a second one, so a double-clicked button cannot bill twice. Asking for a different number of periods supersedes the earlier unpaid prepay order and mints a fresh one — a customer changing their mind is not a collision. An unpaid order against this subscription that is not a prepayment (a plan change, say) is refused with ORDER_IN_FLIGHT instead, and is never cancelled on the customer's behalf. Requires billing.payment.manage. 422 carries a code in its details: TOO_FEW / TOO_MANY (outside the allowed range), NOT_PREPAYABLE (ended, comped or free), RAIL_NOT_SUPPORTED (billed by PayPal on its own schedule), ORDER_IN_FLIGHT, or ARREARS_OUTSTANDING — the subscription owes missed periods (Subscription.periods_owed > 0): its outstanding renewal is paid first, because the service resumes only when every missed period and the current one are paid (W43-107).

Параметри

НазивТипОбавезноШта је ово
subscriptionId (path)UuidДаThe subscription to pay ahead on.

Тело захтева

НазивТипОбавезноШта је ово
periodsintegerДаHow many whole billing periods to pay for now.

Одговор

НазивТипОбавезноШта је ово
order_idUuidДаUUIDv7 identifier — sortable by creation time (docs/02 §8).
order_numberstringДа—
periodsintegerДа—
total_amount_minorintegerДаIncluding tax.
currencystringДа—
statusstringДа—

Грешке које ова крајња тачка може вратити

401 · 403 · 404 · 422 · 429