Skip to content
Console
On this page

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

FieldTypeWhat it is
namestringThe subscription to quote. Required.
productstringThe target catalog product key. Required.
pricestringThe target recurring price key; optional if there is only one.
proration_behaviorProrationBehaviorHow the immediate change is billed. One of create_prorations, none, always_invoice.
effectivePlanChangeEffectiveApply now (default) or at the end of the current billing period. One of immediate, period_end.

Response

FieldTypeWhat it is
currency_codestringUpper-case ISO 4217 currency code.
credit_minorint64Credit from proration lines, as a nonnegative minor-unit amount.
charge_minorint64Charge from proration lines, or catalog unit price times quantity for a scheduled change (before processor discounts and tax).
amount_due_now_minorint64Amount payable now, in minor units.
next_renewal_timetimestampThe quoted renewal time.
effectivePlanChangeEffectiveWhen the plan change takes effect. One of immediate, period_end.
effective_timetimestampThe quoted effective time.
quote_tokenstringPass 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":"…"}'