Development

WooCommerce REST API for Mobile Apps: A Practical Guide

Understand products, carts, customers, authentication, caching, and the backend boundary before connecting a mobile app to WooCommerce.

Connecting a mobile app to WooCommerce is not simply a matter of placing a consumer key in an HTTP client. A production app needs clear API boundaries, safe credential handling, predictable models, cart reconciliation, and a plan for the WordPress extensions that change store behavior.

This guide covers the decisions that matter before you write the first product screen. It is intentionally architecture-focused: endpoint details evolve, while the security and data-flow principles remain useful.

1. Know which WooCommerce API you are using

WooCommerce has APIs with different jobs. The WC REST API exposes store resources such as products, orders, customers, coupons, and reports. It is suitable for trusted integrations and administrative operations when permissions are scoped correctly.

The Store API supports customer-facing commerce features. WooCommerce describes it as unauthenticated and designed not to expose sensitive store or customer data. It includes public product and cart-oriented operations. Read the current WooCommerce API overview before selecting endpoints.

NeedLikely boundaryImportant note
Public product browsingStore API or a controlled catalog endpointCacheable, but stock and price still need revalidation
Customer cartStore API or backend sessionPreserve session/cart tokens consistently
Customer accountDedicated customer authentication flowREST API keys are not customer login credentials
Orders and privileged dataYour backend to WC REST APINever expose privileged keys in the app
Custom plugin dataPlugin endpoint or backend adapterValidate, authorize, and version custom responses

2. Put a safe boundary between the app and privileged APIs

A compiled iOS or Android app is a public client. Values bundled in the binary can be extracted, even when obfuscated. Therefore, a consumer secret with access to customers or orders does not belong in the app.

A safer production flow looks like this:

  1. The mobile app authenticates the customer with an app-specific, short-lived session.
  2. The app calls a backend endpoint you control.
  3. The backend validates the customer and the requested operation.
  4. The backend calls WooCommerce with server-held credentials when privileged access is required.
  5. The backend returns only the fields the app needs.

This backend-for-frontend layer also gives you a stable contract when a plugin changes its metadata, lets you combine several WooCommerce calls, and provides a central place for rate limiting, observability, and fraud controls.

Use the least privilege that works. A catalog reader does not need write access. A customer should never inherit a Shop Manager’s capabilities. Keep separate credentials for separate workloads, record their purpose, rotate them, and revoke unused keys.

3. Treat store authentication and customer authentication separately

WooCommerce REST API keys are created for a WordPress user and follow that user’s roles and capabilities. The official authentication documentation describes pre-generated keys and an application authorization endpoint. That endpoint is for granting an integration API access; WooCommerce explicitly distinguishes it from customer login.

For requests made over HTTPS, follow the current WooCommerce authentication documentation and the client library you use. Do not place secrets in URLs, logs, analytics properties, crash reports, or support screenshots. Reject plain HTTP in every production build.

Customer identity needs its own threat model:

  • Use short-lived access tokens and a controlled refresh or reauthentication path.
  • Store tokens with Keychain on iOS and Keystore-backed secure storage on Android.
  • Rate-limit login, password-reset, and verification endpoints.
  • Invalidate sessions after a password or account-security change when appropriate.
  • Return generic authentication errors that do not reveal whether an email exists.

4. Model the catalog for real WooCommerce data

A demo store with simple products hides the hard cases. Production data may include variable products, sale windows, backorders, multiple image sizes, HTML descriptions, decimal strings, missing fields, custom attributes, and extension metadata.

Create explicit app models instead of passing raw JSON through widgets. Normalize money without floating-point arithmetic, sanitize any HTML you render, and make optional fields genuinely optional. Preserve the relationship between a variable parent and each variation; a cart line should refer to the exact purchasable variation, not only the parent product.

Pagination and synchronization

Never assume the catalog fits in one response. Load pages incrementally, cancel requests for abandoned searches, and deduplicate products by stable IDs. If you maintain a backend index, use WooCommerce webhooks or scheduled reconciliation to refresh it—but make webhook handlers idempotent because deliveries can be duplicated or arrive out of order.

Images and rich text

Use appropriately sized image variants, placeholders, memory-aware caching, and meaningful fallbacks. Product descriptions coming from WordPress may contain shortcodes or markup that a native renderer does not understand. Decide which tags you support and transform the rest at your backend boundary.

5. Make the server authoritative for cart and checkout

The app can keep a responsive local representation of the cart, but the server must calculate the purchasable result. Prices, stock, coupons, taxes, and shipping availability can change between product view and payment.

After every material cart operation, reconcile the server response and render its totals. Before payment, revalidate:

  • Each product or variation still exists and is purchasable.
  • Requested quantities are available or permitted on backorder.
  • Current prices, discounts, taxes, and currency are displayed.
  • The shipping address has eligible methods and an explicit selection.
  • Coupons remain valid for this customer and cart.
  • The payment result is tied to one idempotent order attempt.

Idempotency matters on mobile networks. If a payment request times out after reaching the server, a blind retry can create a second charge or order. Give each checkout attempt a unique key and let the server return the existing result when that key is repeated.

6. Design for unreliable networks and busy stores

Fast development Wi-Fi is not a performance test. Mobile requests move between radios, lose connectivity, and arrive through distant networks. Meanwhile, a WordPress server may run many plugins before returning JSON.

  • Cache stable data: categories, configuration, and recently viewed catalog pages can load from a local cache while refreshing.
  • Keep volatile data fresh: price, availability, cart totals, and checkout data need short lifetimes and server validation.
  • Request less: avoid fetching long descriptions and full image sets for a compact search result.
  • Bound retries: retry safe reads with exponential backoff and jitter, but do not automatically replay unsafe writes.
  • Observe the chain: attach correlation IDs so a mobile error can be traced through your backend to WooCommerce.

Set explicit connection and response timeouts. Give customers useful states—offline, retrying, unavailable—not an endless spinner. Cache policies should be visible in code and covered by tests rather than emerging accidentally from an HTTP package.

7. Test contracts, permissions, and failure paths

Use unit tests for parsing and pricing presentation, contract tests for backend responses, and integration tests against a staging WooCommerce store. Seed that store with difficult product and checkout combinations.

  • Malformed, missing, empty, and newly added response fields
  • Expired customer sessions and revoked WooCommerce keys
  • 403, 404, 409, 429, and 500-class responses
  • Duplicate taps and repeated order requests
  • Plugin updates that change custom metadata
  • Stock or coupon changes between cart and checkout
  • Logs and crash reports checked for credentials or personal data

Finally, document the integration: endpoint owner, credential scope, key-rotation process, webhook behavior, data retention, and rollback steps. Mobile apps remain installed for months, so your backend should support at least the app versions your release policy promises.

If you are planning the whole project rather than only the data layer, continue with How to turn a WooCommerce store into a mobile app.

Prefer a maintained starting point?

WooSignal provides a Flutter SDK, API documentation, and a customizable WooCommerce app template.

Explore the WooCommerce Flutter SDK