Creating Stripe Webhooks
Before You Start 
Prerequisites Checklist
Before setting up your webhook, you need:
- [x] Stripe account set up
- [ ] AWS Lambda function deployed with either:
- Quick Deploy: Docker image pulled and deployed
- Custom Build: Your code built and deployed
- [ ] API Gateway URL from AWS
- [ ] Environment variables configured in Lambda
Not Ready Yet?
If you haven't deployed your Lambda function:
Quick Deploy Path
- Pull the Docker Image
- Deploy to AWS
- Come back here!
Custom Build Path
- Build Your Code
- Deploy to AWS
- Come back here!
Keep This Tab Open!
If you need to complete the prerequisites, bookmark this page - you'll need it after deploying your Lambda function!
Creating Stripe Webhooks
What are Webhooks? 
Think of webhooks as a "notification system" for your arcade cabinet. When someone makes a payment:
- Stripe processes the payment
- Stripe sends a message to your system
- Your system adds credits to the cabinet
Real World Example
It's like when you order food delivery:
- You pay on the app
- The restaurant gets notified
- They start making your food!
Why Do We Need Webhooks? 
Webhooks are crucial for your arcade cabinet because they:
- Tell your system when a payment succeeds
- Help prevent cheating or errors
- Enable automatic credit adding
- Keep payment processing secure
Setting Up Your Webhook 
1. Find Your API URL
First, you'll need your AWS API Gateway URL. It looks like:
Don't Have This Yet?
If you haven't set up AWS yet, bookmark this page and come back after completing the AWS Setup!
2. Create the Webhook
-
In your Stripe Dashboard:
- Go to "Developers" โ "Webhooks"
- Click "Add endpoint"
-
Configure Your Endpoint:
- URL: Your API URL +
/addCredit
- Description: "Arcade Cabinet Payments"
- Click "Select events"
- URL: Your API URL +
-
Select Events:
- Expand "Checkout"
- Check
checkout.session.completed
- Click "Add events"
[!INSERT SCREENSHOT: Stripe webhook configuration page with fields highlighted]
3. Save Your Secret
After creating the webhook:
- Look for "Signing secret"
- Click "Reveal"
- Copy the secret (starts with
whsec_
) - Save it somewhere safe!
Keep This Secret!
Your webhook secret is like a password. Never:
- Share it with anyone
- Commit it to code
- Post it online
Testing Your Webhook 
1. Install Stripe CLI
- Download from Stripe CLI Releases
- Add to your system PATH
2. Test Locally
-
Login to Stripe:
-
Start webhook forwarding:
-
In a new terminal, send a test event:
3. Verify It Works
Look for these signs of success:
- Terminal shows "webhook received"
- Your system logs show the event
- Test credits appear correctly
Common Issues 
Webhook Not Working?
-
Check Your URL:
- Is it spelled correctly?
- Did you add
/addCredit
at the end? - Is your API Gateway running?
-
Verify Your Secret:
- Is it set in your environment variables?
- Did you copy it correctly?
- Are you using the right secret for test/live mode?
-
Test Event Problems:
- Are you selecting the right event type?
- Is your system running when testing?
- Can you see the events in Stripe dashboard?
Still Stuck?
- Check our Troubleshooting Guide
- Look at your Lambda logs
- Review Stripe's webhook logs
Going Live 
Before accepting real payments:
-
Update webhook URL:
- Change from localhost to your production URL
- Add new webhook endpoint for live mode
- Get new webhook secret for live mode
-
Set up monitoring:
- Enable webhook monitoring
- Set up failure notifications
- Test with real test payments
Next Steps 
Now that your webhook is set up:
- Save your webhook secret
- Update your environment variables
- Test the complete payment flow
- Monitor for successful operation