Appearance
Stripe Configuration
This page explains Stripe connectivity for SaasForgeKit.
SaasForgeKit uses:
- Laravel Cashier for subscriptions and checkout
- User model as billable customer (users are Stripe customers)
- Stripe webhooks to keep subscription and invoice events synced locally
1) Configure Stripe environment variables
In your .env:
env
STRIPE_KEY=pk_live_or_test_xxx
STRIPE_SECRET=sk_live_or_test_xxx
STRIPE_WEBHOOK_SECRET=whsec_xxxWhere to get them (Stripe Dashboard):
STRIPE_KEYandSTRIPE_SECRET: Developers -> API keysSTRIPE_WEBHOOK_SECRET: Developers -> Webhooks -> [your endpoint] -> Signing secret
STRIPE_KEY and STRIPE_SECRET are used by Cashier (config/cashier.php). STRIPE_WEBHOOK_SECRET secures webhook signature validation.
2) Configure webhook endpoint in Stripe
Create a webhook endpoint in Stripe dashboard:
text
https://your-domain.com/stripe/webhookWhy this path: Cashier is configured with CASHIER_PATH=stripe (default), so webhook endpoint is /stripe/webhook.
Events to send
To avoid missing anything, use the union of:
- App-specific events (used by SaasForgeKit listener for product/price sync + billing emails):
product.createdproduct.updatedproduct.deletedprice.createdprice.updatedprice.deletedcustomer.subscription.createdcustomer.subscription.updatedcustomer.subscription.deletedinvoice.paidinvoice.payment_failed
- Cashier default events:
customer.updatedcustomer.deletedpayment_method.automatically_updatedinvoice.payment_action_requiredinvoice.payment_succeeded
If you create the endpoint with php artisan cashier:webhook, Cashier will register its defaults automatically.
In SaasForgeKit, make sure the app-specific events above are also included.
After creating webhook endpoint, copy Stripe's signing secret to:
env
STRIPE_WEBHOOK_SECRET=whsec_xxx3) Understand subscription flow
Customer-facing billing routes:
GET /billing(pricing/subscription page)POST /billing/checkout(create Stripe checkout session)POST /billing/portal(open Stripe billing portal)
Important behavior:
- Billable entity is the current authenticated user.
- Checkout success redirects back to
/billingand attempts local subscription sync. - Billing portal is generated via Cashier for the current user.
4) Production checklist
- Stripe keys set correctly (live vs test)
- Webhook endpoint points to production URL
STRIPE_WEBHOOK_SECRETmatches endpoint secret- Queue worker running in production
- Pricing page shows products as expected
- Checkout and portal both work end-to-end
5) Local testing tips
Use test keys in .env and run your app locally. For webhook testing, use Stripe CLI to forward events to local app:
bash
stripe listen --forward-to http://127.0.0.1:8000/stripe/webhookThen copy the CLI signing secret into STRIPE_WEBHOOK_SECRET.