Skip to content

Payments Setup

Fresh

Source: shipfa.st/docs/features/payments

Stripe Setup

  1. Create account on Stripe and activate payments
  2. Settings > Public Details: add website URL
  3. Settings > Branding: add logo and colors
  4. Settings > Customer Emails: enable for successful payments and refunds
  5. Settings > Customer Portal: activate link
  6. Fraud Prevention > Rules: enable 3DS rules, block on CVC failure
  7. Turn ON Test Mode
  8. Create a product, copy price ID to config.stripe.plans[0].priceId
  9. Developers: copy public and private keys to .env.local

Local Webhook Setup

bash
stripe listen --forward-to localhost:3000/api/webhook/stripe

Copy the signing secret to STRIPE_WEBHOOK_SECRET in .env.local.

Production Setup

  1. Turn OFF Test Mode
  2. Update keys in production environment variables
  3. Create webhook endpoint: yourdomain.com/api/webhook/stripe
  4. Select checkout.session.completed event
  5. 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 (or has_access in Supabase) boolean
  • Can be extended: send emails, add credits, etc.

Account Management

javascript
<ButtonAccount />  // Cancel, update card, view invoices

See Also