Trigger Your AI Agent from a Stripe Webhook in 10 Minutes
Every time a payment hits your Stripe account, something should happen. A receipt should go out. Your CRM should update. If the amount is weird, someone should look at it. Most teams handle this with a tangled mess of Stripe webhook handlers, queue workers, and cron jobs. I'm going to show you how to replace that with a single ClawJolt trigger connected to your OpenClaw agent.
Total setup time: about 10 minutes if you already have a Stripe account and a running OpenClaw agent.
## Step 1: Create a webhook endpoint in Stripe
Go to your Stripe Dashboard. Navigate to Developers, then Webhooks. Click "Add endpoint."
For the endpoint URL, use your ClawJolt relay URL. It looks like this: `https://triggers.clawjolt.com/stripe/your-project-id`. You get this URL from your ClawJolt dashboard under Connectors > Stripe.
For events, select the ones you care about. For this walkthrough, pick these three:
- `payment_intent.succeeded` -- fires when a payment goes through - `charge.dispute.created` -- fires when a customer disputes a charge - `customer.subscription.created` -- fires when someone starts a subscription
Save the endpoint. Stripe gives you a signing secret. Copy it. You'll paste it into ClawJolt in the next step.
## Step 2: Connect Stripe in ClawJolt
In your ClawJolt dashboard, go to Connectors and click Stripe. Paste the signing secret from step 1. ClawJolt uses this to verify that incoming webhooks are actually from Stripe and not some random POST request from a bot.
Hit "Verify Connection." ClawJolt sends a test event through the pipeline and confirms everything is wired up. If it fails, the most common problem is a copy-paste error on the signing secret. Double-check there are no trailing spaces.
## Step 3: Define your trigger rules
This is where it gets interesting. You now have Stripe events flowing into ClawJolt. Next, you tell it what to do with them.
**Rule 1: Send a personalized receipt.** Trigger: `payment_intent.succeeded`. Condition: amount greater than 0 (filters out $0 invoice payments). Action: your OpenClaw agent drafts and sends a receipt email using the customer's name, the amount, and a brief thank-you note. The agent pulls the customer's email from the Stripe event payload, so no CRM lookup needed.
**Rule 2: Update your CRM.** Trigger: `customer.subscription.created`. Condition: none (fire on every new subscription). Action: your agent creates or updates a contact in your CRM with the subscription plan, start date, and MRR value. If you're using HubSpot, the agent uses the HubSpot skill. For Notion databases, the Notion skill. The agent figures out the right format from context.
**Rule 3: Flag suspicious charges.** Trigger: `charge.dispute.created`. Condition: none (every dispute matters). Action: your agent sends an urgent Slack message to your finance channel with the dispute details, the customer's history, and a suggested response. It also creates a task in your project tracker so the dispute doesn't fall through the cracks.
## Step 4: Test with Stripe's test mode
Before you go live, test everything. Stripe's test mode lets you simulate events without real money changing hands.
In your Stripe Dashboard, switch to test mode. Go to Developers > Webhooks, find your endpoint, and click "Send test webhook." Pick `payment_intent.succeeded` and send it.
Watch the ClawJolt trigger history. You should see the event arrive, your rule match, and your agent execute the action within a few seconds. If the receipt email went out (check your test inbox), you're good. Repeat for the other two rules.
## Step 5: Go live
Switch Stripe back to live mode. Your webhook endpoint URL stays the same. ClawJolt handles both test and live events on the same endpoint, tagged so you can tell them apart in the logs.
Monitor the trigger history closely for the first day. Look for events that fire but don't match any rule (you might need to add conditions), actions that fail (usually an auth issue with the downstream service), and unexpected event types (Stripe sends more event types than most people expect).
## Three agent actions worth building
Beyond the basics above, here are three agent actions I've seen work well with Stripe triggers:
**Churn prediction ping.** When a subscription payment fails (`invoice.payment_failed`), have your agent check the customer's support ticket history and usage patterns, then draft a personalized retention email before the subscription actually cancels. Way more effective than the generic "your payment failed" email.
**Revenue milestone alerts.** Set a trigger on `payment_intent.succeeded` with a running total condition. When monthly revenue crosses a threshold you set (first $10k month, first $50k month), the agent posts a celebration to your team channel with the exact transaction that pushed you over. Small thing, but good for morale.
**Refund auto-processing.** For amounts under a threshold (say $25), have the agent automatically process the refund and send a friendly email, no human intervention needed. For larger amounts, it creates a review task instead. This alone can save hours per week if you process a lot of small refunds.
## Common gotchas
**Duplicate events.** Stripe occasionally sends the same event twice. ClawJolt deduplicates by event ID, so your agent won't process the same payment twice. But if you're also running your own webhook handler alongside ClawJolt, you might get double-processing on the other end.
**Event ordering.** Stripe doesn't guarantee event order. A `customer.subscription.created` event might arrive before the `customer.created` event. If your agent action depends on the customer existing in your CRM, add a small retry delay or check-and-wait logic.
**Payload size.** Most Stripe events are small (a few KB). But invoice events with many line items can be larger. If your agent's context window is tight, consider having the trigger extract only the fields you need rather than passing the full payload.