Revenue attribution
Stripe
Attribute Stripe Checkout, Payment Links and renewals to the visits that earned them.
1. Create a key
In Settings → Revenue, choose Stripe and paste:
Restricted API key: Stripe → Developers → API keys → Create restricted key, with Read on Charges, Checkout Sessions and Refunds.
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 Stripe with these events:
charge.succeeded, charge.refunded, checkout.session.completed
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(); // Payment Links need nothing: the Calmstats script adds the visitor to // buy.stripe.com links as client_reference_id. // Stripe Checkout from your server: const session = await stripe.checkout.sessions.create({ // ...line_items, mode, success_url client_reference_id: visitorId, metadata: { calmstats_visitor_id: visitorId }, });
Using Stripe Payment Links? There's nothing to add: the script appends the visitor to every buy.stripe.com link on your pages as client_reference_id.