billing
POST /v1/subscriptions/{subscriptionId}/billing-rail
Choose which clock charges this subscription.
การยืนยันตัวตน
ส่ง API key ในรูปแบบ bearer token คีย์ดังกล่าวต้องมีสิทธิ์ billing.payment.manage หากไม่มีสิทธิ์ ระบบจะปฏิเสธด้วยรหัส 403 แทนที่จะเป็น 404
ปลายทางนี้ไม่ต้องใช้รหัสองค์กร คีย์ของคุณระบุองค์กรที่เป็นเจ้าของอยู่แล้ว และการตอบกลับจะถูกจำกัดขอบเขตไว้เฉพาะองค์กรนั้น
ทดลองใช้เลย
แทนที่สิ่งใดๆ ที่อยู่ภายในวงเล็บแหลมด้วยค่าของคุณเอง และตัวยึดตำแหน่งคีย์ด้วยคีย์จากแดชบอร์ดของคุณ
curl -X POST https://api.zinndigital.com/v1/subscriptions/{subscriptionId}/billing-rail \
-H "Authorization: Bearer zdk_live_…" \
-H "Content-Type: application/json" \
-d '{ "rail": <string<engine, paypal>> }'เข้าสู่ระบบแล้วใช่ไหม คอนโซล API ในแดชบอร์ดของคุณจะเติมรหัสองค์กรจริงและคีย์ของคุณเองโดยอัตโนมัติ และทำการส่งคำขอไปยัง API จริง เพื่อให้คุณเห็นผลลัพธ์ที่เป็นข้อมูลจริง เปิดจุดสิ้นสุดนี้ในคอนโซล API
รายละเอียด
Move a subscription between the engine rail (we invoice and charge on the renewal date) and the PayPal rail (PayPal charges on its own schedule under an agreement the customer approved). ADR 0029 records the boundary: PayPal owns only when the money is taken — the engine still owns what is owed, tax, entitlements, dunning and suspension. ⛔⛔ Switching to PayPal returns an approval_url and grants nothing. Until the buyer approves in PayPal's own interface and PayPal sends us a signed BILLING.SUBSCRIPTION.ACTIVATED webhook, the agreement cannot charge and the subscription's clock has not started. active is false for exactly that reason. The browser's return from the approval URL is an attacker-supplied claim and is never treated as approval. Switching away cancels the agreement at PayPal first and unbinds second. The reverse order would hand the subscription back to the engine's renewal sweep while PayPal was still entitled to charge it — a double charge for the window between the two calls. Requires billing.payment.manage. 422 carries a code: ALREADY_ON_RAIL, NO_CATALOGUE_PRICE, PRICE_WOULD_CHANGE (the subscription is on a price that differs from the published one, so switching would change what the customer pays — refused rather than done quietly), NOT_SWITCHABLE, or PAYPAL_REFUSED.
พารามิเตอร์
| ชื่อ | ประเภท | จำเป็นต้องมี | ลักษณะของสิ่งนี้ |
|---|---|---|---|
subscriptionId (path) | Uuid | ใช่ | The subscription whose recurring rail is being changed. |
เนื้อหาคำขอ
| ชื่อ | ประเภท | จำเป็นต้องมี | ลักษณะของสิ่งนี้ |
|---|---|---|---|
rail | string<engine, paypal> | ใช่ | — |
การตอบกลับ
| ชื่อ | ประเภท | จำเป็นต้องมี | ลักษณะของสิ่งนี้ |
|---|---|---|---|
rail | string<engine, paypal> | ใช่ | — |
approval_url | object | ไม่ใช่ | Where the buyer must approve the PayPal agreement. ⛔⛔… |
active | boolean | ใช่ | Whether the named rail is charging yet. false immediately after switching to PayPal — a client that rendered "you are now billed by PayPal" here would be telling the customer… |
paypal_subscription_id | string | ไม่ใช่ | — |
ข้อผิดพลาดที่เอนด์พอยต์นี้สามารถส่งกลับได้
401 · 403 · 404 · 422 · 429