createMeridianServerClient is the SDK without React: the same reads and the same billing writes, for resource routes, Shopify extensions, background jobs and anything else that runs outside a component.
It takes a shop token, either bare or as { shopToken, baseUrl } to override the API root. If you have a shop domain rather than a token, createMeridianApp gets you there in one call with serverClientForShop(shop).
Methods
Gates
getGates() is the server-side equivalent of the provider’s gates, resolved once and then read synchronously:
getGates is the one method that does not throw when Meridian is unreachable, so it suits a request path. In SDK 3.5.0 and later, a failed read comes back with status: "failed", entitlements: null and the original error in error (a MeridianApiError when the API answered, a 429 included: this client has no breaker). Every feature then reads as off, unless you pass { failOpen: true } to can. A shop with no plan comes back "ok", with planId: null and no features. See fail open or fail closed.
Unlike gatesForShop, getGates keeps nothing in memory: every call is a read, and counts as one SDK request.
checkFeature costs one call per feature, so prefer getGates when you are checking more than one.
Errors
Every other method throws MeridianApiError on failure, unlike createMeridianApp, which degrades.
There is no automatic token refresh on the server client; only the provider does that. If a job holds a token for longer than an hour, refresh it when a call reports it expired, or mint a fresh one with mintShopToken. See Errors.
isShopTokenRevokedError(err) (401 SHOP_TOKEN_REVOKED) means the shop uninstalled the app. refreshShopToken() only helps once it has reinstalled, and only within the revoked token’s original hour, so mint a fresh token instead.
Subscribing from the server
subscribe takes the returnUrl as a required argument here, with the same shop-admin constraint as the pricing page. The SDK validates it before the call either way.
Server-side subscribing is what the provider’s onSubscribe override routes to. Reach for it when you want a billing action enforced on your own server.
Scheduled changes
A downgrade or a cancellation on a paid plan usually takes effect at the end of the period the merchant has paid for. The responses say so: subscribe and cancelSubscription answer with timing ("immediate" or "end_of_period") and the scheduledChange that results, and subscribe adds effectiveAt. getMe() and getEntitlements() carry the scheduled change on entitlements.subscription. See Plan changes.
undoScheduledChange is the Keep of the built-in pages. It resolves { undone: true } when the change is gone, or { undone: false, confirmationUrl } when the merchant has to approve their plan again on Shopify. Unlike the provider, the server client does not redirect: send the merchant to that URL yourself. It does not refresh anything either: a change whose date has just passed answers 404 NO_SCHEDULED_CHANGE, so read getMe() again to show the plan that took effect. Pass returnUrl whenever scheduledChange.undo.requiresApproval is true, under the same shop-admin rule as subscribe. It is what the provider’s onUndoScheduledChange override routes to.
The refusals are listed in Errors.
Pure helpers
featureEnabled, featureLimit and eventUsage are exported from the server entry too, so a snapshot you already hold can be gated without a client:
Last modified on November 17, 2026