billing
POST /v1/subscriptions/{subscriptionId}/billing-rail
Choose which clock charges this subscription.
Autentifikimi
Drgoni një çelës API si një token mbajtës. Çelësi duhet të ketë lejen billing.payment.manage; një çelës pa të refuzohet me 403, jo 404.
Ky pikëndalim nuk pranon id të organizatës. Çelësi juaj tashmë identifikon organizatën së cilës i përket dhe përgjigjja kufizohet vetëm për atë.
Provoje
Zëvendësoni çdo gjë brenda kllapave këndore me vlerat tuaja dhe vendbanuesin e çelësit me një çelës nga paneli juaj.
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>> }'Jeni kyçur? Konsola e API-së në panelin tuaj plotëson ID-në tuaj reale të organizatës dhe çelësin tuaj, dhe ekzekuton kërkesën kundrejt API-së live, kështu që ju mund të shihni përgjigjen aktuale. Hapni këtë pikë fundore në konsolën e API-së
Detajet
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`.
Parametrat
| Emri | Lloji | Kërkohet | Çfarë është kjo |
|---|---|---|---|
subscriptionId (path) | Uuid | Po | The subscription whose recurring rail is being changed. |
Trupi i kërkesës
| Emri | Lloji | Kërkohet | Çfarë është kjo |
|---|---|---|---|
rail | string<engine, paypal> | Po | — |
Përgjigja
| Emri | Lloji | Kërkohet | Çfarë është kjo |
|---|---|---|---|
rail | string<engine, paypal> | Po | — |
approval_url | object | Jo | Where the buyer must approve the PayPal agreement. ⛔⛔ **Until they approve there and PayPal sends us a signed `BILLING.SUBSCRIPTION.ACTIVATED`, nothing is agreed and nothing wil… |
active | boolean | Po | 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 | Jo | — |
Gabimet që ky pikëndalim mund të kthejë
401 · 403 · 404 · 422 · 429