Switching plans
For example, upgrading from Pro to Enterprise:app/components/upgrade-button.tsx
Switching plans requires the customer to have a default payment method saved (see Billing & Invoices). The switch happens immediately and the charge is prorated automatically. You cannot switch to an add-on, and a free trial on the destination product is not applied.
Canceling a subscription
cancelSubscription is called on the app instance rather than the user object:
- Client Component
- Server
cancelSubscription is immediate for live, processor-backed subscriptions — access ends now. Subscriptions created in test mode or via grantProduct (no processor subscription) are marked to end at the current period end, so access continues until then.
Pass subscriptionId when canceling an inline product that has no catalog productId. One-time purchases cannot be canceled; refund them instead.
Reading subscription state
Each subscription product returned byuseProducts / listProducts carries a subscription field with the current period end and cancellation state, plus switchOptions listing the other products in the same product line the customer can switch to.
Related
- Checkout & Purchases - start a subscription
- Billing & Invoices - payment methods and billing history
- Refunds - reverse a charge and optionally end the subscription