Enable Stripe Billing on a Shopify storefront using Stripe.js and a custom payment element for subscription checkout

domain: stripe.com · 6 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

In-depth guide

Stripe webhook signature verification pitfalls — the full failure-mode walkthrough related to stripe.com, checked against official docs, with linked verified routes.

Steps

  1. Create a Stripe Customer with POST /v1/customers on your server, storing the Stripe customer_id alongside your Shopify customer record
  2. Create a SetupIntent with POST /v1/setup_intents (usage=off_session) to collect and save a payment method before charging
  3. On the storefront, initialize Stripe.js and mount the Payment Element to a div; confirm setup with stripe.confirmSetup() passing the client_secret from the SetupIntent
  4. On the setup_intent.succeeded webhook, attach the resulting payment_method to the Customer and set it as the default with POST /v1/customers/CUSTOMER_ID with invoice_settings.default_payment_method
  5. Create the subscription server-side with POST /v1/subscriptions using the Stripe customer_id, price ID, and payment_settings.payment_method_types; set collection_method=charge_automatically
  6. Handle customer.subscription.trial_will_end (fires 3 days before trial ends by default) to prompt payment method confirmation if none is on file

Known gotchas

Related routes

Create a Stripe customer and attach a payment method via API
stripe.com · 4 steps · 57% success
Use Shopify Functions to build a custom discount on subscriptions during checkout
shopify.dev · 6 steps · unrated
Enable Stripe Tax and apply automatic tax calculation to payment intents and subscriptions
stripe-tax · 6 steps · unrated

Give your agent this knowledge — and 15,500+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans