Billing Confirmation Page
Billing Confirmation Page
Overview
After completing or cancelling a Stripe checkout session, users are redirected back to the platform at /dashboard/billing. This page confirms the outcome of the checkout and displays the organisation's current subscription plan and status.
Redirect Behaviour
The Stripe checkout flow uses the following return URLs (configured in src/lib/routers/billing.ts):
| Outcome | Redirect URL |
|---|---|
| Success | ${NEXT_PUBLIC_APP_URL}/dashboard/billing?success=true |
| Cancelled | ${NEXT_PUBLIC_APP_URL}/dashboard/billing?canceled=true |
The /dashboard/billing page reads the success and canceled query parameters and renders the appropriate confirmation message for the user.
Confirmation States
Successful Checkout (?success=true)
Displayed when a user completes a Stripe checkout session. Confirms that the subscription has been activated or updated and shows the current plan details.
Cancelled Checkout (?canceled=true)
Displayed when a user cancels out of the Stripe checkout flow before completing payment. No changes are made to the subscription; the page informs the user and shows their existing plan status.
Default View (no query param)
When navigating directly to /dashboard/billing without a query parameter, the page displays the organisation's current subscription plan and status without any checkout confirmation message.
Data Sources
The page fetches live data using two tRPC queries:
billing.getPlans— retrieves the available subscription plans.org.get— retrieves the current organisation record, including its active subscription status.
Environment Variables
The Stripe redirect URLs are constructed using the NEXT_PUBLIC_APP_URL environment variable. Ensure this is set correctly in your deployment environment so redirects resolve to the right host.
NEXT_PUBLIC_APP_URL=https://your-platform-domain.com
File Location
src/app/dashboard/billing/page.tsx