Payments & Checkout
Stripe Checkout integration and payment flow
Payments & Checkout
What's Included
- Stripe Checkout session creation
- Plan listing with pricing display
- Success and cancel payment pages
- Support for both authenticated and guest checkout
Checkout Composable (useCheckout)
const {
createCheckoutSession, // (planId, interval?) → redirects to Stripe
isProcessing, // Ref<boolean>
error // Ref<string | null>
} = useCheckout()
The composable creates a Stripe Checkout session via the backend API and redirects the user to Stripe's hosted checkout page.
Plans Composable (usePlans)
const {
plans, // Ref<Plan[]> — all plans from backend
oneTimePlans, // Computed — filtered for one-time payment plans
isLoading, // boolean
error // Error | null
} = usePlans()
Plans are fetched from /api/v1/plans with SSR caching. The pricing section on the landing page uses this composable.
Checkout Flow
- User views pricing plans on the landing page (
PricingSection.vue) - User clicks "Get Started" on a paid plan
useCheckout.createCheckoutSession()calls the backend- Backend creates a Stripe Checkout session and returns the URL
- User is redirected to Stripe's hosted checkout
- After payment, Stripe redirects to
/payment/successor/payment/cancel
Authenticated vs Guest Checkout
- Authenticated — email is pre-filled,
user_idis included in the session metadata - Guest — Stripe collects the email, user account is created via webhook
Payment Pages
Success Page (/payment/success)
Displayed after a successful Stripe payment. Shows a confirmation message and extracts the session_id from the URL query parameters.
Cancel Page (/payment/cancel)
Displayed when the user cancels the Stripe checkout. Shows a message with a link back to the pricing section.
Pricing Section
The PricingSection component on the landing page:
- Fetches plans via
usePlans() - Renders pricing cards with plan details
- Maps backend plans to Stripe price IDs
- Handles checkout button clicks
- Shows loading skeletons while plans are loading