Documentation Index
Fetch the complete documentation index at: https://docs.mlm-platform.com/llms.txt
Use this file to discover all available pages before exploring further.
Webhooks
The MLM Platform uses Stripe webhooks to receive real-time notifications about subscription and payment events.Overview
When events occur in Stripe (e.g., subscription created, payment succeeded), Stripe sends webhook events to the MLM Platform, which then processes them to:- Create commission entries for purchases
- Update subscription statuses
- Track payment lifecycle events
Setting Up Webhooks
Step 1: Get Your Webhook Endpoint
Your Stripe webhook endpoint is:Step 2: Configure in Stripe Dashboard
- Go to Stripe Dashboard
- Click Add endpoint
- Enter your webhook URL
- Select events to listen for (see below)
- Click Add endpoint
- Copy the Signing secret
Step 3: Save the Webhook Secret
In the MLM Platform Admin Dashboard:- Navigate to Settings > Integrations > Stripe
- Enter the webhook signing secret
- Click Save
Supported Events
| Event | Description | Action |
|---|---|---|
checkout.session.completed | Checkout completed | Creates commission entries |
invoice.paid | Invoice payment succeeded | Records purchase event |
customer.subscription.created | New subscription | Creates subscription record |
customer.subscription.updated | Subscription changed | Updates subscription status |
customer.subscription.deleted | Subscription cancelled | Marks subscription inactive |
Webhook Signature Verification
All webhook requests are verified using Stripe’s signature verification:Idempotent Handling
Stripe may send the same event multiple times. Handle this by:- Storing processed event IDs
- Checking before processing
Retry Behavior
Stripe retries failed webhook deliveries:| Attempt | Delay |
|---|---|
| 1 | Immediate |
| 2 | 5 minutes |
| 3 | 30 minutes |
| 4 | 2 hours |
| 5 | 5 hours |
| 6 | 10 hours |
| 7+ | 24 hours (up to 3 days) |
Return a 2xx status code quickly to acknowledge receipt. Process events asynchronously if needed.
Testing Webhooks
Using Stripe CLI
Using Sandbox Environment
- Use Stripe test mode
- Use sandbox API keys
- Create test subscriptions with test cards
4242 4242 4242 4242- Succeeds4000 0000 0000 0002- Declines
Troubleshooting
Webhook Not Received
- Check endpoint URL is correct
- Verify webhook is enabled in Stripe
- Check Stripe webhook logs for errors
- Ensure firewall allows Stripe IPs
Signature Verification Failed
- Verify webhook secret is correct
- Ensure raw request body is used (not parsed JSON)
- Check for proxy modifications to headers
Event Processing Failed
- Check MLM Platform logs
- Verify user exists for the customer
- Check commission rules are configured