We have tiers in Stripe and a member_plan schema extending recurring_plan:base_plan. How do we get from "Subscribe" to an active plan?
Starting a subscription with Stripe Checkout
Common question, written up by the Supero team.
1 answer
Create the subscriber's records first: the member_plan (it starts inactive) and, if you gate access, a membership record (starts pending). Then create a checkout session in subscription mode. Pass a Stripe Price ID, so the price comes from Stripe rather than from your page, and pass the plan's uuid as client_reference_id:
{"service_id": "stripe_checkout", "operation": "create_checkout_session",
"input": {"mode": "subscription", "price_id": "price_pro_monthly", "interval": "month",
"success_url": "https://acme-corp.supero.live/welcome?session_id={CHECKOUT_SESSION_ID}",
"cancel_url": "https://acme-corp.supero.live/pricing",
"customer_email": "jamie@example.com", "client_reference_id": "<member_plan uuid>"}}Redirect the customer to output.checkout_url. When the Stripe webhook (verified with stripe_webhook_secret) reports the completed session, look up the plan by client_reference_id and call start_plan and enroll_member together, so billing and access start at the same moment. Do the activation in the webhook handler; the success page is only for showing the customer a confirmation.
Your answer
Know the answer? Sign in to post it. It takes an email address and a 6-digit code.
Sign in to answer