Skip to content

Payment providers

Dodo Payments revenue attribution with CrispStats

Connect Dodo Payments in CrispStats by pasting an API key, then put the visitor id in the payment's or subscription's metadata as crispstats_visitor_id. CrispStats imports your past payments and refunds, reads each new one back from Dodo's API, and credits payments, subscription charges, refunds and lost disputes to the visit that led to them.

Updated

Set up CrispStats on Dodo Payments

  1. 01

    Step 1: Open the Dodo Payments panel

    The CrispStats script must already run on your site. Open the site’s Settings, select Integrations, choose Connect a payment provider and pick Dodo Payments. You need permission to manage the site’s settings.

  2. 02

    Step 2: Create an API key in Dodo Payments

    Select Open API keys in Dodo Payments, then open Developer, API keys and choose Create new key. Give it the permissions below and leave everything else at None. Webhooks: Write is optional: with it, sales show up the moment they happen. Copy the key: it starts with dodo_live_, or dodo_test_ in test mode.

    Payments: ReadRefunds: ReadSubscriptions: ReadProducts: ReadWebhooks: Write   (optional: sales the moment they happen)
  3. 03

    Step 3: Paste the key and connect

    Paste the key and select Connect Dodo Payments. CrispStats checks it with Dodo, saves it encrypted, creates a webhook when the key allows it, and starts importing past payments and refunds.

  4. 04

    Step 4: Pass the visitor id at checkout

    Call crispstats.id() in the browser before the visitor leaves for checkout and add it to the metadata of the payment, subscription or checkout session you create. Call it in the click handler, not on your server: the id belongs to the browser that asks.

    checkout.js
    // In the browser, before you send the visitor to checkoutconst visitorId = await crispstats.id();// On your server, in the body of the payment or subscription you createconst body = {// ...your product cart and customermetadata: { crispstats_visitor_id: visitorId },};

Check that it works

The Dodo Payments row in Settings, Integrations shows Connected, whether it is live, and when it last updated. Make a purchase from a page with the script: it appears under Payments on the Revenue screen with the source of that visit. If the key stops working or loses a permission, the row says so and names the way out.

Payments through Dodo Payments on the demo site, Quillbook, on generated traffic. Prices are the demo company's. Open it in the demo 
  • What you get

    • Dodo Payments revenue by source, channel, campaign and landing page, credited to the first touch known for the customer.
    • Each payment read back from Dodo’s API before it counts as verified revenue: one-time payments, first subscription charges and renewals kept apart.
    • Refunds, and disputes the business lost or accepted, recorded as negative payments that never exceed the payment.
    • Past payments and refunds imported when you connect, so revenue and MRR cover your whole history.
    • Customer email stored only hashed and masked; renewals without a visitor id take the attribution of the customer’s earliest attributed payment.
  • Notes and limits

    • With Webhooks: Write, Dodo sends each payment within seconds and CrispStats checks every 15 minutes as a safety net. Without it, CrispStats reads new payments and refunds every 2 minutes, so a sale appears within 2 minutes. A lost dispute without the webhook can take up to a day.
    • Dodo payments are stored without a product name. The payment’s metadata is merged over the customer’s metadata, so an id on the customer also counts.
    • A test key connects in test mode once you choose Connect in test mode. Test payments show with a Test tag on the Revenue screen and are kept out of revenue, MRR and every total.
    • A payment without a visitor id is still recorded and counted in revenue, MRR and every total. It is left out of the source, campaign and channel breakdowns rather than filed under Direct.
    • Connections made earlier with a webhook you added by hand keep working, but cannot import history or verify payments. Connect again with a key to add both.
    • CrispStats does not calculate churn or expansion. Dodo Payments, as merchant of record, stays the source of truth for billing, tax and payouts.

The docs page covers the optional steps this guide leaves out.

Setup questions. Straight answers.

What people ask before they connect it.

  • Read on Payments, Refunds, Subscriptions and Products. Write on Webhooks is optional and lets the webhook be created and deleted for you. Leave Customers and everything else at None. The key never moves money and is never shown again.

  • Yes. A renewal carries the subscription's metadata, and one without a visitor id takes the attribution of the same customer's earliest attributed payment, matched by a hash of the email.

  • Yes. Connecting with a key starts the import at once: every succeeded payment and refund since your first.

  • CrispStats deletes its webhook in Dodo Payments and destroys the saved key. Payments already recorded stay in your reports.

  • Yes, history import included. Every feature is on every plan and in the 14-day free trial, and payments are kept on every plan.

Not answered here? Write to hello@crispstats.com

Go further

Related

Your traffic, crisp and clear

One script, no cookies, and every feature from the first day. Set up takes about as long as pasting a snippet.