billing
POST /v1/subscriptions/{subscriptionId}/prepay
Create the order to pay for several billing periods at once.
Նույնականացում
Ուղարկեք API բանալին որպես bearer token: Բանալին պետք է ունենա 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), or `ORDER_IN_FLIGHT`.
Պարամետրեր
| Անուն | Տեսակ | Պահանջվում է | Ինչ է դա |
|---|---|---|---|
subscriptionId (path) | Uuid | Այո | The subscription to pay ahead on. |
Հարցման մարմին
| Անուն | Տեսակ | Պահանջվում է | Ինչ է դա |
|---|---|---|---|
periods | integer | Այո | How many whole billing periods to pay for now. |
Պատասխան
| Անուն | Տեսակ | Պահանջվում է | Ինչ է դա |
|---|---|---|---|
order_id | Uuid | Այո | UUIDv7 identifier — sortable by creation time (docs/02 §8). |
order_number | string | Այո | — |
periods | integer | Այո | — |
total_amount_minor | integer | Այո | Including tax. |
currency | string | Այո | — |
status | string | Այո | — |
Այս վերջնակետի կողմից վերադարձվող սխալները
401 · 403 · 404 · 422 · 429