Hi Shopify Community,
We’re currently building an app that leverages the Carrier Service API to calculate shipping costs between two points. Our app integrates with Google’s API to determine the distance, and based on user-defined settings and the calculated distance, we return appropriate shipping rates at checkout.
We’re on track for obtaining the Built for Shopify badge, but we’ve encountered an obstacle: one of Shopify’s requirements specifies a response time under 500ms. Our current response time averages around 631ms, primarily due to the external Google API request. We’ve optimized our side as much as possible, but it seems we’ve hit a hard limit due to this external dependency.
Has anyone faced a similar challenge? What approaches or optimizations could we consider to bring our response times below the 500ms threshold, given the necessity of this external API?
Thanks for any guidance or insights!
Theres a couple of things I would look at here and profile if you can.
Whats the split of latency between your app, Googles API and any other logic.
If you’re using javascript you could add logs with timings, either manuall or there is a performance API.
This will help figure out where you could trim some off as you are so close.
Then would be worth considering any caching you could do, any optimisations to how your API is hosted etc.
Whats the average latency of the google api request? 
Totally doable, but you’ll need to take Google out of the hot path. For carrier-calculated rates Shopify will hit your endpoint multiple times during a checkout, so put a short-TTL cache in front of your distance lookup keyed by origin+destination (postal/ZIP + country).
A 1–5 minute edge cache (Cloudflare/Akamai) plus an in-memory/Redis cache in your app will usually pull p50 under 500 ms even if the first uncached request is slower.
If you can pre-geocode common destinations and store lat/long, a fast Haversine estimate with a route multiplier (e.g. 1.25–1.35) returns instantly; you can fall back to Google only on cache miss.
Also squeeze transport and compute overheads: keep your app in the same region as Shopify POPs you serve, reuse HTTP connections, trim Google’s payload with minimal fields, and set a hard per-request budget so you always return a tiered estimate rather than timing out.
Some teams go further and ship a hybrid: daily jobs precompute distance buckets per postal prefix and store them in metafields/files, so your rate logic is a pure lookup at checkout; you can refine with Google post-order if you need analytics accuracy. These tactics help meet Built for Shopify’s performance requirement without changing your business logic (Built for Shopify)