Skip to main content
A working Meridian integration is four steps. The code below is React Router / Remix shaped, matching the Shopify app template; only the loaders are framework-specific. Before you start, create the app in Meridian and copy its credentials. See Credentials.
Starting a new app? The Shopify app template for Meridian has the four steps below already done, on Prisma with MySQL, with one feature gate and one tracked event as examples. Create it with shopify app init --template=https://github.com/the-meridian-ai/shopify-app-template. See AI coding agents.
1

Create one server entrypoint

createMeridianApp reads MERIDIAN_APP_ID, MERIDIAN_API_KEY and MERIDIAN_API_URL from the environment. Create it once and import it everywhere.
app/meridian.server.ts
It never throws into your app. With no credentials set, configured is false and every method returns its unconfigured result, so your app still builds and renders. See createMeridianApp.
2

Wire the install in afterAuth

One call registers your Shopify webhooks, reports the authentication so your install automations fire, reports the shop’s Shopify subscriptions and their trial length (which is how apps billing through the Shopify Billing API get trials into Meridian), and attributes an affiliate referral if there is one.
app/shopify.server.ts
Meridian resolves the webhook topic set from your dashboard configuration, so you never declare topics. Passing request matters only if you run an affiliate program. Version 3 of @shopify/shopify-app-react-router, which the current Shopify template uses, passes no request to afterAuth: call meridian.afterAuth(session), and affiliate attribution falls back to the referral Meridian stored when the merchant clicked the link.
3

Mint a shop token in your loader

The shop token is the per-shop credential the browser uses. Mint it server-side and pass it down.
app/routes/app.tsx
meridianBaseUrl is the API that minted the token (MERIDIAN_API_URL). It is undefined on production; elsewhere the provider needs it to call the same API.mintShopToken returns null when Meridian is unconfigured or unreachable. Treat that as “render without Meridian”, not as an error.Calling it in a loader is cheap: the app instance caches the handshake, so it costs one identify per shop per token lifetime, not one per request. On serverless hosting, where that cache is cold on every start, persist the token instead. See Persisting the token yourself.
4

Mount the provider

app/routes/app.tsx
The provider fetches the shop’s plan, entitlements and your plan catalogue on mount. When Meridian refuses its token, getShopToken (SDK 3.7.0 and later) asks your app’s server for a new one, and the provider replays the refused call with it. Your component sees a slightly slower call, not an error. See MeridianProvider.The route behind it is your own, app/routes/app.meridian.shop-token.tsx, with an action only. It runs authenticate.admin(request) before it reads the body or mints anything: App Bridge adds its session token to a fetch sent to your app’s origin, and that check is what keeps the shop’s token from anyone without access to the store. Then it returns { shopToken } from mintShopToken({ shop: session.shop, refusedShopToken }), never cached, or 503 when the mint returns null. See A token the browser was refused for the code.Once the route is live, createMeridianApp({ browserTokenRefresh: false }) stops a token copied from a page from being refreshed, so it is useless once its hour ends. Without getShopToken, the provider refreshes an expired token itself, so leave that option on. See Turning off refresh without the API key.

Gate your first feature

Anywhere below the provider:
advanced_reports is the feature’s key, exactly as you typed it in the plan builder. See Feature gating.

Add the pricing page

MeridianPricingPage needs a returnUrl, and it must be an https URL on the shop’s own admin. Build it in the loader, where you have the session shop and your Shopify client ID:
app/routes/app.pricing.tsx
app/routes/app.pricing.tsx
Do not build the returnUrl from request.url, window.location, or your app’s own hosting origin. Shopify’s billing API only accepts a shop-admin URL, and the SDK throws before the call rather than letting the API reject it. See Pricing page.

Track a metered action

Meridian sums the quantity over the store’s current billing period and raises Shopify usage charges from your plan’s terms. See Usage tracking.

Where to go next

Last modified on November 23, 2026