플랜 변경
기존 subscription의 plan을 수정하여 서로 다른 pricing tier로 업그레이드 및 다운그레이드할 수 있습니다.
참고: 기본적으로 고객의 기존 결제 정보를 사용합니다. 호스팅 결제 페이지를 통해 청구하려면 collect_via_payment_link를 설정하세요.
예약된 요금제 변경
요금제 변경이 언제 적용될지 제어하려면effective_at 매개변수를 사용하세요:
결제 실패 처리
요금제 변경 결제가 실패할 경우의 동작을 제어하려면on_payment_failure 매개변수를 사용하세요:
on_payment_failure 매개변수가 지정되지 않으면, 대시보드에서 설정한 비즈니스 수준 설정이 기본값으로 사용됩니다.Payment Link를 통한 수금
저장된 결제 수단으로 청구하는 대신 고객을 호스팅 결제 페이지로 보내려면collect_via_payment_link를 true로 설정하세요. 그러면 응답에 payment_id, payment_link, client_secret 및 expires_on가 포함됩니다. 결제를 완료하려면 고객을 payment_link로 리디렉션하세요.
다음 조건이 필요합니다:
422를 반환합니다. Link가 미결제 상태인 동안 subscription은 현재 plan을 유지하며, 이후의 change-plan 요청은 409를 반환합니다.
Discount Code
discount_codes 배열을 전달하여 plan을 변경할 때 하나 이상의 누적 discount code를 적용할 수 있습니다(최대 20개 항목이며 배열 순서대로 적용됨). 단일 discount_code field는 deprecated 상태지만 기존 integration에서는 계속 작동합니다. 동일한 요청에서 discount_codes와 함께 사용할 수는 없습니다.
인증
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
경로 매개변수
Subscription Id
본문
Unique identifier of the product to subscribe to
Proration Billing Mode
prorated_immediately, full_immediately, difference_immediately, do_not_bill, prorated_immediately_keep_cycle Number of units to subscribe for. Must be at least 1.
x >= 0Whether adaptive currency fees should be included in the price (true) or added on top (false). If not specified, uses the subscription's stored setting.
Addons for the new plan. Note : Leaving this empty would remove any existing addons
Cancel the payment link of a pending plan change, so that this change can replace it.
The link is cancelled only if the customer has not started to pay. A
paid or in-progress payment gives a 409. A failed cancel gives a
503, and a retry is safe.
The request is validated before the cancel. A later failure, for example an amount below the minimum, leaves the subscription on its current plan with no open link. A retry is safe.
The preview route shares this request body and ignores this field.
Replace a scheduled plan change with this one.
The scheduled change is cancelled by the transaction that applies this change. A change that never applies leaves the schedule in place.
effective_at: next_billing_date is allowed. The new schedule then
replaces the old one in the request transaction.
A pending plan change still gets a 409. This field does not affect it.
The preview route shares this request body, so a preview that sets this
field also passes the scheduled-change 409.
Collect the plan-change amount with a payment link. The customer then pays on a checkout page.
The business needs the allow_plan_change_via_payment_link capability.
The request needs effective_at: immediately. The request also needs
on_payment_failure: prevent_change.
The preview route shares this request body and ignores this field.
DEPRECATED: Use discount_codes instead. Cannot be used together with discount_codes.
Stacked discount codes to apply to the new plan. Max 20. Cannot be used together with discount_code. If provided, replaces any existing discount codes. Empty array removes all discounts. If not provided (None), existing discounts with preserve_on_plan_change=true are preserved.
When to apply the plan change.
immediately(default): Apply the plan change right awaynext_billing_date: Schedule the change for the next billing date
immediately, next_billing_date Metadata for the payment. If not passed, the metadata of the subscription will be taken
Controls behavior when the plan change payment fails.
prevent_change: Keep subscription on current plan until payment succeedsapply_change(default): Apply plan change immediately regardless of payment outcome
With effective_at: next_billing_date, the plan change payment replaces the renewal payment.
If that payment fails with prevent_change, the plan change is cancelled.
The subscription then renews on the current plan, with the usual payment retries.
If not specified, uses the business-level default setting.
prevent_change, apply_change The URL that receives the customer after they pay the payment link.
Needs collect_via_payment_link: true. Without it, the request gets a
422. A change that collects no money issues no link and does not use
the URL. The preview route validates this field but does not use it.
The redirect adds subscription_id, payment_id and status. The
status value is the status of the plan-change payment. It is not the
status of the subscription. When that payment fails, the subscription
stays active on its current plan. To try again, call this endpoint
again to get a new link. The new plan can apply after the redirect,
when the payment webhook arrives.
응답
Subscription plan changed. A link request can return checkout details. A pending plan change applies after payment succeeds.
Handles for a hosted checkout page that settles a plan change.
The four fields repeat UpdatePaymentMethodResponse and a subset of
CreateSubscriptionResponse. A shared type would rename the generated SDK
types for all three routes, so each route keeps its own.