Demo project showing how to load external scripts (Stripe.js) with TanStack Router head management and build a payment form UI with Stripe Elements.
npm install
cp env.example .env # add your Stripe publishable key
npm run devOpen the URL shown by Vite (usually http://localhost:5173).
VITE_STRIPE_PUBLISHABLE_KEY— your Stripe publishable key (test or live).
This is read inPaymentFormviaimport.meta.env
- Stripe is injected through TanStack Router head config in
app/routes/__root.tsx:head().scriptsaddshttps://js.stripe.com/v3/<HeadContent />renders head/meta/scripts<Scripts />renders any body scripts if added
- Card:
4242 4242 4242 4242 - Expiry: any future date
- CVC: any 3 digits
npm run dev- start Vite dev servernpm run build- type-check + buildnpm run preview- preview the production build