Stripe Setup
Laratic uses Stripe via Laravel Cashier (Stripe) for subscriptions and one-time payments. Most of the things you need fot the Stripe has already been configured for you, you just need to create a Stripe account and add your keys to the .env file.
1. Create a Stripe Account (Test Mode)
Create a Stripe account and make sure you are in Test mode while setting things up.
2. Add Environment Variables
Add your Stripe keys and webhook secret to your .env file:
STRIPE_KEY=pk_test_XXXXXXXXXXXXXXXXXXXXXXXX
STRIPE_SECRET=sk_test_XXXXXXXXXXXXXXXXXXXXXXXX
STRIPE_WEBHOOK_SECRET=whsec_XXXXXXXXXXXXXXXXXXXXXXXX
After updating environment variables, clear and cache configuration:
php artisan config:clear
php artisan config:cache
3. Stripe Webhook Endpoint
Cashier registers the Stripe webhook endpoint at:
POST /stripe/webhook
CSRF
This project already excludes stripe/* from CSRF validation in bootstrap/app.php,
so Stripe can call the webhook endpoint.
Continue with Stripe Webhooks to configure and test events end-to-end.
4. Go Live
When you are ready to go live:
- Switch to Live mode in Stripe.
- Replace
STRIPE_KEY/STRIPE_SECRETwith live keys. - Create a live webhook endpoint and set
STRIPE_WEBHOOK_SECRETto the live signing secret.