billing
POST /v1/subscriptions/{subscriptionId}/billing-rail
Choose which clock charges this subscription.
認証
ベアラー トークンとして API キーを送信します。キーには billing.payment.manage 権限が付与されている必要があります。権限のないキーは 404 ではなく 403 で拒否されます。
このエンドポイントは組織IDを受け付けません。お使いのキーによって所属する組織がすでに特定されており、レスポンスはその組織にスコープされます。
試してみる
アングルブラケット内のすべてをご自身の値に置き換え、キーのプレースホルダーをご利用中のダッシュボードのキーに置き換えてください。
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コンソールでは、実際の組織IDやお客様ご自身のキーが自動入力され、ライブ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