Connect Dodo Payments: setup guide
Add a Dodo Payments webhook, use payment links with no code or pass the visitor id to checkout sessions, and see how revenue, renewals and refunds are counted.
This is the setup. What attribution gives you with Dodo Payments, and how payment links and checkout sessions compare, is on the Dodo Payments revenue attribution page.
- Add a webhook endpoint in Dodo Payments
In the Dodo Payments dashboard, Developer → Webhooks → Add endpoint, with this URL (your website id is in Settings → General):
https://supranalytics.app/api/webhooks/dodo/YOUR_WEBSITE_ID
Subscribe to
payment.succeededandrefund.succeeded. - Paste the signing key in SuprAnalytics
Copy the endpoint's signing key (
whsec_…) into Settings → Revenue with Dodo Payments selected, and save. - Pass the visitor id
Payment links (
https://checkout.dodopayments.com/buy/pdt_…) need nothing: when a visitor clicks one, the SuprAnalytics script addsmetadata_supr_visitor_idandmetadata_supr_session_id, which Dodo stores in the payment's metadata. Links that already have a visitor id are left alone; addsupr-dodo="false"to the script to stop it changing links.For checkout sessions created on your server, pass the
supr_visitor_idcookie as metadata:import DodoPayments from "dodopayments"; const dodo = new DodoPayments({ bearerToken: process.env.DODO_PAYMENTS_API_KEY }); const session = await dodo.checkoutSessions.create({ product_cart: [{ product_id: "pdt_123", quantity: 1 }], return_url: "https://yourdomain.com/thanks", metadata: { supr_visitor_id: req.cookies.supr_visitor_id, supr_session_id: req.cookies.supr_session_id, }, }); res.redirect(303, session.checkout_url);
What SuprAnalytics counts
- Revenue is the payment's
total_amountlesstax: after discounts, before tax. Dodo is the merchant of record, so tax isn't your revenue. Free payments and payment-method updates are skipped. - Renewals: a subscription charge outside a checkout session, or a later charge of a subscription SuprAnalytics has seen, counts as a renewal, credited to the customer's original visitor (through the payment's metadata or Dodo's customer id).
- Refunds: a full refund marks the payment refunded; a partial one lowers it by its pre-tax share. Each refund is applied once.
- Amounts are converted from Dodo's smallest currency unit, including zero- and three-decimal currencies.
- Signatures follow Standard Webhooks and are checked against your signing key; retries are safe.
Test on a second website, not your real one: each website keeps one Dodo signing key, and test payments sent to a real website stay in its revenue (payments can't be deleted). Add a website for your staging site (websites are unlimited), with its own script, point a webhook in Dodo's test mode at that website's URL, paste the test mode's signing key into that website's Settings → Revenue, and pay with a test card.
AI agent or LLM? Read this page as Markdown