Adding Barcode Product Data to a Mobile App
Mobile is where barcodes get scanned in the real world - in a stockroom, at a pickup, on a sourcing run. This guide covers the scan-to-card loop, where the token belongs, and which fields make a product card feel finished.
The scan-to-card loop
The core of any barcode feature on mobile is a short loop: the camera reads a code, your code cleans and validates it, a product-data API resolves it, and the screen shows the result. Get that loop tight and the experience feels instant; a scan becomes a product card in well under a second.
- Scan - the device camera or a hardware scanner reads the barcode value.
- Clean and validate - strip stray characters and confirm the check digit locally before any network call.
- Resolve - send the GTIN to the lookup endpoint and receive the product record.
- Render - populate a product card, or fall back gracefully on a miss.
Validating on the device first, with the barcode validation tool logic, means a misread never becomes a wasted request. The generic version of this pipeline is covered in how to build a barcode scanner feature; here the focus is the mobile specifics.
Keep the token off the device
The single most important decision is where the API token lives, and the answer is never the app. A token shipped inside a mobile binary can be extracted from the package and used to drain your quota. Route every lookup through your own backend, which holds the token and forwards the call.
Phone -> Your backend (holds token) -> Barcodes.GG API
scan GTIN authenticated lookupThe proxy earns its keep in other ways too. It is the natural place to cache popular codes, enforce per-user rate limits, and rotate the token without shipping a new app build.
Do not embed the API token in the app bundle, in a config file inside the binary, or in client-side code. Assume anything on the device can be read. Keep the token server-side and proxy the request.
Cache, and handle misses
Two behaviors keep a mobile scanner fast and cheap. First, cache by GTIN. The same shoes get scanned repeatedly across a stockroom, and a local or backend cache means the second scan of a code is free and instant. Second, respect the response metadata: request_debited tells you when a call counted against quota, so you can surface usage and avoid surprises.
Handle the miss deliberately. A code that is not in the catalog returns a 404, not an empty product. On mobile that should become a clear not-found state that invites another scan, rather than a spinner that never resolves. A validated-but-unknown code is a genuine miss; a validation failure before the call is a rescan prompt.
Cache resolved products by their normalized GTIN, not by the raw camera string. Two scans of the same box can produce slightly different raw values, but they normalize to one canonical number - and one cache hit.
A finished product card
A product card feels finished when it answers the three questions a user has at a glance: what is this, is it the right one, and what size. The lookup response carries exactly those fields.
| Card element | Field |
|---|---|
| Title | product_name |
| Brand line | product_brand and product_style_code |
| Image | product_image |
| Colorway | product_colorway |
| Size | product_size with US, UK and EU mappings |
Request only the fields the card renders by passing a comma-separated fields list rather than fields=*. Smaller payloads mean faster cards on a phone connection. The full field catalog is covered in what data a barcode lookup API returns.
Frequently asked questions
Can I call the Barcodes.GG API directly from a mobile app?
Technically yes, but you should not. A token in an app can be extracted and abused. Route lookups through your own backend so the token stays server-side and you keep control of rate limiting and caching.
How do I keep scanning fast on a slow connection?
Cache resolved products by their normalized GTIN and request only the fields your card renders. A cached code returns instantly, and a smaller payload loads faster over mobile data.
What should the app show when a barcode is not found?
A clear not-found state that invites another scan. The API returns a 404 for an unknown code, so treat that as a genuine miss rather than leaving a loading spinner on screen.
Try the tools
Related reading
How to Build a Barcode Scanner Product-Lookup Feature
A practical blueprint for wiring a camera scanner to a product-data API so users can scan an item and see what it is.
Barcode API Guide: Integrate Product Lookup Into Your App
A developer-focused walkthrough of how a barcode API turns a scanned GTIN into structured product data inside your application.
Getting Started With the Barcodes.GG API
The Barcodes.GG API turns a barcode into a structured product record with one authenticated GET request. This guide walks a first-timer from token to first response.