Appearance
Payments Setup
FreshSource: shipfa.st/docs/features/payments
Stripe Setup
- Create account on Stripe and activate payments
- Settings > Public Details: add website URL
- Settings > Branding: add logo and colors
- Settings > Customer Emails: enable for successful payments and refunds
- Settings > Customer Portal: activate link
- Fraud Prevention > Rules: enable 3DS rules, block on CVC failure
- Turn ON Test Mode
- Create a product, copy price ID to
config.stripe.plans[0].priceId - Developers: copy public and private keys to
.env.local
Local Webhook Setup
bash
stripe listen --forward-to localhost:3000/api/webhook/stripeCopy the signing secret to STRIPE_WEBHOOK_SECRET in .env.local.
Production Setup
- Turn OFF Test Mode
- Update keys in production environment variables
- Create webhook endpoint:
yourdomain.com/api/webhook/stripe - Select
checkout.session.completedevent - Copy signing secret to production
STRIPE_WEBHOOK_SECRET
Checkout Component
javascript
<ButtonCheckout mode="subscription" priceId={config.stripe.plans[0].priceId} />Webhook Logic
The /api/webhook/stripe endpoint:
- Listens to Stripe events
- Sets
hasAccess(orhas_accessin Supabase) boolean - Can be extended: send emails, add credits, etc.
Account Management
javascript
<ButtonAccount /> // Cancel, update card, view invoices