This endpoint requires a valid Bearer token. Unauthenticated requests return 401 Unauthorized.
Creates a Stripe Checkout Session for the authenticated user and returns a short-lived redirect URL. Once the user completes payment on the Stripe-hosted page, their account is automatically upgraded to Pro via the webhook handler.
The checkout session is created for a monthly Pro subscription.
Promotion codes are accepted on the Stripe-hosted page.
After a successful payment, Stripe fires a checkout.session.completed webhook event. The webhook handler upgrades the user’s plan in the database — no action is needed on the client beyond redirecting the user.
On cancellation, Stripe redirects the user to the frontend /payment/cancel page. No charge is made.
The returned url is single-use. Do not cache or reuse it. If the user navigates away without completing payment, call this endpoint again to get a fresh URL.
Call POST /api/payments/create-checkout with the user’s Bearer token.
2
Redirect the user
Redirect the browser to the url returned in the response body.
3
User completes payment
Stripe handles card collection and 3DS authentication on its hosted page.
4
Webhook upgrades the account
Stripe sends a checkout.session.completed event to POST /api/payments/webhook. The server upgrades the user’s plan to Pro and sets subscription period dates.
5
User lands on success page
Stripe redirects the user to /payment/success?session_id=... on the frontend.