Quiet leaks: where is my shop losing money that no dashboard shows me?

TL;DR

Difficulty: Beginner

A quiet leak is money lost after the customer said yes, or a cost paid without anyone checking. No marketing dashboard shows it.

  • In the example shop in Limerick, seven leaks add up to about €64,800 a year, 3.25% of revenue, worth as much as 12% more orders.
  • The biggest are leaked discount codes (€14,112), declined payments (€14,003) and payment fees above budget (€13,055).
  • Each one can be found in data the shop already has: the payments table, provider reports, DMARC reports, carrier invoices.
  • Rank fixes by value per day of work, not by size, and repeat the check every quarter.

The customer found the product, wanted it and reached the checkout. And still some of the money never arrived, or quietly went out again. This chapter maps the quiet leaks of an online shop, sizes each one for an example shop in Limerick, and shows where to find them in your own data.

The question no dashboard answers

Most shop owners know their conversion rate, their average order value and their return on ad spend. Those numbers sit on a dashboard, they move every day, and a lot of effort goes into nudging them up. This chapter is about a different kind of number: money the shop loses after the hard part is done.

The customer found the product. They wanted it. They reached the checkout, or the order went through, or the parcel left the warehouse. And still some of the money never arrived, or quietly went out again. A card was declined that the bank would have approved on a second try. An order confirmation landed in spam and the customer wrote in, worried. A refund paid back more than the customer had paid. A carrier billed a box by its size, not its weight. A welcome code turned up on a voucher site and was used by people who would have paid full price.

None of these is dramatic. Each one is small, repeats every month, and is invisible from the places owners usually look. Together, in the example shop of this series, they come to about €64,800 a year, 3.25% of revenue. That is more than most marketing optimisations ever win.

This is the first chapter of a 12 part series. It draws the map: what a quiet leak is, why dashboards miss it, every leak in the example shop with its size, where to find each one in your own data, and how to decide where to start. The later chapters take one leak each and fix it properly.

Example: the shop this series follows

The example is invented, and it is the same shop as in the earlier eCommerce chapters. Shannonside Home is an online homeware shop in Limerick (shannonsidehome.example). Niamh owns it. Callum is her developer and data engineer. The shop runs on Ruby on Rails and Solidus with a PostgreSQL database, takes payments through Stripe and PayPal, and ships through a third party logistics warehouse (a 3PL) that sends a daily file of shipments and returns.

The example's baseline, fixed for the whole series:

NumberValue
Productsabout 1,400
Sessions a month110,000
Orders a month1,980 (about 23,760 a year)
Average order value, including VAT€84
Revenue a month€166,320
Revenue a year€1,995,840
Contribution per order, before marketing€22.44
Return rate9% of orders
Ad spend on Google and Meta€16,500 a month

Contribution per order is what one order leaves behind after VAT, the cost of the goods, payment fees, fulfilment and the expected cost of returns. The chapter on unit economics works out the €22.44 line by line. In this chapter it is the value of one more order, or of one order not lost.

A quiet leak is money lost after the customer said yes

A quiet leak has two forms. The first is money lost after the customer decided to buy: the payment failed, the confirmation never reached them, the checkout broke in their browser. The second is a cost the shop pays without anyone checking it: a payment fee above the agreed rate, a carrier surcharge, a refund larger than it should be, a discount given to someone who did not need it.

What makes a leak quiet is that nothing tells you. No error page appears. No customer complains in a way that points at the cause. The money simply comes out a little lower than it should, every month, and the gap looks like normal business.

This is different from the conversion funnel, where visitors drop out before they decide. The chapter on the eCommerce funnel covers that ground: product pages, baskets and checkout design. This series starts where that one stops, at the moment the customer has already said yes.

Example: two kinds of leak at Shannonside Home

On a Tuesday evening a customer in Cork tries to pay €138 for a lamp and two cushions. Her bank declines the card with a general code because the payment looks unusual at that hour. She gives up and buys elsewhere. That is the first kind of leak: a customer who wanted to pay, and an order that was lost anyway.

The next morning a customer in Galway returns one of two cushions he bought with a 10% welcome code. The cushion's list price was €39.50, so he paid €35.55 for it. Someone on the team refunds €39.50 by hand in the payment provider's dashboard. That is the second kind: a cost paid without anyone checking it. Neither event leaves a trace on the marketing dashboard. Both show up, much later, as a slightly smaller number in the bank.

Why marketing dashboards never show these leaks

A marketing dashboard measures what happens before and at the purchase: sessions, clicks, add to basket, orders, revenue attributed to campaigns. It is built from analytics events and ad platform data. The leaks in this series happen in places those tools do not see.

A declined payment is visible in the payment provider's records, not in analytics, which in most setups only records the purchase once it succeeds. An email in spam is visible to the mailbox provider, not to the shop. A carrier surcharge sits on an invoice that goes to the bookkeeper. An over refund sits in the payment provider's dashboard. A leaked discount code looks like a successful promotion, because the dashboard counts every order that used it as a win.

There is a second reason. Dashboards show rates and trends, and a leak that is present every month does not change the trend. A payment success rate of 92% looks normal if it has always been 92%. Nobody asks whether it should be 95%.

Example: the same month from the dashboard and from the bank

In September Niamh's dashboard shows 1,980 orders, €166,320 of revenue and a steady conversion rate. Everything is in line with August. Her bank account and her provider statements tell a different story, if someone reads them side by side.

Out of 2,150 checkouts that reached the payment step, 170 ended without an order. Payment fees came to 2.3% of revenue, not the 1.7% she budgeted. The 3PL's carrier invoice was €836 above what the shop's own shipping records expected. 280 orders used a welcome code that was meant for first time buyers only. None of this changes the dashboard. All of it changes the profit.

Leaks are often worth more than the next marketing win

Marketing work tries to bring in more orders. Fixing a leak keeps money from orders the shop already has. The second is usually easier to predict, because the customers, the orders and the costs are already in your data. A new campaign might work. A refund rule that stops over refunds works on the day it ships.

A useful way to compare the two is to turn the leaks into an equivalent number of extra orders. If the leaks cost LL a year and each order leaves cc in contribution, closing them is worth the same as winning L/cL / c more orders.

Neq=LcN_{\text{eq}} = \frac{L}{c}

Here NeqN_{\text{eq}} is the number of extra orders a year that would bring in the same contribution, LL is the yearly cost of the leaks and cc is the contribution per order before marketing. This is a ratio, nothing more (Foundations: ratios and rates).

Example: what €64,800 is worth in orders

The leaks in this chapter add up to €64,821 a year (the total is worked out in a later section). With a contribution of €22.44 per order:

Neq=64,82122.44=2,888.6N_{\text{eq}} = \frac{64{,}821}{22.44} = 2{,}888.6

So NeqN_{\text{eq}} is about 2,889 orders a year, or 241 a month. Niamh's shop takes 1,980 orders a month, so closing the leaks is worth as much as 12.2% more orders. With 110,000 sessions, that would mean lifting the conversion rate from 1.80% to about 2.02%. Most shops would celebrate a marketing test that did that. And the extra orders from a campaign would usually cost ad spend on top, while the leaks cost only the work to close them.

Leak A: declined payments from customers who wanted to pay

When a customer pays by card, the shop's payment provider asks the card's issuing bank (the issuer) to approve the payment. The issuer can say no. Stripe's documentation names three broad causes of a failed payment: the issuer declines it, the payment is blocked (for example by fraud screening), or the request itself was invalid1. Some declines are final: the card is reported stolen, there are no funds, the number is wrong. Others are soft: the bank is unsure, a check timed out, or the customer did not finish 3D Secure, the bank's extra step where the customer approves the payment with a code, an app or a fingerprint2.

A soft decline often succeeds on a sensible second attempt, with a different method, or with a clearer message to the customer. Most shops never measure how many of their failed payments were soft. The number that matters is the payment success rate: of all checkouts that reached the payment step, how many ended in an order.

s=nordersnattemptss = \frac{n_{\text{orders}}}{n_{\text{attempts}}}

Here ss is the payment success rate, nordersn_{\text{orders}} is the number of checkouts that ended in an order and nattemptsn_{\text{attempts}} is the number of checkouts that reached the payment step, in the same period (Foundations: ratios and rates).

Example: 170 checkouts that did not become orders

In the example, 2,150 checkouts a month reach the payment step and 1,980 end in an order.

s=1,9802,150=0.921s = \frac{1{,}980}{2{,}150} = 0.921

So ss is 92.1%, and 170 checkouts a month fail. Callum sorts them by reason using the provider's decline codes. 40 are hard: suspected fraud, no funds, an invalid card. Nothing should be done about those. 130 are recoverable: soft declines, 3D Secure that was abandoned or failed, and technical errors.

The fixes (retrying soft declines within the card networks' rules, handling 3D Secure properly, offering the right second method, saving the basket and saying clearly what went wrong) recover 40% of the recoverable ones: 0.40×130=520.40 \times 130 = 52 orders a month. The success rate rises to 2,032÷2,150=94.5%2{,}032 \div 2{,}150 = 94.5\%.

The value of a recovered order is its contribution, because the customer pays the same price and the shop has the same costs as for any other order:

52×12×22.44=14,002.5652 \times 12 \times 22.44 = 14{,}002.56

That is 5252 orders a month, 1212 months and 22.4422.44 euro each: €14,003 a year. The next chapter in this series, on authorisation rates and soft declines, explains how a card payment is authorised and how each fix works.

Finding it in your own data

Solidus records each payment attempt in the spree_payments table, with a state such as failed, pending or completed and a response_code from the provider3. A first look needs one query: for each payment method, how many orders reached a payment, and how many of those ended up complete.

-- PostgreSQL: payment success rate by payment method for one month
SELECT pm.name AS payment_method,
       count(DISTINCT p.order_id) AS reached_payment,
       count(DISTINCT p.order_id) FILTER (WHERE o.completed_at IS NOT NULL) AS ended_in_order,
       round(100.0 * count(DISTINCT p.order_id) FILTER (WHERE o.completed_at IS NOT NULL)
             / nullif(count(DISTINCT p.order_id), 0), 1) AS success_pct
FROM spree_payments p
JOIN spree_orders o ON o.id = p.order_id
JOIN spree_payment_methods pm ON pm.id = p.payment_method_id
WHERE p.created_at >= date '2026-09-01'
  AND p.created_at <  date '2026-10-01'
GROUP BY pm.name
ORDER BY reached_payment DESC;

An order where the customer tried a card and then PayPal counts once under each method, which is what you want here: it shows where customers fail. Depending on how the payment integration is built, some declines happen inside the provider's own payment form and never create a failed row in Solidus. So compare the result with the provider's own report of declined payments for the same month. If the two disagree, the provider's figure is the one to trust, and the gap itself is worth a note.

Leak B: order emails that land in spam

An order confirmation is the shop's promise in writing: the payment arrived, and here is what happens next. Mailbox providers such as Gmail and Outlook decide whether it reaches the inbox, and they decide on evidence. Is the sender who it says it is? Has mail from this domain been trustworthy before? Do people mark it as spam?

The first question is answered by three DNS records with long names. Sender Policy Framework (SPF) lists the servers allowed to send for your domain. DomainKeys Identified Mail (DKIM) signs each message so the receiver can check it was not changed. Domain based Message Authentication, Reporting and Conformance (DMARC) tells receivers what to do with mail that fails those checks, and sends you reports about it.

Since 1 February 2024 Google requires every sender to Gmail to set up SPF or DKIM and to keep the spam rate reported in its Postmaster Tools below 0.3%. Senders of more than 5,000 messages a day to Gmail must have SPF, DKIM and DMARC4. Yahoo sets matching requirements5. Microsoft announced in April 2025 that Outlook.com would require SPF, DKIM and DMARC from domains sending more than 5,000 emails a day, and would route non compliant mail to the junk folder from 5 May 20256. A shop that sends its newsletter and its order emails from the same domain shares one reputation between them, so a bad newsletter week can push confirmations into spam.

Example: 120 extra contacts a month

Before the fix, about 6% of Shannonside Home's order confirmations to Gmail and Outlook addresses landed in spam. Customers who see no confirmation and no dispatch email worry, and a good few write in to ask where their order is. In the example that is 120 extra "where is my order" contacts a month.

Each contact costs about €5.25 to handle (an invented figure for the example: a few minutes of someone's time plus the service tool). So:

120×5.25=630120 \times 5.25 = 630

That is 120120 contacts at 5.255.25 euro, €630 a month, and 630×12=7,560630 \times 12 = 7{,}560 euro a year. This is the part that is easy to count. Password reset emails that never arrive, customers who do not come back because the shop felt unreliable, and the review that mentions "no confirmation" come on top, and are not in the €7,560.

Finding it in your own data

Three places show it. DMARC aggregate reports, which mailbox providers send to the address in your DMARC record, list how much mail claiming to be from your domain passed or failed the checks. Google Postmaster Tools shows the spam rate and domain reputation for mail to Gmail. And the customer service tool shows it from the other side: tag every "where is my order" ticket, and compare the count with the number of orders. A rising share of such tickets with no change in delivery times is a strong hint that emails are going missing. A later chapter in this series, on order emails and the sender rules, goes through the records, the reports and the fixes one by one.

Leak C: silent failures nobody notices for days

A silent failure is something that breaks without an error anyone sees. A deploy changes the checkout and one payment button stops working in one browser. A webhook endpoint fails, so payments are taken but orders stay unpaid. A shipping rate table returns nothing for one country. Uptime monitoring says the site is up, because it is. Error tracking may show nothing, because nothing crashed. Orders simply come in a little slower, and it looks like a quiet week.

The cost of a silent failure depends almost entirely on how long it runs before someone notices. That is why the fix is a business alarm, not more technical monitoring: a check that compares orders per hour, by payment method and by browser, with what is normal for that hour and weekday, and tells someone when the gap is too large.

Example: Apple Pay broken in Safari for three days

After a deploy on a Thursday, the Apple Pay button on Shannonside Home stops working in Safari. Everything else works. Over three days, 58 orders are lost. Nobody notices until Niamh reviews the month's numbers at the end of it.

To see why nobody noticed, compare 58 with a normal three days. The shop takes 1,980÷30=661{,}980 \div 30 = 66 orders a day, so about 198 in three days. Losing 58 of them is 29%, a drop that shows up clearly against the same hours last week, but looks like ordinary noise to someone who glances at a daily total.

Assume, as the example does, four such late found incidents a year:

4×58×22.44=5,206.084 \times 58 \times 22.44 = 5{,}206.08

That is 44 incidents, 5858 orders each and 22.4422.44 euro of contribution: €5,206 a year. With a business alarm that fires within two hours, the same incident costs about 58÷72×2=1.658 \div 72 \times 2 = 1.6 orders instead of 58, roughly €36, which is a derived figure for the example.

Finding it in your own data

The simplest version compares the last few hours with the same hours on the same weekday in previous weeks. This query does that for the last three hours against the previous four weeks, by payment method.

-- PostgreSQL: orders in the last three hours against the usual for those hours
WITH windows AS (
  SELECT w,
         now() - interval '3 hours' - w * interval '7 days' AS from_ts,
         now() - w * interval '7 days' AS to_ts
  FROM generate_series(0, 4) AS w
)
SELECT pm.name AS payment_method,
       count(*) FILTER (WHERE windows.w = 0) AS last_3_hours,
       round(count(*) FILTER (WHERE windows.w > 0) / 4.0, 1) AS usual_3_hours
FROM windows
JOIN spree_orders o ON o.completed_at >= windows.from_ts AND o.completed_at < windows.to_ts
JOIN spree_payments p ON p.order_id = o.id AND p.state IN ('pending', 'completed')
JOIN spree_payment_methods pm ON pm.id = p.payment_method_id
GROUP BY pm.name
ORDER BY usual_3_hours DESC;

Window 0 is now. Windows 1 to 4 are the same three hours one, two, three and four weeks ago. A method that usually brings 8 orders in these hours and has brought 0 today deserves a look. Wallets such as Apple Pay often arrive through the same payment method as cards, so a split by browser comes from analytics rather than from this table. The chapter on silent failures and business alarms builds this into a scheduled job with a proper expected range and a message to the owner's phone.

Leak D: refunds that pay back too much, and rounding

A refund should return what the customer paid for the item, not its list price. When an order had a discount, those two numbers differ. If the refund is typed by hand, or calculated from the price on the product page, the shop pays back the discount as well.

Solidus itself gets this right by default. Its standard refund calculator spreads order level discounts across the items and refunds each returned unit at what was actually paid for it7. The leak appears when someone overrides that amount in the admin, or refunds directly in the payment provider's dashboard, where Solidus never sees it.

Rounding is the small cousin of this leak. When a discount or VAT is split across lines, a cent can end up on one side or the other. That is rarely real money, but it makes the shop, the payment provider and the accounts disagree by tiny amounts, and those tiny disagreements hide the larger ones.

Example: 18 over refunds a month

Take the cushion from earlier. The list price is €39.50, the 10% welcome code takes off €3.95, and the customer pays €35.55. When the cushion comes back, the refund should be €35.55. In the example it is €39.50, so the shop pays back €3.95 too much.

This happens on 18 returns a month:

18×3.95×12=853.2018 \times 3.95 \times 12 = 853.20

That is 1818 returns, 3.953.95 euro each and 1212 months: €853 a year. Separately, about 0.3% of orders, 0.003×1,980≈60.003 \times 1{,}980 \approx 6 a month, end up one cent apart between the order total and the amount captured. That is a reconciliation nuisance, not a loss, and the chapter on money maths in shop code deals with both.

Finding it in your own data

This query looks at returned items and compares the amount refunded with the price paid per unit, spreading the order's discounts across its items in proportion to their price.

-- PostgreSQL: returned units refunded at more than the customer paid for them
SELECT o.number,
       ri.id AS return_item_id,
       li.price AS list_price,
       round(li.price * (o.item_total + o.promo_total) / o.item_total, 2) AS paid_per_unit,
       ri.amount AS refunded,
       ri.amount - round(li.price * (o.item_total + o.promo_total) / o.item_total, 2) AS too_much
FROM spree_return_items ri
JOIN spree_inventory_units iu ON iu.id = ri.inventory_unit_id
JOIN spree_line_items li ON li.id = iu.line_item_id
JOIN spree_orders o ON o.id = li.order_id
WHERE ri.created_at >= date '2026-07-01'
  AND o.item_total > 0
  AND ri.amount > round(li.price * (o.item_total + o.promo_total) / o.item_total, 2) + 1.00
ORDER BY too_much DESC;

In Solidus, promo_total holds the discounts as a negative number, so adding it to item_total gives what the customer paid for the goods. The €1.00 margin in the last condition keeps rounding and free delivery promotions out of the list. The second check covers refunds made outside Solidus: add up the refunds in the payment provider's report for the month and compare the total with the sum of amount in spree_refunds for the same month. Any difference is a refund that nobody recorded in the shop.

Leak E: payment fees above the rate you think you pay

Most small shops know one fee rate, the one on the provider's front page. The rate actually paid is higher, because the front page rate applies only to some cards. Stripe's Irish price page, for example, lists separate rates for standard cards from the European Economic Area, premium cards from the European Economic Area, UK cards and other international cards, with an extra charge when a currency has to be converted8. Add American Express, refunds where the original fee is not returned, and chargebacks (a customer disputing a payment through their bank, which comes with its own fee), and the blended rate drifts upward.

The number to know is the effective fee rate: everything the provider kept, divided by everything the customers paid.

reff=FVr_{\text{eff}} = \frac{F}{V}

Here reffr_{\text{eff}} is the effective fee rate, FF is the total of all fees the provider deducted in a month (from its settlement report) and VV is the total value of the payments in that month (Foundations: ratios and rates).

Example: 1.7% expected, 2.3% paid

Niamh budgets 1.7%. When Callum adds up a month of settlement reports from Stripe and PayPal, the fees come to 2.3% of €166,320. The difference is 0.6 points of revenue:

0.006×166,320=997.920.006 \times 166{,}320 = 997.92

That is 0.0060.006 (0.6 points) of 166,320166{,}320 euro: €998 a month. On top, six chargebacks a month at €15 each (the example's fee) cost 6×15=906 \times 15 = 90 euro. Together that is €1,087.92 a month, or 1,087.92×12=13,055.041{,}087.92 \times 12 = 13{,}055.04 euro a year: €13,055.

Not all of that can be won back. Some customers will always pay with premium or foreign cards. But once the effective rate is known per method and per card type, it can be negotiated, steered with the order of payment methods at checkout, and checked every month. The chapter on payment fees and payouts later in the series shows how to reconcile every payout cent for cent.

Finding it in your own data

This one starts outside the shop database. Download the provider's settlement or payout report for a full month (Stripe and PayPal both offer one) and add up two columns: gross amount and fees. Divide the second by the first. Then do the same per card type or country if the report has those columns. If the number is more than a few tenths of a point above the rate you think you pay, the difference is your leak.

Leak F: shipping charges nobody checks

Carriers bill a parcel by the larger of two weights: the actual weight on the scale and the volumetric weight, which is calculated from the size of the box. DHL Express, for example, calculates volumetric weight as length times width times height in centimetres divided by 5,000, and charges whichever weight is higher9. Each carrier and each contract sets its own divisor, so the number in your contract is the one that counts.

wvol=l×b×hdw_{\text{vol}} = \frac{l \times b \times h}{d}

Here wvolw_{\text{vol}} is the volumetric weight in kilograms, ll, bb and hh are the length, breadth and height of the box in centimetres and dd is the divisor in the carrier's terms, 5,0005{,}000 in the DHL Express example (Foundations: ratios and rates). The weight billed is the larger of wvolw_{\text{vol}} and the actual weight.

A light product in a large box is billed as a heavy one. On top come surcharges (fuel, remote areas, oversize, address corrections) and plain billing errors. Few small shops compare the carrier invoice line by line with what they shipped, so all of it is paid as billed.

Example: a lamp in a box that is too big

A table lamp weighs 4.2 kg packed. The 3PL ships it in a box of 45 × 35 × 25 cm:

wvol=45×35×255,000=7.875w_{\text{vol}} = \frac{45 \times 35 \times 25}{5{,}000} = 7.875

So wvolw_{\text{vol}} is about 7.9 kg, almost twice the actual weight, and the parcel is billed in a higher weight band. In the example, 435 parcels a month (about 22% of the shop's parcels) are billed by volumetric weight at €1.60 more than budgeted:

435×1.60=696435 \times 1.60 = 696

That is 435435 parcels at 1.601.60 euro: €696 a month. About €140 a month of unchecked surcharges and billing errors comes on top. Together that is 696+140=836696 + 140 = 836 euro a month, €10,032 a year. A later chapter, on shipping costs nobody checks, works through the box sizes and the invoice audit.

Finding it in your own data

Ask the carrier or the 3PL for the invoice detail as a file, one line per parcel, with the billed weight, the dimensions and every surcharge. Join it to the 3PL's shipment file and to the spree_shipments table by tracking number. Then count three things for a month: parcels where billed weight is more than the actual weight, parcels with a surcharge, and parcels billed that the shop has no record of shipping. The last group is pure error, and it is more common than it should be.

Leak G: discount codes that leak

A welcome code is meant for one thing: to tip a first time visitor into a first order. It leaks when it travels. Voucher sites list it. Browser extensions find it and fill it in at checkout. Customers share it. Returning customers use it again with a new email address. Every order with the code looks like a success on the promotion report, because the report counts every use, not every use that changed a decision.

The cost is the discount given to people who would have paid full price anyway. That is hard to measure exactly, but easy to estimate: compare how often the code is used by returning customers and by visitors who arrived from a voucher site with how often it is used by genuine first time buyers.

Example: 280 orders with a leaked welcome code

Shannonside Home's 10% welcome code is used on 280 orders a month, with an average discount of €8.40. Callum's analysis suggests that half of them, 140 orders, came from customers who would have bought at full price: returning customers and visitors from voucher sites. The discount on those orders is the leak:

140×8.40=1,176140 \times 8.40 = 1{,}176

That is 140140 orders at 8.408.40 euro: €1,176 a month, and 1,176×12=14,1121{,}176 \times 12 = 14{,}112 euro a year. The other 140 uses may well have done their job. The fix is not to drop the code, it is to stop it working for the wrong people.

Finding it in your own data

This query counts orders with a discount by whether they were the customer's first order or a later one. It treats emails that differ only in capital letters or spaces as the same customer, which matters because duplicate accounts are common (in the example, 3.1% of accounts are duplicates of this kind).

-- PostgreSQL: discounted orders by first and returning customers, one month
WITH orders_ranked AS (
  SELECT id,
         completed_at,
         promo_total,
         row_number() OVER (PARTITION BY lower(trim(email)) ORDER BY completed_at) AS nth
  FROM spree_orders
  WHERE completed_at IS NOT NULL
    AND state <> 'canceled'
)
SELECT CASE WHEN nth = 1 THEN 'first order' ELSE 'returning' END AS customer_type,
       count(*) AS orders,
       count(*) FILTER (WHERE promo_total < 0) AS with_discount,
       round(-avg(promo_total) FILTER (WHERE promo_total < 0), 2) AS avg_discount
FROM orders_ranked
WHERE completed_at >= date '2026-09-01'
  AND completed_at <  date '2026-10-01'
GROUP BY 1;

The ranking runs over the whole order history before the month is filtered, so a customer's tenth order is counted as returning even if it is the only one this month. If many returning customers use a code meant for first orders, it has leaked. Solidus can bind a promotion to a first order and limit how often a code may be used1011. The chapter on discount codes that leak later in the series goes into the promotion tables, single use codes and voucher site traffic.

Two risks that can cost a month at once

Not every leak drips. Two risks in a small shop are rare, but when they happen they cost a lot at once: the keys of the business held by one person, and backups that have never been restored.

The keys are the accounts that run the shop: the domain registrar, DNS, email, hosting, the code repository, the payment provider, Google and Meta accounts, the carrier account. If one person holds the only login, the only two factor phone or the only recovery email, the business depends on that person being reachable. Domains are a good example of how quietly this goes wrong. For generic domains such as .com, ICANN's Expired Registration Recovery Policy requires the registrar to send at least two reminders before expiry, about a month and about a week ahead, and, once the domain has expired, to interrupt its DNS before deleting it, so the website stops loading while the domain can still be renewed12. If the reminders go to the inbox of someone who has left, the first sign is a shop that no longer loads.

Backups have the same shape. PostgreSQL's own documentation describes three different ways to back up a database, and each one comes with its own restore procedure13. A backup that has never been restored is a hope, not a plan. You only find out whether it works on the worst day to find out.

Risks like these are best compared with the regular leaks through their expected value: the probability that the event happens in a year, times what it costs when it does.

E=p×CE = p \times C

Here EE is the expected cost a year, pp is the probability that the event happens in a year and CC is the cost when it happens (Foundations: expected value). The chapter on decision theory for founders explains why expected value is a good way to compare uncertain costs, and where it falls short.

Example: a two day outage

If Shannonside Home were down for two days because nobody could reach the domain or the hosting account, it would lose 66×2=13266 \times 2 = 132 orders. In contribution:

132×22.44=2,962.08132 \times 22.44 = 2{,}962.08

So CC is about €2,962, plus the effort of the recovery itself. The example assumes, as an invented figure, a 5% chance of such an event in a year without the fixes:

E=0.05×2,962.08=148.10E = 0.05 \times 2{,}962.08 = 148.10

So EE is about €148 a year. For an untested restore, the example assumes, again as an invented figure, a 3% chance a year that a failed restore turns a two hour fix into the same two day outage: 0.03×2,962.08=88.860.03 \times 2{,}962.08 = 88.86, about €89.

These numbers are small, and they are not in the €64,800. They are here because expected value understates the problem. A domain lost for good, or an order history that cannot be restored, is not a two day outage. It is a business that has to start again. The fixes cost an afternoon each: a second administrator on every account, auto renewal with a card that will not expire unnoticed, a recovery plan written down, and one restore tested on a copy. The chapter on who holds the keys goes through every account.

The total: about €64,800 a year

Here are the seven leaks of the example in one table, with each one's share of the yearly revenue of €1,995,840.

LeakA yearShare of revenue
A declined payments€14,0030.70%
B emails in spam€7,5600.38%
C silent failures€5,2060.26%
D refunds and rounding€8530.04%
E payment fees and chargebacks€13,0550.65%
F shipping charges€10,0320.50%
G leaked discount codes€14,1120.71%
Total€64,8213.25%
64,8211,995,840=0.0325\frac{64{,}821}{1{,}995{,}840} = 0.0325

That is 64,82164{,}821 euro of leaks against 1,995,8401{,}995{,}840 euro of revenue: 3.25%. Put differently, of every €100 a customer pays, €3.25 leaks out in ways no dashboard shows. The two risks from the last section are not included, because they are not monthly costs.

Waterfall chart of the example shop's yearly leaks, each added to the last: declined payments €14,003, emails in spam €7,560, silent failures €5,206, refunds €853, payment fees €13,055, shipping €10,032, discount codes €14,112, giving a total of €64,821 a year, 3.25% of revenue. Tap or click to open full screen and move around

Sorted by size, the picture changes. Leaked codes, declined payments and payment fees are close to each other at the top. Refunds are small in money, but they are the leak that most damages trust in the numbers.

Bar chart of the example shop's yearly leaks sorted by size: discount codes €14,112, declined payments €14,003, payment fees €13,055, shipping €10,032, emails in spam €7,560, silent failures €5,206, refunds €853. Tap or click to open full screen and move around

Rank the leaks by size and by effort

The biggest leak is not always the first to fix. A large leak that takes weeks of work can wait behind a smaller one that takes an afternoon. The useful measure is value per day of work: what fixing a leak is worth in a year, divided by the days it takes.

v=Litiv = \frac{L_i}{t_i}

Here vv is the yearly value per day of work, LiL_i is the yearly cost of leak ii and tit_i is the number of working days the fix takes (Foundations: ratios and rates).

Example: how long each fix takes

Callum estimates the effort for each fix. The days are invented for the example, and your own will differ.

LeakA yearDays of workValue per day
G discount codes€14,1121€14,112
B emails in spam€7,5601€7,560
E payment fees€13,0553€4,352
F shipping€10,0324€2,508
A declined payments€14,0036€2,334
C silent failures€5,2063€1,735
D refunds€8530.5€1,706

For the codes, v=14,112÷1=14,112v = 14{,}112 \div 1 = 14{,}112 euro per day. For declined payments, v=14,003÷6=2,334v = 14{,}003 \div 6 = 2{,}334 euro per day. The order is clear: make the welcome code first order only and fix email authentication in the first week, then reconcile fees and audit the carrier invoice, then the payment work and the alarm. In all, 18.5 days of work. At €750 a day, an assumed market rate for the example, not my price, that is 18.5×750=13,87518.5 \times 750 = 13{,}875 euro against €64,800 a year. Even the smallest fix, the refund rule, costs 0.5×750=3750.5 \times 750 = 375 euro and pays for itself in about five months, and every value per day in the table is far above the day rate, so the ranking stands.

Bar chart of the yearly value per day of work for each fix in the example shop: discount codes €14,112, emails in spam €7,560, payment fees €4,352, shipping €2,508, declined payments €2,334, silent failures €1,735, refunds €1,706. Tap or click to open full screen and move around

The risks are outside this ranking on purpose. They are quick to fix and costly to ignore, so they go into the first month regardless of their small expected value.

Tap or click to open full screen and move around

Where each leak shows up in your own data

Every leak in this chapter can be found with data the shop already has. None needs a new tool to measure. It needs someone to look in the right place.

LeakWhere to lookThe number
A declined paymentsspree_payments and the provider's decline reportPayment success rate by method
B emails in spamDMARC reports, Google Postmaster Tools, service tickets"Where is my order" tickets per 100 orders
C silent failuresspree_orders per hour against the usual hoursHours with orders far below normal
D refundsspree_return_items, spree_refunds, provider refund reportRefunds above the price paid
E payment feesProvider settlement reportsEffective fee rate
F shippingCarrier invoice detail, 3PL file, spree_shipmentsParcels billed above actual weight, surcharges
G discount codesspree_orders and the promotion tablesShare of code use by returning customers

Example: Niamh's first afternoon

Callum runs the payment query, the refund query and the discount query, and downloads one month of settlement reports. Niamh tags a week of service tickets and asks the 3PL for the carrier invoice detail. By the end of the afternoon they have six of the seven numbers. The seventh, silent failures, cannot be measured backwards with confidence, so they set up the three hour comparison and look at it every morning for two weeks. That is enough to start.

A check you can repeat every quarter

Leaks come back. A new payment method changes the decline mix. A new carrier contract has a different divisor. A marketing intern creates a code without a first order rule. So the measurement is not a project, it is a habit. Once a quarter, pull the same seven numbers and compare them with the last quarter.

CheckHealthy sign in the exampleAct when
Payment success rate94% or more after the fixesIt drops by a point
"Where is my order" tickets per 100 ordersStable, lowIt rises with no change in delivery times
Silent failures found lateNoneAny incident found after more than a day
Over refundsNone above €1Any
Effective fee rateWithin 0.2 points of budgetMore than 0.2 points above
Parcels billed above actual weightFalling as boxes changeRising, or unknown surcharges appear
Welcome code use by returning customersClose to zeroAbove a few per cent of uses
Account accessTwo administrators everywhereAny account with one
Restore testOne done this quarterNone this quarter

Example: the check in practice

At the end of the first quarter after the fixes, Shannonside Home's payment success rate is 94.4%, welcome code use by returning customers has fallen to almost nothing after the first order rule, and the effective fee rate is 1.9%. The carrier invoice still shows surcharges for remote areas that the shop's delivery prices do not cover. That becomes next quarter's job. The whole check takes Niamh and Callum about two hours.

My view

Most small shops I look at spend their attention on the front of the business: traffic, ads, the next campaign. That is understandable, because it is where the dashboards are. My view: before the next marketing test, measure the leaks. They are already happening, they are easier to predict than any campaign, and the fixes keep working without a budget. A shop that keeps an extra 3% of its revenue every year has a better business than one that wins a 3% conversion lift once and keeps leaking.

That does not make marketing less important. It means the order matters. Fix what you already have, then grow it.

Conclusion

A quiet leak is money lost after the customer said yes, or a cost paid without anyone checking. In the example shop, seven of them come to about €64,800 a year, 3.25% of revenue, worth as much as 12% more orders: declined payments that could have been recovered, order emails in spam, silent failures found late, refunds above the price paid, payment fees above the budgeted rate, shipping billed by box size, and a welcome code used by people who did not need it. Two risks sit beside them, keys held by one person and restores never tested, which cost little in expected value and a great deal on the day they happen.

Every one of them can be found in data the shop already holds, ranked by value per day of work, and checked again every quarter. The next chapters take them one at a time: declined payments and authorisation rates, order emails and the sender rules, silent failures and business alarms, who holds the keys, expired cards and failed renewals for subscription businesses, money maths in shop code, payment fees and payouts, shipping costs nobody checks, free delivery thresholds and delivery promises, discount codes that leak, and finally a quarterly leak audit that brings them together.

I build shops on Ruby on Rails and Solidus, test first, with every release through a test gate, and I run the analytics for clients on the same numbers this chapter uses. If you want to know what your own shop is leaking, that is a good first conversation.

Want to know what your own shop is leaking? Book the free workshop and I will help you pull the seven numbers from your own data, and the first two weeks of work are on me.

Sources

  1. 1.

    Stripe, Declines (Stripe documentation), https://docs.stripe.com/declines

  2. 2.

    Stripe, 3D Secure authentication (Stripe documentation), https://docs.stripe.com/payments/3d-secure

  3. 3.

    Solidus, core database schema (migration solidus_one_four, tables spree_payments, spree_orders, spree_return_items and others), GitHub, https://github.com/solidusio/solidus/blob/main/core/db/migrate/20160101010000_solidus_one_four.rb

  4. 4.

    Google, Email sender guidelines, Google Workspace Admin Help (requirements from 1 February 2024), https://support.google.com/a/answer/81126

  5. 5.

    Yahoo, Sender best practices, Yahoo Sender Hub, https://senders.yahooinc.com/best-practices/

  6. 6.

    Microsoft, Strengthening email ecosystem: Outlook's new requirements for high volume senders, Microsoft Defender for Office 365 Blog, 2 April 2025, https://techcommunity.microsoft.com/blog/microsoftdefenderforoffice365blog/strengthening-email-ecosystem-outlook%E2%80%99s-new-requirements-for-high%E2%80%90volume-senders/4399730

  7. 7.
  8. 8.

    Stripe, Pricing and fees (Ireland), https://stripe.com/ie/pricing

  9. 9.

    DHL Express Netherlands, How do I calculate volumetric weight?, https://www.dhlexpress.nl/en/faq/shipping/how-do-i-calculate-volumetric-weight

  10. 10.
  11. 11.

    Solidus, SolidusPromotions::Promotion (usage_limit and per_code_usage_limit), GitHub, https://github.com/solidusio/solidus/blob/main/promotions/app/models/solidus_promotions/promotion.rb

  12. 12.

    ICANN, Expired Registration Recovery Policy, 2013, https://www.icann.org/resources/pages/errp-2013-02-28-en

  13. 13.

    The PostgreSQL Global Development Group, PostgreSQL 18 Documentation, Chapter 25: Backup and Restore, https://www.postgresql.org/docs/18/backup.html