Billing
Save a payment method (SetupIntent)
Create a Stripe SetupIntent for adding a card on file without charging it.
POST
Used to enable Add credit (saved card) and auto-topup. Distinct from
Stripe Checkout — Checkout charges
immediately; SetupIntent just saves the card for future charges.
Pass this to Stripe Elements /
stripe.confirmSetup() on the client. The
user enters their card details directly into Stripe’s iframe; we never see
the PAN.Stripe publishable key (
pk_test_… or pk_live_…). Use it to initialize
Stripe.js if you don’t already have it.After confirmation
When the user completes the Stripe Elements flow, Stripe fires asetup_intent.succeeded webhook to our endpoint. The handler saves the
payment_method ID against the user’s row. From that point:
POST /v1/billing/checkoutwith a saved card no longer redirects to Stripe Checkout — it charges the saved card directly via PaymentIntent- Auto-topup is enabled in the dashboard UI
GET /v1/billing/cardreturns the brand and last 4 digits for display