The Problem
What This Does
ShipStation has a bug that's been open for 8+ years: when a Shopify order has an ORDER-LEVEL discount (like '20% off your entire order'), ShipStation ignores it when setting customs declared values on international shipments. This means customs forms show the full retail price instead of what the customer actually paid — which can cause the customer to be overcharged import duties and taxes at the border.
Why It Matters
International customers pay import duties based on the declared value on the customs form. If that value is inflated because ShipStation didn't apply the order discount, customers pay more in duties than they should. Merchants get complaints, refund requests, and lose trust. There's no existing solution — ShipStation hasn't fixed it and no other app addresses it.
How It Works
- 1.A customer places an order on a Shopify store with a coupon code like '20% off your order'.
- 2.Shopify sends the order to ShipStation for fulfillment.
- 3.ShipStation creates customs forms for international orders, but it uses the FULL retail price for each item — it doesn't subtract the order-level discount.
- 4.Line-item discounts (like '20% off this specific shirt') ARE correctly reflected by ShipStation. Only ORDER-level discounts are broken.
- 5.Declared automatically detects these orders, calculates the correct discounted values, and pushes the corrected customs declarations back to ShipStation via their API.
- 6.After pushing, it reads the values back to VERIFY that ShipStation actually saved the correction.
Key Decisions
- ●Only order-level discounts need fixing — line-item discounts are already handled correctly by ShipStation. This was confirmed through API testing with real orders.
- ●The app applies a proportional discount ratio to ALL existing customs items rather than trying to match Shopify SKUs to ShipStation items. This is simpler and works regardless of how the merchant has configured their products.
- ●We use decimal.js for all money math — never floating point. $29.99 * 0.8 in floating point gives you 23.992000000000001. Decimal.js gives you exactly $23.99.
What Could Go Wrong
- ●If the discount ratio calculation is wrong, customs values would be incorrect — either too high (customer overpays duties) or too low (could be flagged as under-declaration).
- ●If the app pushes to ShipStation but something fails, we could end up with partially updated customs. That's why we verify after every push.
- ●If ShipStation is down or rate-limits us, orders queue up and get retried automatically.