billing

POST /v1/subscriptions/{subscriptionId}/prepay

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

جميع نقاط نهاية billing

جميع مستندات المطورين

المصادقة

أرسل مفتاح واجهة برمجة التطبيقات (API key) كرمز حامل (bearer token). يجب أن يحمل المفتاح إذن billing.payment.manage؛ والمفتاح الذي لا يملكه يُرفض بالرمز 403 وليس 404.

لا يقبل هذا الطرف أي معرف للمؤسسة. يحدد مفتاحك بالفعل المؤسسة التي ينتمي إليها، وتكون الاستجابة محصورة في نطاقها.

جربه الآن

استبدل أي شيء بين أقواس زاوية بقيمك الخاصة، والعنصر النائب للمفتاح بمفتاح من لوحة تحكمك.

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

التفاصيل

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.

جسم الطلب

الاسمالنوعمطلوبما هو هذا
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