Skip to main content
Most of the SDK works wherever your app runs. Billing is the exception, and it is a hard requirement rather than a degraded experience.

Why billing is different

To create a Shopify subscription for a shop, Meridian needs that shop’s Shopify offline access token. The only place that token exists is your app’s own session table, the one your Shopify library owns, and Meridian reads it by opening your app’s database directly. So billing works only where Meridian can reach that database, which means Meridian has to be running it.

How Meridian uses your offline token

Meridian stores no Shopify token of its own. On each billing call it reads your app’s offline session row for the shop:
  • While the access token has more than 5 minutes left, Meridian uses it as is and changes nothing in the row. This is almost every call. The first time it sees a token, Meridian asks Shopify which app it belongs to, and uses it only if that is the Shopify app registered on your Meridian app (a dev store session created by another app config is refused, as before).
  • Closer to expiry, with Shopify’s expiring offline tokens (the template turns them on with expiringOfflineAccessTokens: true), Meridian refreshes the token with the row’s refresh token and writes the new pair back to the same row, as your Shopify library would.
  • If your app stored a new session in the meantime (a token exchange when the merchant opens the app, or a reinstall), Meridian does not overwrite it. It writes only onto a row that still holds the refresh token it used, and otherwise keeps your app’s session and uses its token. Shopify retires every other refresh token when your app acquires a new one, so overwriting would leave your app holding a pair that no longer refreshes.
  • Meridian’s own refreshes for one shop never run in parallel. When one is already running, the next call reuses its result, or fails with 503 SHOPIFY_BILLING_ERROR after 10 seconds so it can be retried.
If Shopify rejects the access token anyway, Meridian retries the call once with a refreshed token before it answers 401 SHOPIFY_ACCESS_TOKEN_STALE.

What satisfies the requirement

Any one of these is enough: The dev-database path is what lets you test billing end to end before your first deploy. An install running under meridian dev is always billed as a Shopify test charge, never a real one. A local app started another way is treated as a production install: Meridian reads the shop’s session from the production database. See Billing from local development.
Both production paths run through a Meridian hosting environment, because that is what a managed database attaches to. Keeping your app on another host and buying a Meridian database does not work: the session table Meridian reads has to be the one your running app writes to.

What works anywhere

Every one of these is independent of where your app is hosted: A self-hosted app keeps gating, the CRM, segments, automations, emails, affiliates and the webhook pipeline. It cannot take money through Meridian, but Meridian still sees the subscriptions the app bills itself, trials included.

What needs it

Four calls assert the requirement up front and refuse rather than half-work: They fail with 403 PLAN_BUILDER_UNAVAILABLE, or 401 SHOPIFY_ACCESS_TOKEN_STALE when the store is reachable but holds no offline session for that shop, which is the merchant’s to fix rather than yours. See Errors. The plan builder itself is gated too. For an app that cannot bill, Meridian blocks its plan-builder routes and the dashboard names the reason, so you find out at “publish a plan”, not at a merchant’s first checkout.

Two things degrade quietly

These do not fail, which makes them the ones to watch: Usage overage is never charged. A track call still returns 200 and the usage row is still written. Meridian writes that before it attempts anything with Shopify, so the record of what your app did always survives. But the overage charge that should follow is best-effort: it is logged as a warning and swallowed. Your usage figures look correct and no money moves. Plan prices fall back to USD. At identify, Meridian asks Shopify for the shop’s billing currency. With no reachable session store that lookup fails, and the currency falls back to USD, so a shop that bills in another currency is shown every plan priced in dollars. The shop’s name, email, primary domain, Shopify plan, country and language go unresolved in the same call. From SDK 2.10.0, afterAuth reads the email, primary domain, Shopify plan and country with your session’s token and sends them to Meridian instead, and from SDK 3.3.0 the name and, when your app holds a locales scope, the language too, so upgrade the SDK or a store ends up in your CRM with no address, no domain and no plan on it, and {{store_name}} falls back to the name your app passes to identify. Neither is fixable from the SDK. They are what “billing is unavailable” looks like on the calls built not to throw.

How to check

Before you build: the app’s plan-builder section in the Meridian dashboard is the answer. If it is gated, billing will not work, and the gate names the reason. In code: reactively, with the guard the SDK exports.
err.details.plan_builder_billing_status distinguishes the four cases. See the status table.
There is no public API or SDK function that answers this up front. Meridian’s public API exposes no readiness field, so the SDK cannot ask “may this app bill?” before trying. If your app needs to hide its pricing page when billing is unavailable, drive that from your own configuration, or catch the error on first use and remember the answer.

A note on the session table

session_table_missing looks like a hosting problem but is not. It means Meridian reached your database and found no Session table, almost always an app still pointing Prisma at the template’s SQLite datasource, so its migrations ran somewhere else. Point the Prisma datasource at the managed database with url = env("DATABASE_URL") (the provider of your app’s engine, mysql by default), deploy, and the table appears. Locally, meridian dev gives you the same with your developer database. See Prepare Prisma.
Last modified on November 20, 2026