Preview plan change on a customer subscription
Quote a plan change without modifying the subscription.
Quote a plan change without modifying the subscription.
- Path
POST https://api.sylphx.com/v1/orgs/acme/projects/shop/envs/production/customer_subscriptions/customer-subscription:previewPlanChange - Scope
billing:read - Effect
read— nothing is written. - Collection customer_subscriptions
Request
| Field | Type | What it is |
|---|---|---|
name | string | The subscription to quote. Required. |
product | string | The target catalog product key. Required. |
price | string | The target recurring price key; optional if there is only one. |
proration_behavior | ProrationBehavior | How the immediate change is billed. One of create_prorations, none, always_invoice. |
effective | PlanChangeEffective | Apply now (default) or at the end of the current billing period. One of immediate, period_end. |
Response
| Field | Type | What it is |
|---|---|---|
currency_code | string | Upper-case ISO 4217 currency code. |
credit_minor | int64 | Credit from proration lines, as a nonnegative minor-unit amount. |
charge_minor | int64 | Charge from proration lines, or catalog unit price times quantity for a scheduled change (before processor discounts and tax). |
amount_due_now_minor | int64 | Amount payable now, in minor units. |
next_renewal_time | timestamp | The quoted renewal time. |
effective | PlanChangeEffective | When the plan change takes effect. One of immediate, period_end. |
effective_time | timestamp | The quoted effective time. |
quote_token | string | Pass unchanged to ChangePlan to require the same amount, currency and subscription state. Available for immediate always_invoice changes with no attached schedule. Short-lived; re-preview if the quote no longer matches. |
Errors
UNAUTHENTICATED— No valid key or token was presented.PERMISSION_DENIED— The key lacks the method's permission.RESOURCE_NOT_FOUND— The named Resource does not exist or is not visible.INVALID_FIELD— A field failed validation.INVALID_STATE— The Resource is in a state that forbids the call.FAILED_PRECONDITION— A released manifest owns a requested resource field. Change the declaration in the named file and key path, then release.UNAVAILABLE— The Resource store, the owning service's backend, or the key verifier's snapshot is unavailable; retry after Retry-After.
Every error arrives in the body Errors describes.
Examples
curl -X POST "https://api.sylphx.com/v1/orgs/acme/projects/shop/envs/production/customer_subscriptions/customer-subscription:previewPlanChange" \
-H "Authorization: Bearer $SYLPHX_API_KEY" \
-H "Content-Type: application/json" \
-d '{"product":"…"}'