One order, one commission. Stop double-counting.
Shopify reload, webhook retry, and Segment replay all fire the same purchase twice. Tradly's fix is one rule: event_id = orderRef. Second fire returns the existing event, no second commission.
1. The bug: reload = second commission
Order Status Page pixel fires on reload. Webhook fires on orders/create retry. Both create a new conversion row if you lack a dedupe key. Check Dashboard > Conversions for same orderRef twice.
2. The fix: send same event_id both times
Pixel and webhook both send event_id = order_id. Tradly does INSERT ... ON CONFLICT(event_id) DO NOTHING and returns 200 with existing event. No second row, no second payout.
// Pixel and webhook - same event_id
fetch('/api/public/conversions', {
body: JSON.stringify({ conversionKey:'ck_xxx', orderRef: order.id, eventId: order.id, amount, sessionId })
})3. Refunds: negative amount, same orderRef
Refund is not a delete. It's a second event with same orderRef, amount = -refund_total, event_id = orderId_refund. Commission adjusts, BigQuery sum is correct.
4. Verify
GET /vendors/:id/stats and SELECT count(*) FROM conversions GROUP BY orderRef HAVING count>1 should return 0 rows. Re-send same curl twice - second should be 200, not 201.
Implementation checklist
- All conversions send event_id
- event_id = order_id (not random UUID)
- Refund uses same orderRef with negative amount
- BigQuery GROUP BY orderRef has zero duplicates
FAQ
What if I sent random UUID as event_id?
Then retries are not idempotent - each UUID creates a new row. Fix: migrate to orderId. Tradly lets you query by orderRef to dedupe historically.
Does this work across pixel + webhook?
Yes. That's the point - whichever arrives first wins, second is a no-op. Keep both for durability.
How to fix historical duplicates?
Export CSV, GROUP BY orderRef, void duplicates via refund event or manual payout adjustment.
Related guides and tools
- Affiliate Attribution Software
A practical guide to choosing affiliate attribution software that connects campaigns, partner links, conversions, commissions, and payouts.
- Attribution
Attribute clicks, installs, conversions, and purchases accurately with last-click resolution, session TTLs, and idempotent events.
- Fraud Detection
Review referral traffic and reduce duplicate conversions with idempotent events, click context, rate limits, and partner attribution records.
- Referral vs Affiliate Programs
Compare customer referral and affiliate programs by participant, incentive, qualifying event, recruitment, and operations, with examples for choosing a model.