traffic.cx documentation
Dodo Payments Revenue Attribution Setup
Connect Dodo Payments to traffic.cx with an API key, and pass the visitor's IDs as checkout metadata.
Updated 14 October 2026
traffic.cx reads one-off payments, subscription payments and refunds.
Start with the tracker installation. You need an owner/admin role in traffic.cx and a Dodo Payments account. Use test mode and a separate traffic.cx test site first; imported test payments appear in that site's reports. Connecting creates a webhook in your Dodo account.
1. Connect
- In Dodo Payments, open Developer → API Keys and create a key. A test-mode key connects your test mode.
- The connector needs access to read payments/refunds and list/create webhooks. If your account offers scoped keys, allow those operations. Reading brands is optional and lets Settings show your business's name.
- In traffic.cx, open Settings → Revenue, choose Connect next to Dodo Payments and paste the key.
traffic.cx works out whether the key is for test or live mode, creates a webhook for payment.succeeded,
refund.succeeded and refund.failed, keeps its signing secret encrypted, and imports the last 90 days. If
a permission is missing, the error names it.
2. Pass the visitor's IDs
Dodo checkout metadata is used to link the resulting payment. Use the browser-to-server handoff to pass a validated tcx object to your checkout endpoint.
js
// Your server, creating a checkout session
import DodoPayments from 'dodopayments';
const dodo = new DodoPayments({
bearerToken: process.env.DODO_PAYMENTS_API_KEY,
environment: 'test_mode',
});
export async function createCheckout(tcx) {
const session = await dodo.checkoutSessions.create({
product_cart: [{ product_id: process.env.DODO_PRODUCT_ID, quantity: 1 }],
return_url: 'https://example.com/thanks',
metadata: tcx,
});
return session.checkout_url;
}Set a test-mode key and product ID on your server, replace the return URL, and return the helper's URL as { "url": "…" } from your existing checkout endpoint. When moving to live payments, use the matching live key/product and environment: 'live_mode'. See the official Dodo TypeScript client for its environment and checkout-session options.
What traffic.cx records
| Webhook | Recorded as |
|---|---|
payment.succeeded | A one-off payment, or a subscription payment: the first one starts the subscription and later ones are renewals that keep its credit |
refund.succeeded | A refund of the payment |
refund.failed | Removes that refund |
Payments leave out the tax Dodo collects as the merchant of record. Refunds count what was refunded, tax included, because Dodo doesn't split a refund's tax.
3. Verify and troubleshoot
Follow the test attribution flow. Confirm the payment's metadata includes the pageview ID, the traffic.cx connection shows test mode, and the resulting payment has the expected source. Exercise a refund and, for subscriptions, a renewal for the same customer.
- Authentication failure: use the same environment for your key, product and checkout. The connector probes test/live access, but your checkout code must choose its environment explicitly.
- Webhook creation failure: check access to webhook operations and the provider's error shown in the connection dialog. Reading payments alone is insufficient.
- No attribution: inspect the completed payment's metadata and the recorded visit. Empty IDs cannot identify a source; backfilled older payments may remain unattributed.
- Delayed data: inspect the webhook log, then sync the connection. Failed deliveries are retried; hourly synchronization provides a fallback.
Connector fixtures and example payloads are tested. A fresh Dodo account connection and test purchase are not verified by this guide's publication; perform the checks above in your account.