Prompt
Do I need shipping rules in the API or can I calculate them in my app?
Latest observation
Nov 4, 2026
OpenAI APIWeb search: off
You can calculate shipping in your app, but whether you should depends on how dynamic and authoritative the shipping logic needs to be.
Usually best practice
Put shipping rules/quotes in the API if:
- shipping depends on backend-only data like carrier rates, warehouses, zones, tax, or fulfillment rules
- you need a single source of truth across web, mobile, admin, etc.
- prices must be consistent and tamper-resistant
- rules can change without redeploying the client
Okay to calculate in the app
You can calculate in the app if:
- shipping is simple and static (e.g. “$5 flat rate” or “free over $50”)
- the logic is purely presentational
- you’re okay with users seeing an estimate that may still be confirmed by the server
Recommended approach
A common pattern is:
- App calculates a quick estimate for UX
- API validates and finalizes shipping at checkout
That way:
- the UI feels fast
- the server remains authoritative
Rule of thumb
If shipping affects the final order total, the API should be the source of truth.
If you want, I can help you decide based on your exact shipping setup, or sketch a simple API design for shipping quotes/rules.