Revenue attribution

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.

  1. 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.succeeded and refund.succeeded.

  2. Paste the signing key in SuprAnalytics

    Copy the endpoint's signing key (whsec_…) into Settings → Revenue with Dodo Payments selected, and save.

  3. Pass the visitor id

    Payment links (https://checkout.dodopayments.com/buy/pdt_…) need nothing: when a visitor clicks one, the SuprAnalytics script adds metadata_supr_visitor_id and metadata_supr_session_id, which Dodo stores in the payment's metadata. Links that already have a visitor id are left alone; add supr-dodo="false" to the script to stop it changing links.

    For checkout sessions created on your server, pass the supr_visitor_id cookie 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_amount less tax: 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.
Testing

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