Stripe Payments - Quick Start
1. Get Your API Keys
- Visit Stripe Dashboard
- Toggle Test mode ON (top right)
- Navigate to Developers → API Keys
- Copy both keys:
- Publishable key (starts with
pk_test_) - Secret key (starts with
sk_test_)
- Publishable key (starts with
2. Add to Environment
Create web/.env.local:
# Stripe Test Keys
PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_test_xxxxxxxxxxxxxxxxxxxxx
STRIPE_SECRET_KEY=sk_test_xxxxxxxxxxxxxxxxxxxxx
IMPORTANT: Never commit .env.local to git. No quotes around values.
3. Test Your Integration
Test Cards
| Card Number | Result |
|---|---|
4242 4242 4242 4242 | ✅ Success |
4000 0025 0000 3155 | 🔐 3D Secure |
4000 0000 0000 9995 | ❌ Declined |
All test cards:
- Expiry: Any future date (e.g.,
12/34) - CVC: Any 3 digits (e.g.,
123) - ZIP: Any 5 digits (e.g.,
12345)
Test Flow
- Start dev server:
bun run dev - Visit
/shop/product-landing - Click “Buy Now”
- Use test card:
4242 4242 4242 4242 - Complete checkout
- Verify redirect to thank you page
View test payments: Dashboard → Payments
4. Test vs Live Mode
| Type | When to use | How payments work | Test cards |
|---|---|---|---|
| Test Mode | Development and testing | Simulated - no real money processed | ✅ Use test cards only |
| Live Mode | Production - real customers | Real - card networks process actual payments | ✅ Accept real cards |
5. Go Live
Production Checklist
-
Get Live Keys:
- Toggle Test mode OFF in Stripe Dashboard
- Copy live keys (
pk_live_,sk_live_)
-
Update Environment:
# Production .env PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_live_xxxxxxxxxxxxxxxxxxxxx STRIPE_SECRET_KEY=sk_live_xxxxxxxxxxxxxxxxxxxxx PUBLIC_BASE_URL=https://yourdomain.com -
Verify Settings:
- HTTPS enabled (required)
- Business name configured
- Email receipts enabled
- Stripe account verified
- Test with real card (small amount)
-
Deploy:
bun run build # Deploy to production
Stripe Fees
- 2.9% + $0.30 per successful card charge
- No setup fees, monthly fees, or hidden costs
Security Rules
- ✅ NEVER commit secret keys to git
- ✅ ALWAYS use HTTPS in production
- ✅ ALWAYS validate on server-side
- ✅ ALWAYS verify session on success page
Help
- Test Cards: stripe.com/docs/testing
- Dashboard: dashboard.stripe.com
- Support: support.stripe.com
Ready in 5 minutes. Secure by default. Powered by Stripe.