Redeeming UDS Loyalty Points Inside the Shopify Cart

·

A technical look at connecting the UDS loyalty system to Shopify using API. How we enabled dynamic point redemption in the shopping cart.

A client ran a Shopify store and a UDS loyalty program as two systems that didn't know about each other. They wanted one thing: let customers spend their UDS points at checkout. Shopify's discount engine has no concept of an external points balance, so we built a custom integration that reads the customer's UDS balance and applies the redemption inside the cart — with every trust-sensitive step on the server.

Why there's no "switch" for this

Shopify discounts are self-contained: codes, automatic rules, and (now) Functions all operate on Shopify's own data. UDS is an external service with its own user database and point balances. Nothing native bridges them — Shopify can't ask UDS "how many points does this customer have?" So the integration owns that conversation and then expresses the result as a discount Shopify understands.

The flow the client wanted

  • Customer opens the cart and enters their UDS identifier in a custom field.
  • The system looks up that customer in UDS and reads their current point balance.
  • The customer chooses how many points to spend.
  • The cart total updates to reflect the redemption.

The architecture: browser asks, server decides

The single most important rule: never trust the browser with money. The cart field and the live total update are client-side for UX, but the balance lookup and the actual discount are computed server-side, because a value sent from the browser can be edited. So the custom app sits between Shopify and UDS:

// 1) Cart (AJAX) → our app: "verify this UDS id"
POST /uds/verify  { udsId }
   → our server calls the UDS API (server-side key): exists? balance?
   → returns { valid, maxRedeemable }   // never the raw API key to the browser

// 2) Customer picks points → our app RE-checks balance, then applies discount:
POST /uds/redeem  { udsId, points }
   → server re-reads UDS balance (source of truth, not the client number)
   → clamps points to the real balance and cart total
   → applies the discount to the cart/checkout server-side
   → reserves the points against the UDS account

The identification and balance call go through the UDS API — whose documentation was open, which made the mapping straightforward. Because the server re-reads the balance at redemption (not trusting the number the browser submitted), a tampered request simply gets clamped to the customer's real balance.

Keeping Shopify and UDS consistent

Two systems mutating one transaction need to agree. The points are only finalized against the UDS account when the order is actually placed — if checkout is abandoned, no points are burned. And if an order is cancelled or refunded, the redeemed points are returned to the UDS balance, the mirror of the discount being reversed. Without that, customers lose points on orders that never completed — the fastest way to turn a loyalty perk into a support queue.

Bridging an external loyalty system into Shopify is 20% API calls and 80% trust boundaries: read the balance server-side, apply the discount server-side, and reconcile points to order status. Do the redemption in the browser and you've built a coupon anyone can forge.WS24 — how we integrate external loyalty

The result: customers redeem real UDS points directly in the Shopify cart, the balance and discount are computed where they can't be tampered with, and the two systems stay reconciled through cancellations. External loyalty on Shopify is very doable — as long as the money math lives on the server.