This guide will help you set up real Stripe payments in your CodeConnect application.
- Go to stripe.com and create an account
- Complete the account verification process
- Get your API keys from the Stripe Dashboard
- Log in to your Stripe Dashboard
- Go to Developers → API keys
- Copy your Publishable key and Secret key
- For testing, use the test keys (they start with
pk_test_andsk_test_)
Add these lines to your .env file:
# Stripe Configuration
STRIPE_KEY=pk_test_your_publishable_key_here
STRIPE_SECRET=sk_test_your_secret_key_here
STRIPE_WEBHOOK_SECRET=whsec_your_webhook_secret_here- In your Stripe Dashboard, go to Developers → Webhooks
- Click Add endpoint
- Set the endpoint URL to:
https://yourdomain.com/payments/stripe/webhook - Select these events:
payment_intent.succeededpayment_intent.payment_failed
- Copy the webhook signing secret and add it to your
.envfile
-
Use Stripe's test card numbers:
- Success:
4242 4242 4242 4242 - Decline:
4000 0000 0000 0002 - Requires Authentication:
4000 0025 0000 3155
- Success:
-
Use any future expiry date and any 3-digit CVC
When ready for production:
- Switch to live API keys in your
.envfile - Update webhook endpoints to use your production domain
- Test with real cards
- Never commit your
.envfile to version control - Keep your secret keys secure
- Use HTTPS in production
- Validate webhook signatures
- Check Stripe Dashboard for payment status
- Verify API keys are correct
- Ensure webhook endpoints are accessible
- Check Laravel logs for errors