Switch subscription plan

Moves a subscription to another product plan of the same project. The switch does not charge the customer: there is no immediate charge, no proration, and no credit or refund for the unused part of the current billing period. The next charge, scheduled for the date returned in nextPayment, is the full price of the new plan; after that charge, billing follows the new plan's billing cycle. For an ACTIVE subscription, nextPayment is unchanged.

The switch deactivates the current subscription and creates a new one. Use toSubscriptionId for all later requests.

Only ACTIVE, TRIAL and DUNNING_PERIOD subscriptions can be switched; other states return 400.

Request signature

Sign only these fields, in order:

projectId → subscriptionId → subscriptionProductPlanId

See Signing requests for the HMAC-SHA-256 algorithm and code examples.

Recent Requests
Log in to see full request history
TimeStatusUser Agent
Retrieving recent requests…
LoadingLoading…

Billing

Switching a plan does not charge the customer. There is no immediate charge, no proration, and no credit or refund for the unused part of the current billing period.

The next charge is scheduled for the date returned in nextPayment. That charge is the full price of the new plan, in the subscription's currency and country price tier. After that charge, billing follows the new plan's billing cycle.

The next payment date depends on the subscription's state at the time of the switch:

StateAfter the switchNext payment
ACTIVEACTIVEUnchanged: the date the customer would have been charged on the old plan.
TRIAL, and the new plan has a trialTRIALThe end of the new plan's trial, counted from the start of the current trial (not from the switch).
TRIAL, and the new plan has no trialACTIVEUnchanged: the end of the current trial.
DUNNING_PERIODDUNNING_PERIODThe next retry under the new plan's dunning settings. The dunning period keeps its original start date, and its end is recalculated with the new plan's dunning settings. Retries charge the new plan's price.

The switch is rejected with 400 Bad Request when:

  • the subscription is in any other state, for example PAUSED, CANCELLED or DEACTIVATED, or while a payment for it is being processed;
  • the subscription is in its dunning period and the new plan has no dunning settings, or no retry fits within the dunning period recalculated for the new plan.

Example: monthly to annual. A customer on a monthly plan has 10 days left until their next renewal, and you switch them to an annual plan that renews automatically and bills from the date of each charge. Nothing is charged at the switch. 10 days later, the customer is charged the full annual price. If that payment succeeds, the next charge is one year later.

New subscription ID

A plan switch replaces the subscription with a new one:

  • The current subscription is deactivated. It is returned as fromSubscriptionId, and you receive a Subscription deactivated webhook for it.
  • A new subscription is created with a new ID, returned as toSubscriptionId. Use toSubscriptionId for all later requests about this subscription.
  • You receive a Subscription plan changed webhook for the new subscription, with previousSubscriptionId and nextPaymentDate. When the subscription was in its dunning period, you also receive a Subscription dunning period webhook for the new subscription.
  • The customer's saved payment method carries over to the new subscription automatically. It is attached shortly after the switch, not as part of the response.

Price selection and metadata

You can supply currency and subscriptionPlanCountry to select a price for the new plan. When omitted, Truegate reuses the current subscription's values, falling back to the initial subscription payment where needed.

Optional metadata is merged into the subscription's existing metadata. Supplied keys are added or overwritten; omitted keys are preserved. Sending an empty object does not clear existing metadata.

These optional fields are not included in the request signature.

Request signature

Sign only these fields, in order:

projectId → subscriptionId → subscriptionProductPlanId

See Signing requests for the HMAC-SHA-256 algorithm and code example.

Body Params

Switch subscription plan

string
required

Project identifier

string
required

Signed request signature

string
required

Current subscription identifier

string
required

New subscription product plan identifier

string

Currency used to select a price for the new plan. If omitted, the current renewal currency or the initial subscription payment currency is used. Not included in the request signature.

string

Country used to select a price for the new plan. If omitted, the existing subscription or initial payment country selection is reused. Not included in the request signature.

metadata
object

Merged into the existing subscription metadata: supplied keys are added or overwritten; omitted keys are preserved. Not included in the request signature.

Responses

Language
LoadingLoading…
Response
Choose an example:
application/json