Revenue attribution
Whop
Attribute Whop memberships and one-off sales to the visits that earned them.
1. Create a key
In Settings → Revenue, choose Whop and paste:
Company API key: Whop → Developer → API keys, with payment:basic:read and member:email:read.
Company ID: Your biz_… ID. Optional when the key belongs to one company.
Calmstats only reads payments. It can't charge, refund or change anything in your account.
2. Add the webhook
Copy the webhook endpoint shown in Settings → Revenue and add it in Whop with these events:
payment.succeeded, refund.created, refund.updated
Webhooks make payments appear right away. Without them, payments still arrive with the daily sync.
3. Pass the visitor to checkout
JavaScriptconst visitorId = window.calmstats?.getVisitorId(); // Server: create the checkout configuration with the visitor await fetch('https://api.whop.com/api/v1/checkout_configurations', { method: 'POST', headers: { Authorization: `Bearer ${process.env.WHOP_API_KEY}`, 'Content-Type': 'application/json' }, body: JSON.stringify({ plan_id: planId, metadata: { calmstats_visitor_id: visitorId } }), });