Table of Contents
What you'll ship
A "Buy" button on your Fabricate app that opens a Stripe-hosted checkout page, takes a card, and emails the customer a receipt. You can charge for a one-time purchase, a paid download, or pre-orders for a launch.
Subscriptions and recurring billing use the same flow with one extra prompt — that's the next playbook in this series.
Before you start
You need a deployed Fabricate app on the Pro plan or higher (export + secret management). If you're on Free, this still works in test mode but you can't add live keys.
If you don't have a Fabricate app yet, start with the prompt: "Build a one-page paid digital download site with email capture." That gives you exactly what you need to plug Stripe into.
Step 1 · Stripe account (5 min)
Go to dashboard.stripe.com and sign up (or sign in). Skip the business-info wizard for now — you can complete it after your first test charge.
In the Stripe dashboard, toggle the Test mode switch in the top right. You'll work in test mode first; flipping to live is one config swap at the end.
Open Developers → API keys. Copy the Publishable key (starts with pk_test_) and the Secret key (starts with sk_test_). Keep this tab open.
Ready to Build?
Start building your full-stack application with Fabricate. Free tier available — no credit card required.
Start Building FreeStep 2 · Tell Fabricate to wire Stripe (5 min)
In your Fabricate chat, paste the prompt below. Replace the product name and price with your own.
Add a Stripe checkout button to the homepage that charges $19 USD for "Indie Founder Toolkit" (one-time purchase). Use STRIPE_SECRET_KEY and STRIPE_PUBLISHABLE_KEY from env. After successful payment, redirect to a /thank-you page with the order id.
Fabricate will scaffold a server-side checkout-session endpoint, drop a Buy button onto the homepage, and add the /thank-you route. The whole turn usually costs 3–6 credits.
Step 3 · Drop in your test keys (5 min)
Open the Settings → Secrets panel for your project. Add two entries:
STRIPE_SECRET_KEY = your sk_test_… key
STRIPE_PUBLISHABLE_KEY = your pk_test_… key
Hit Save. Fabricate redeploys your worker with the new secrets — usually 10–15 seconds. The keys live on the server only; they're never bundled into the client.
Never paste a secret key into a chat message or commit it to git. Always use the Secrets panel.
Step 4 · Test the checkout (5 min)
Open your deployed app and click the Buy button. Stripe Checkout should open. Use one of these test cards:
• 4242 4242 4242 4242 — succeeds
• 4000 0000 0000 0002 — declines (good for testing the failure path)
• 4000 0027 6000 3184 — requires 3D Secure auth
Any future expiry date and any 3-digit CVC works. After the payment, you should land on /thank-you with the order id, and the charge should appear in the Stripe dashboard under Payments.
If the redirect fails, check the Network tab for the /api/checkout response. 99% of the time it's a missing or mistyped key in Step 3.
Ready to Build?
Start building your full-stack application with Fabricate. Free tier available — no credit card required.
Start Building FreeStep 5 · Go live (10 min)
Back in the Stripe dashboard, toggle off Test mode and complete the business-info wizard (legal name, country, bank account). Stripe needs this to release real funds to you.
Once approved, copy your live keys (pk_live_… and sk_live_…) and replace them in the Fabricate Secrets panel — same field names. Save.
Click Buy on your live app and run one real $1 test purchase against your own card. Refund it from the Stripe dashboard if you don't want to keep the charge. Done — you can take payments.
When things break
Three common failures, in order of frequency:
1. The Buy button does nothing. → The /api/checkout endpoint is returning 500. Open browser DevTools → Network. The most common cause is a typo in STRIPE_SECRET_KEY or copying the publishable key into the secret slot.
2. Stripe says "No such price". → Fabricate creates the price object on first request. Click Buy once to trigger it; subsequent clicks will work.
3. The /thank-you page says "Order not found". → The success_url query string is missing the session id. Ask Fabricate: "Pass session_id from Stripe Checkout to /thank-you and show the order id from the session." One credit, done.
If Fabricate ever "breaks" something while wiring Stripe, hit Restore in the project sidebar. We don't charge credits for AI errors.
What's next
You now have a paid app. Three obvious next moves:
• Add subscriptions — one prompt, covered in "Add Stripe Subscriptions to any Fabricate app" (next in this playbook series).
• Add an upsell on the /thank-you page — "Buy another for 50% off" usually lifts cart value 10–20%.
• Wire a webhook so you can fulfil digital downloads automatically. Prompt: "Add a Stripe webhook at /api/stripe/webhook that emails the buyer a download link via Resend on checkout.session.completed."
Ready to Build?
Start building your full-stack application with Fabricate. Free tier available — no credit card required.
Start Building FreeFrequently Asked Questions
Do I need to write any code?
No. Every step is either a click in Stripe or a prompt in Fabricate. Fabricate writes the server-side checkout-session endpoint, the Buy button, and the success page for you.
Can I do this on the Free plan?
You can wire it up and test with Stripe test cards, but live keys + custom domain require Pro ($25/mo). Most people upgrade right after their first test charge works.
Where do my Stripe keys live? Are they safe?
In the Fabricate worker secrets — server-side only. They never appear in the client bundle, in your git history, or in chat. You can rotate them in the Stripe dashboard at any time.
What about EU VAT, sales tax, or invoicing?
Stripe Tax handles VAT and US sales tax automatically — enable it in the Stripe dashboard, then prompt Fabricate: "Enable Stripe Tax on the checkout session." Invoicing is one extra prompt: "Send a Stripe invoice on every successful checkout."
Will Fabricate let me export the Stripe code?
Yes on Pro and Scale. Push the project to GitHub or download as a ZIP — the Stripe integration is plain TypeScript and you own all of it.