INTEGRATION GUIDE | STRIPE & POSTHOG SETUP
Stripe App & PostHog Integration Reference
Connect your product usage stream from PostHog or your backend so RevGuard can automatically stop unpaid usage and prepare Stripe dispute evidence.
STRIPE DASHBOARD DRAWER & API INTEGRATION
// 1. Check Customer Protection Status (stripe.dashboard.customer.detail)
const cusRes = await fetch(
"https://api.revclamp.com/v1/stripe/customer-drawer?customer_id=" + encodeURIComponent(customerId),
{ headers: { "X-RevGuard-Tenant-Key": "<YOUR_TENANT_KEY>" } }
);
const { ok: cusOk, drawer: customerDrawer } = await cusRes.json();
// 2. Stage Chargeback Evidence Draft (stripe.dashboard.dispute.detail)
const dispRes = await fetch("https://api.revclamp.com/v1/stripe/dispute-drawer", {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-RevGuard-Tenant-Key": "<YOUR_TENANT_KEY>"
},
body: JSON.stringify({ existingDispute, expectedCustomerId: customerId, usageEvents })
});
const { ok: dispOk, drawer: disputeDrawer } = await dispRes.json();
PostHog Webhook Settings (Zero-Code)
| Setting | Value to Enter |
|---|---|
| Webhook Destination URL | https://api.revclamp.com/v1/events/ingest |
| HTTP Method | POST |
| Authentication Header | X-RevGuard-Tenant-Key: <YOUR_TENANT_KEY> |
| Customer Matching | Matches stripe_customer_id first, or falls back to verified customer email |
| EU Cookieless Privacy Mode | Fully compatible with PostHog $ip: null (no cookies required) |
Automatic Stripe Events Handled by RevGuard
| Stripe Webhook Event | How RevGuard Protects You |
|---|---|
customer.subscription.updated | Syncs plan upgrades, renewals, and status changes in real time |
customer.subscription.deleted | Monitors post-cancellation usage and locks unpaid accounts after your grace period |
invoice.payment_failed | Starts your custom payment-retry grace window before restricting access |
charge.dispute.created | Automatically compiles 90 days of customer usage proof into a Stripe Dispute draft |