← Selected work

E-commerce · payments

Thousands of card transactions a week, down to one a day

Per-vendor payment aggregation across three services — and order processing that stopped waiting on payment.

Contribution
Architected and implemented the solution end to end, across all three services.
Stack
Python · Django · GraphQL · microservices · Docker
Three services and a daily job. An order lands in the order service from the interface or the API and goes straight on to the print service — no payment gate between them. Alongside, the order service records the order's payment in the payment service as type aggregate where the vendor's contract enables it, and nothing waits on that. Once a day, a scheduled job picks up every pending aggregate payment — many thin lines converging on it — and sends one combined card transaction per vendor to the card processor outside the platform: thousands a week in, one a day out.

The problem

On an online print-and-publishing platform, every order charged a card. One order, one transaction. For a vendor doing real volume that meant thousands of card transactions a week, each one carrying its own processing fee and its own opportunity to fail.

The fees were the visible cost. The structural cost was worse: payment sat in the critical path. An order could not move forward until its payment completed, so every card decline, every timeout at the processor, every transient failure stopped a print job that had nothing wrong with it. The platform’s throughput was coupled to the reliability of a third party, one transaction at a time.

The approach

Vendors already had billing periods defined in their contracts. The solution made the system honour that fact instead of charging as if every order were a stranger’s first purchase.

It spans three services. Orders land in the order service, whether placed through the interface or the API. Print jobs are scheduled and tracked in the print service. The payment service creates a payment entity to track each order — and that is where the change went in: a payment can now be tracked as aggregated when the vendor has aggregation enabled.

That single distinction does two things at once. It marks the charge as one that will be collected later with its siblings, and it releases order processing from waiting on payment at all. The print job proceeds; the money is accounted for and collected on the contract’s terms.

The last piece is deliberately the dullest one in the system: a daily job that picks up pending aggregate payments and makes one combined card transaction for them. No queue, no distributed state machine, no event choreography. A scheduled sweep was sufficient, and sufficient is the correct amount of architecture for a thing that must simply be right every day.

The result

For a vendor on aggregated billing, thousands of card transactions a week became one a day — one fee instead of thousands, one thing to reconcile instead of a ledger of them.

The decoupling is the part worth copying. Payment and fulfilment were two systems pretending to be one step, and separating them meant a payment problem could no longer stall work that was already paid for in principle. The transaction count is what a founder notices first; the uncoupling is what stops the 3 a.m. calls.

Have a system shaped like this one?

Thirty minutes, no pitch deck. You describe the problem; I tell you honestly whether I’m the right person to solve it.

Book a 30-min discovery call
Book a call