E-commerce
Every commission traceable to an order and a rule
Multi-organisation affiliate platform for a Shopify D2C brand: order ingestion, attribution, cascading commission rules and automated invoicing.
A direct-to-consumer brand selling through Shopify and a network of affiliates was paying commissions from spreadsheets reconciled against store exports. Attribution was disputed, refunds were rarely clawed back, invoices were assembled by hand every month, and negotiated per-partner or per-product deals were impossible to track once they multiplied.
We built a multi-organisation affiliate platform that treats the store's orders as the single source of truth. Shopify webhooks are HMAC-verified, queued and processed idempotently into an order ledger with line items and refunds, with a backfill tool for historical orders. An attribution engine resolves each order to an affiliate through coupon codes, UTM parameters or a persistent first-touch customer binding, and records why it decided so. Commissions come from a four-level cascade of versioned, append-only rules (organisation, affiliate, funnel and affiliate-plus-funnel) applied per order component and sale type: front-end sale, upsell, subscription renewal or lifetime. Every commission line is immutable and points to the rule version that produced it; refunds write reversing lines and negative balances carry over. Monthly payment sheets, bulk mark-as-paid, generated PDF invoices and ZIP exports close the loop. Admins, affiliates (self-service portal with a product marketplace and tracked links) and platform operators each get their own Angular application surface, in four languages.
Stack: PHP 8.5 with Slim 4 in a strict domain-driven layering, PostgreSQL via PDO, a database-backed job queue, Angular with Angular Material and signals, PHPUnit, PHPStan and Deployer-based releases.
Payouts are now computed from the source of truth instead of reconstructed after the fact, and every euro owed can be traced to an order, an attribution decision and a rule version. Because no business value is hard-coded, the client's own team adjusts rates, eligibility and deals without a developer. Client name withheld under NDA.
Platform overview: Shopify orders are ingested into an idempotent ledger, attributed to an affiliate, priced by the commission rules cascade and settled through monthly payment sheets and invoices.
The four-level commission cascade resolving a single order: organisation default, affiliate override, funnel override and the affiliate-plus-funnel deal that wins.
Tell us where you are and what you're trying to do. Maksym replies within one working day.
Book a call