跳转到主要内容
POST

授权

X-API-KEY
string
header
必填

Your secret API key obtained from the Clink dashboard (Developers section)

请求头

X-Timestamp
string
必填

Current timestamp in milliseconds since Unix epoch (required for request signing)

示例:

"1783513683000"

路径参数

id
string
必填

Unique identifier of the subscription

请求体

application/json

Subscription update preview request

Parameters required to preview a subscription upgrade or downgrade.

priceId
string
必填

Target recurring price ID. The price must belong to the current merchant and support the subscription payment currency.

quantity
integer
默认值:1

Number of units for the target price. Optional; defaults to 1 when omitted. null and values below 1 are invalid.

必填范围: x >= 1
promotionCode
string

Promotion code to apply to the updated subscription.

immediate
boolean | null

Whether to force the update to take effect immediately. true requests an immediate update; false schedules it for the end of the current billing or trial period. Omitted or null lets the system decide. Explicit true requires both current and target prices to use flat_rate pricing. Outside a free trial, the target full-cycle amount (unit amount multiplied by quantity) must be greater than the current full-cycle amount; immediate downgrades and equal-amount changes are rejected.

示例:

true

billingCycleAnchor
enum<string> | null

Billing cycle anchor for an immediate update. A non-null value requires immediate=true. now starts a new full billing cycle at the update time; unchanged preserves the current period end. Outside a free trial, omitted or null uses unchanged. For an immediate free-trial update, omit this field if the target still has trial time remaining; when switching directly to paid billing, only now or omitted/null is allowed, and now is used.

可用选项:
now,
unchanged,
null
示例:

"now"

prorationBehavior
enum<string> | null

Proration policy for an immediate update. A non-null value requires immediate=true. always_invoice credits the unused portion of the current plan and charges the target plan for the remaining period with unchanged, or a full cycle with now. none gives no credit for the current plan and charges the target plan's full-cycle amount with either anchor; it does not waive payment. Discounts and tax are applied afterward. Outside a free trial, omitted or null uses always_invoice. For an immediate free-trial update, omit this field if the target still has trial time remaining; when switching directly to paid billing, only none or omitted/null is allowed, and none is used.

可用选项:
always_invoice,
none,
null
示例:

"always_invoice"

响应

Subscription update preview returned successfully

code
integer<int32>

Response status code, 200 when success

示例:

200

msg
string

Brief description of what happened, 'success' when happy case

示例:

"success"

data
object

Preview result for a subscription upgrade or downgrade.