1. Create your catalog
Create a product for the plan and a recurring price for its billing interval. Add coupons and tax settings where applicable. Keep the price interval and amount immutable for existing subscribers. Create another price when the plan changes materially and use an explicit plan-change operation.2. Create or find a customer
Use a stable customer record for the account that owns access. Store your internal account ID in metadata.3. Start the subscription
Create a subscription with the customer, price, optional trial, discount, and return URLs. Use an idempotency key so a network retry cannot create a second subscription. For a customer who must complete payment, create the related checkout flow and keep the subscriptionincomplete or otherwise pending until the first invoice is confirmed. Persist your account ID in metadata and store the subscription and invoice IDs.