Smile.io: Rolldown ESM widgets, HS256 JWT exchange and points double-dip hazards
Public OpenAPI 3.1 (3 specs), documentation, and Rolldown ESM teardown of Smile.io: 24 js.smile.io ES modules, platform.smile.io token exchange, 5-minute HMAC webhooks, append-only PointsTransaction ledgers, and gift-card/store-credit double-dip hazards.
- 24 Rolldown ESM chunks + platform.smile.io iframe
- 5m HS256 JWT exchange + HMAC webhooks
- Append-only PointsTransaction + store-credit tender gap
Investigation question
How does Smile.io split storefront ES modules, cross-origin iframe UI, and OAuth2 REST ledgers, authenticate headless shoppers via 5-minute HS256 JWT exchanges, deduplicate activities, and handle Shopify gift-card/store-credit tender semantics?
Observed
Inspecting Smile.io’s three published OpenAPI 3.1.0 specifications (rest-api.json, js-sdk.json, smile-ui.json), Mintlify dev/help documentation indexes, and all 24 modular Rolldown ES bundles served from js.smile.io/v1/ maps a clean three-host architecture. Storefront embeds (smile-shopify.js, smile-ui.js, smile.js, plus lazy chunks like app-core, PanelView, Launcher, and Nudges) execute across Shopify Theme App Embeds and load the interactive shopper panel inside an isolated platform.smile.io iframe (/smile_ui/init, /smile_ui/exchange_tokens, /smile_ui/shopify/identify_customer). On headless stores, servers sign a short-lived 5-minute HS256 JWT (sub, aud: api.smile.io) that the browser exchanges at /smile_ui/exchange_tokens for a channelKey-scoped customer_token. On the server plane, api.smile.io/v1 exposes cursor-paginated REST resources authenticated via connect.smile.io OAuth 2.0 (oa2_* tokens, 3600s TTL), deduplicating external events by (token, distinct_id) on POST /activities, recording append-only PointsTransaction entries, fulfilling Rewards atomically via POST /v1/points_products/{id}/purchase, and signing webhooks (Smile-Timestamp + Smile-Signature Base64 HMAC-SHA256 with 5-minute replay tolerance).
Inferred
Two platform boundaries stand out for commerce integrations: (1) Smile’s Shopify order help docs explicitly confirm that while shipping, taxes, and discounts can be excluded from points accrual, Shopify Gift Card and Store Credit redemptions are represented as payment tender rather than line discounts—so Smile does not subtract them from qualifying order totals, creating a points-on-store-credit double-dip hazard unless externally mitigated; and (2) Smile’s dev/help Mintlify llms.txt manifests and three OpenAPI 3.1.0 specs make documentation highly machine-readable, yet Smile exposes no authenticated loyalty MCP server for agentic checkout balance lookups or redemptions.
Unknown & limitations
This Stage 1 public-source teardown did not install Smile.io onto a live Shopify store or exercise paid Growth ($199/mo) Checkout Extensions, live customer OTP auto-enrollment traces, or post-uninstall Shopify discount-code and theme-embed cleanup behavior.
Architecture
Smile separates modular Rolldown ES delivery (js.smile.io/v1/, 24 modules totaling ~423 KB with routes /home, /vip, and /ways-to-earn/birthday-reward), the cross-origin iframe session host (platform.smile.io), and OAuth 2.0 merchant REST/webhook control (connect.smile.io and api.smile.io/v1).
Domain & data models
15 REST OpenAPI schemas and 14 JS SDK schemas model Customer, CustomerIdentity (/customer_identities/create_or_update), Activity ((token, distinct_id) uniqueness), append-only PointsTransaction, EarningRule, PointsProduct / PointsPurchase, RewardFulfillment (pending/issued/cancelled/failed, usage_status, Shopify discount combination flags), VipTier, Referral, and rolling inactivity expiry (3 days to 2 years).
Workflows & state machines
Order earn applies configurable days-delay windows before approving points and reverses proportionally on refunds; redemptions atomically validate balances and issue customer-bound Shopify discount codes (refunding points on failure or admin cancellation); and Shopify New Customer Accounts auto-enroll shoppers on first 6-digit email OTP sign-in.
API & protocol surfaces
Three OpenAPI 3.1.0 contracts (rest-api.json, js-sdk.json, smile-ui.json) covering connect.smile.io/oauth2/{authorize,token}, 14 cursor-paginated api.smile.io/v1 paths, /smile_ui/{init,exchange_tokens,shopify/identify_customer}, and HMAC-signed webhooks (ping, customer/updated).