gatesForShop reads the snapshot from Meridian and keeps it in memory for 30 seconds.
Boolean and numeric features
A feature is either on/off or carries a number.
A numeric feature is still enabled or not. The limit is the amount the plan sets on top of that. Check both: an enabled feature with no limit configured returns
undefined from getLimit, not 0. A feature the plan makes Unlimited reads the same way: enabled, with getLimit returning undefined.
Keys are the contract
The string you pass is the feature’s key: the app-local stable identifier from the plan builder. A key survives a rename in the dashboard.Gating on the server
The same gates exist without React, for resource routes, Shopify extensions and background jobs:gatesForShop resolves the shop’s entitlements in one call and never throws. In SDK 3.5.0 and later, gates.status says whether Meridian answered ("ok") or why it did not ("unconfigured", "rate_limited", "failed"), and every feature reads as off when it did not. See Fail open or fail closed. A snapshot Meridian answered is kept in memory for 30 seconds. See Caching entitlements.
If you already hold a shop token, createMeridianServerClient(...).getGates() returns the same gates, read from Meridian on every call, and checkFeature(key) reads a single feature. See Server client.
Entitlements resolve through one path everywhere, so a gate behaves identically in your React code, on your server, and in Meridian MCP’s entitlements_explain.
Fail open or fail closed
The SDK fails closed by default: when it has nothing to read, every feature reads as off. A paying merchant then sees paid features as off until Meridian answers again. This is what each gate returns, case by case:status, failOpen and the server cache are in SDK 3.5.0 and later. Earlier versions fail closed in every case above, with no documented field to tell them apart.
Telling no plan from a Meridian failure
Afalse from a gate means either “this plan does not grant it” or “Meridian could not answer”. Read status before acting on it, for example before showing an upgrade prompt or refusing a paid action:
- On the server,
gates.statusis"ok"when Meridian answered, and afalseis then the plan’s answer. With"failed",gates.erroris the original error: aMeridianApiErrorwith itsstatusandcodewhen the API answered. With"rate_limited",gates.retryAtis when the SDK calls Meridian again. - In React, read
statusfromuseMeridian. It is"loading"until the first snapshot loads, then"ok"for good: a failedrefresh()keeps the last snapshot, setserror, and the gates keep answering from it."failed"and"rate_limited"mean the first load failed, so there is no snapshot at all. Whilestatusis"loading", render a placeholder rather than the upgrade prompt. - Before the provider, when Meridian is down while your loader runs,
mintShopTokenreturnsnulland the provider is not mounted.meridian.configured === true && shopToken === nullthen means Meridian failed, rather than missing credentials, and your app decides what to render.
Failing open
PassfailOpen: true and a gate answers true when Meridian could not answer ("failed" or "rate_limited"), so a Meridian outage cannot lock a paying merchant out:
failOpen changes the yes/no answer only when Meridian failed. It never applies to "unconfigured", so a missing environment variable in production does not hand out every paid feature, and never while the provider is still loading. Once Meridian has answered, the plan decides. limitOf, getLimit, usage, getUsage, view and getView stay undefined, because there is no number to make up.
We recommend failOpen: true for the capabilities merchants pay for. The cost is that during an outage every shop gets those features, free ones included. Keep a feature closed with { failOpen: false } when each use costs you money (an AI call, an email send) or when giving it away for a few minutes is worse than turning it off.
Gate paid actions on the server too: a client-side gate only hides the button, and anyone can call your route directly.
Gating on usage
A limit a shop consumes over time is an event rather than a feature.getUsage(eventKey) returns what the plan includes and what has been used this period.