Stripe Webhook Processor
Process Stripe payment events with AI — auto-classify transactions, detect anomalies, and trigger actions using MCP tools.
What You’ll Build
A smart webhook that:
- Receives Stripe payment events (checkout, subscription, invoice)
- Uses AI to classify and route each event
- Executes actions via MCP tools (update CRM, send notifications, create tickets)
- Logs all actions with full audit trail
Step 1: Create the Smart Webhook
Dashboard → Smart Webhooks → Create
{
"name": "Stripe Payment Processor",
"workspace_id": "your-workspace-id",
"instructions": "Process Stripe payment events. For successful payments: update the CRM contact and send a thank-you notification. For failed payments: create a support ticket and notify the billing team. For subscription cancellations: tag the customer as 'churned' and trigger the win-back workflow.",
"source_type": "stripe",
"source_events": [
"checkout.session.completed",
"invoice.payment_failed",
"customer.subscription.deleted"
],
"signing_secret": "whsec_your_stripe_webhook_secret",
"llm_model": "gpt-4o-mini"
}Step 2: Get Your Webhook URL
After creation, you’ll receive a webhook URL:
https://api.aerostack.dev/api/webhooks/smart/stripe-payment-processorStep 3: Configure in Stripe Dashboard
- Go to Stripe Dashboard → Developers → Webhooks
- Click Add endpoint
- Paste the webhook URL
- Select events:
checkout.session.completed,invoice.payment_failed,customer.subscription.deleted - Copy the signing secret and update your webhook config
⚠️
Always set a signing_secret for production webhooks. Without it, anyone who discovers your webhook URL can send fake events.
Step 4: Add MCP Tools
Add these MCP servers to your workspace:
- CRM MCP — To update customer records
- Notifications MCP — To send emails/Slack messages
- Ticketing MCP — To create support tickets
How It Works
When Stripe sends a webhook:
Stripe Event (checkout.session.completed)
→ Aerostack verifies HMAC signature (X-Hub-Signature-256)
→ Checks event type matches source_events filter
→ Builds AI prompt with event payload + your instructions
→ AI analyzes event and decides which tools to call
→ Executes: update_crm_contact, send_notification
→ Logs the run with actions taken
→ Returns { ok: true } to StripeViewing Runs
Check execution history in the dashboard or via API:
curl https://api.aerostack.dev/api/smart-webhooks/{id}/runs \
-H "Authorization: Bearer YOUR_JWT"{
"runs": [
{
"id": "whr_abc123",
"event_type": "checkout.session.completed",
"actions_taken": "Updated CRM contact for customer cus_xxx. Sent thank-you email.",
"tool_calls": 2,
"cost_cents": 3,
"latency_ms": 2100,
"status": "success"
}
]
}Event Filtering
The source_events array controls which events get processed. Unmatched events are silently accepted (Stripe gets a 200 OK) but no AI processing occurs.
Use ["*"] to process all events, or be specific:
{
"source_events": [
"checkout.session.completed",
"invoice.payment_failed",
"customer.subscription.deleted",
"customer.subscription.updated"
]
}