All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
3.0.0 - Unreleased
Modernization release: Shopify 2026 compliance, a Guardian-free embedded auth model, and a Phoenix 1.8 / function-component baseline. Nothing from this branch has been published to Hex yet (the latest published release is 2.4.0).
Breaking changes
- Minimum Elixir 1.15 and Phoenix 1.8. Dropped
phoenix_view,phoenix_html_helpers, andplug_cowboy— the library no longer pins a web server (Bandit is the Phoenix 1.8 default) or the legacy view stack.phoenix_live_view ~> 1.0is now a hard dependency (2.x pulled in none), so add it to your app's deps if it isn't already there. CI verifies Elixir 1.15.8/OTP 26.2 (minimum) and Elixir 1.18.2/OTP 27.3 (current) against Phoenix 1.8.8 / Phoenix LiveView 1.2.1 — see.github/workflows/ci.yml. - View layer is function components.
Phoenix.Viewmodules +.eextemplates were replaced by*HTMLmodules with co-located.heextemplates. If you rendered Shopifex views directly, update toput_view(ShopifexWeb.PaymentHTML)/render("show_plans.html", ...).use ShopifexWeb, :viewis gone (it existed in 2.x; a 3.0 app that still calls it hitsUndefinedFunctionError), andcontroller/0no longer injectsalias _.Router.Helpers, as: Routes(which also shadowedShopifexWeb.Routes). - Guardian removed. Embedded auth no longer mints an app JWT. Session
tokens (
id_token) are verified directly byShopifex.SessionToken.Shopifex.Plug.build_session/4no longer sets a Guardian token; the:shopify_api/:shopifex_apipipelines now useShopifex.Plug.ShopifyApiAuth.AuthController.auth/2andPaymentControllerredirect to the app root instead of appending?token=. LiveView session keys are renamed"shop_url"/"session_token"(2.x used"current_shop"). - Webhooks and billing are GraphQL. REST webhook (
webhooks.json) and charge (recurring_application_charges/application_charges) endpoints were removed, along with theneurondependency.get_current_webhooks/1returns%{id, topic}maps with GraphQL enum topics (e.g."ORDERS_CREATE", not"orders/create").Shopifex.Shops.delete_webhook/2now takes a GraphQLid(a GID string, not a REST webhook id) and returns{:ok, id} | {:error, errors}. - Embedded payment routes are the default.
payment_routes/2defaults to the CSP-protected embedded pipeline; passshopify_embedded: falseto opt out. - Billing charges are cryptographically bound and verified with Shopify.
complete_payment/2requires a signed charge binding created byShopifexWeb.PaymentController.bind_charge/4and verifies the charge's status with Shopify via the (new, overridable)verify_charge/3callback before creating aGrant. Any customselect_plan-style action must callbind_charge/4before redirecting to Shopify's confirmation URL, orcomplete_payment/2rejects the return with403.create_charge/2is also an overridable callback.complete_payment/2coerces the charge id (the trailing numeric segment of a GraphQL GID) to an integer withInteger.parse/1; the:redirect_after_agentstore,create_grant/3(speccharge_id :: pos_integer()), and theGrant.charge_id:bigintcolumn all key on that integer — onlyverify_charge/3receives the string form (to rebuild the GID).Shopifex.RedirectAfterAgent(andShopifex.RedirectAfter.Ecto) now store opaque signed charge-binding strings, not raw redirect URLs — a custom:redirect_after_agentimplementation must round-trip whateverbind_charge/4hands it, not assume a plain string. use_grant/2(Shopifex.PaymentGuard) may returnnil. The default implementation now decrementsremaining_usagesatomically and returnsnilwhen 0 rows were updated (the grant was already exhausted, e.g. a race between two requests);Shopifex.Plug.PaymentGuardtreats that the same as no grant and redirects to the plan picker. Customuse_grant/2overrides must handle anilreturn.grant_for_guard/2now prefers an unlimited grant (remaining_usages == nil) over a metered one when both unlock the same guard.Shopifex.Plug.EnsureScopesdefaults to:raise, not a redirect. On a scope mismatch it now raises an actionable error pointing at managed-install app config instead of bouncing the merchant through legacy OAuth. Opt back into the 2.x redirect withplug Shopifex.Plug.EnsureScopes, on_missing_scopes: :redirect(orconfig :shopifex, :ensure_scopes_on_missing, :redirect).- Generated Grant/Plan schemas changed nullability.
mix shopifex.installnow generatesGrant.charge_id,Grant.remaining_usages, andPlan.usagesas nullable (unlimited plans have no usage cap;create_shop_grant/2never supplies acharge_id), andGrant.charge_idis:bigint(Shopify charge ids exceed Postgresint4). Apps that regenerate schemas withmix shopifex.installshould review their existing migrations.
Security
complete_payment/2validates its params before consuming the charge binding, and restores the binding on any exception. The signed binding was popped from the store beforeplan_idwas compared withto_string/1, so an unauthenticated?plan_id[x]=y(a map) with a pending charge id and the public shop domain raised after the pop, skipped the restore-on-error branch, and left the merchant's own confirmation with no binding and no grant.charge_id,plan_idandshopmust now be strings before the store is touched (Shopify's return URL always sends strings), and an exception raised after the pop (for example a plan deleted while the charge was pending) puts the binding back before re-raising.- Non-string query params are rejected before HMAC and timestamp checks.
A bracket-syntax param (
?timestamp[x]=y,?foo[x]=y) parses to a map.Shopifex.Plug.validate_timestamp/2calledto_string/1on it and the query-HMAC computation interpolated every value before any signature check, so unauthenticated input answered500instead of401on the:shopify_proxy,:validate_install_hmac,:shopify_admin_linkand:shopify_sessionpipelines.validate_timestamp/2now returns{:error, "malformed timestamp"}for a non-string, non-integer value, andShopifex.Plug.hmac_matches?/2returnsfalsewithout computing anything unless every query value is a string (ids: a list of strings).Shopifex.Plug.ManagedInstallignores non-stringid_token/shopparams, andinitialize_installation/2forwards only a stringstate. Shopifex.SessionTokenvalidates thedesthost with the anchoredShopifex.ShopDomain.valid?/1pattern thatinitialize_installationalready applies to the unsignedshopparam, instead of a.myshopify.comsuffix check.destis inside the signed token, so this is defence in depth for the host that is interpolated into the token-exchange URL and stored as the shop'surl.- HMAC comparisons use constant-time
Plug.Crypto.secure_compare/2everywhere (ValidateHmac,ShopifyWebhook,ShopifySession), and computed HMAC values are no longer logged on failure. - Webhook Base64 HMACs are compared case-sensitively (no longer lowercased), matching Shopify JS/Ruby.
- Query / app-proxy HMAC parameters are signed in explicit alphabetical order.
- Query / app-proxy requests with a
timestampare rejected outside a 90-second tolerance (config :shopifex, :hmac_timestamp_tolerance_seconds), via the sharedShopifex.Plug.validate_timestamp/2helper. The initial/authsession request (Shopifex.Plug.ShopifySession) now runs this same check, so a staletimestampon an admin-load request is rejected too when one is present (still not required there, unlike:shopify_proxy). An iframe reload of a signed admin URL after the tolerance therefore renders the store-selection page unless the app re-authenticates through App Bridge; seedocs/upgrading.md§5. Shopifex.Plug.ShopifySessionreadsshopfrom the HMAC-signed query params, not the request params. A POST bodyshopcan no longer override the signed value used to look up and build the session.Shopifex.Plug.ShopifyWebhookverifies the webhook body HMAC and resolves the shop from trusted sources only. It gained a:modeoption. In the default:webhookmode it checks thex-shopify-hmac-sha256header against the HMAC of the raw request body (new helperShopifex.Plug.valid_webhook_hmac?/1) — a query-stringhmacis ignored — and resolves the shop from thex-shopify-shop-domainheader or the HMAC-verified body, never the mergedconn.params(which a request body could shadow). Admin/bulk-action links usemode: :admin_link(set by the:shopify_admin_linkpipeline), which verifies the query HMAC and a fresh timestamp and resolves the shop from the signed query.Shopifex.Plug.LoadProxyShopreads the shop from the signedconn.query_params, notconn.params. Shopify signs only the app-proxy query, so aPOSTbody can no longer shadow theshopused to resolve the proxy request's shop.initialize_installationvalidates the shop domain with an anchored pattern (Shopifex.ShopDomain.valid?/1) instead of an unanchored regex, closing an open-redirect vector (a craftedshopvalue could previously pass a loose.myshopify.comsubstring check and redirect off-domain).- App-proxy requests now require a
timestamp. The:shopify_proxypipeline passesValidateHmac, require_timestamp: true, closing a replay window where a signed proxy URL without a timestamp was valid forever. Admin-load / bulk-action links (which may legitimately omit it) are unaffected. - CSP
frame-ancestorsno longer interpolates an unvalidated shop host.Shopifex.Plug.SetCSPHeadernow only adds the shop origin when the stored URL is a bare hostname, and adds its header alongside any existing CSP instead of replacing it, so a malformed/tampered URL can't inject extra directives. - Webhook dispatch fails closed on a missing/duplicate
x-shopify-topicheader (400) instead of raising aMatchError(500). - Fixed a cross-tenant grant bypass in
PaymentGuard. The defaultgrant_for_guard/2andgrants_for_shop/1queries combined their filters withwhere+or_where, which Ecto OR-ed against the whole clause — theremaining_usages > 0branch dropped theshop_id/guardfilters, so any shop's metered grant could satisfy another shop's payment check (and the OR branch could not use an index). The predicates are now AND-ed, with theorconfined to the tworemaining_usagesalternatives. - Secret rotation. Set
config :shopifex, :old_secretto have webhook / app-proxy / session HMAC verification, session-token (id_token) verification, and the billing charge-binding signature accept the previous secret as well, so rotating the app secret doesn't drop in-flight webhooks, sessions, or an in-progress billing round-trip. - LiveView session no longer carries the shop's tokens.
ShopifexWeb.LiveSession.put_shop_in_session/1now serializes only the shop URL (not thecurrent_shopstruct), andon_mountreloads the shop server-side. The LV session is signed but not encrypted (readable client-side), so the old behavior exposedaccess_token/refresh_token.
Added
Shopifex.Scopes—split/1(comma-separated string, list, ornil→ a trimmed list with empty segments dropped) andmissing/2(required scopes the grant lacks, in required order), the shared scope-list parser behindShopifex.Plug.EnsureScopesandShopifex.Plug.ManagedInstall.Shopifex.Auth— background offline-token refresh: proactive refresh within a 5-minute safety window (fresh_token/1), reactive refresh on a 401, and cross-node concurrency safety via a dedicatedshopifex_token_refresh_leasestable (one-time-use refresh tokens can't be refreshed concurrently without it). The outbound Shopify request holds neither a database connection nor a lock on the consumer's shop row; only a short final transaction (SELECT ... FOR UPDATE) re-checks token fields before persisting, so a concurrent managed-install exchange is never overwritten. Fresh installer migrations include the leases table; existing consumers of this branch must add the documented migration.Shopifex.Auth.fresh_token/1— public, returns{:ok, shop} | {:error, reason}(distinct fromensure_fresh_token/1, which always returns a shop and swallows the error).Shopifex.Auth.terminal_refresh_error?/1classifies a refresh failure as terminal (:refresh_token_expired,:no_refresh_token,:shop_not_found,{:refresh_failed, 400 | 401}) or transient (worth retrying with the shop's current token).{:error, :refresh_token_expired}—Shopifex.Auth.refresh/1now checks the storedrefresh_token_expires_at(with a 60s skew) before contacting Shopify, turning a doomed round-trip into an immediate, specific failure. Anilexpiry is never treated as expired, so legacy installs are unaffected. Token-expiry predicates throughoutShopifex.AuthandShopifex.Plug.ManagedInstallaccept bothDateTimeandNaiveDateTimecolumns.- Refresh retries on transient failures. The refresh-token grant retries
a request that times out or returns 408/429/500/502/503/504 up to 2 times
with the same refresh token — the behaviour Shopify documents as
returning the same rotated credentials rather than issuing another pair.
Req's built-in
retry: :transientcan't be used here (it mishandles a floatRetry-Aftervalue, which Shopify sends); a dedicated retry function honoursRetry-Afterin integer or float seconds, capped at 5s per delay. A terminal 400/401 is not retried, so a genuinely spent refresh token still fails immediately. Each attempt uses a 5s connect / 10s receive timeout. Override viaconfig :shopifex, :req_options. Shopifex.API— single GraphQL Admin API transport with a configurableapi_version(default2026-07) and errors-take-precedence handling. A terminal token-refresh failure (expired/missing refresh token, a 400/401 from Shopify's token endpoint, or shop not found) surfaces as{:error, {:token_refresh_failed, reason}}rather than a generic{:error, {401, body}}or a crashed request.Shopifex.SessionToken— strict HS256 verification of App Bridge session tokens, with:expireddistinct from other errors.Shopifex.Plug.ShopifyApiAuth— session-token auth for the API pipelines.- Token-lifecycle columns on the shop schema (
token_expires_at,refresh_token,refresh_token_expires_at;scopenow nullable), all additive and nullable so legacy / non-expiring installs round-trip. - Managed installation is the default embedded auth flow.
auth_routes/1now pipes/auththrough[:shopifex_browser, :managed_install, :shopify_session], so generated apps run token exchange out of the box.Shopifex.Plug.ManagedInstallverifiesid_token, requests expiring tokens (expiring=1), persists the full token lifecycle, and re-exchanges when the storedtoken_expires_atis within ~10 minutes of expiry. Shopifex.ManagedInstall.Callbacks— configurableinsert_shop/1,after_install/1(first install only), andafter_exchange/2(every exchange — install and refresh, with anew?flag) hooks for the managed-install path (config :shopifex, managed_install_callbacks: MyApp.Callbacks). Callbacks run synchronously in the request — spawn aTaskfor slow work. The legacyAuthController.after_install/3/insert_shop/1callbacks apply only to the OAuth controller flow.Shopifex.Plug.session_token/1now also reads theid_tokenquery parameter (in addition totokenandAuthorization: Bearer), andShopifex.Plug.ShopifySessionyields to a shop already loaded byManagedInstallinstead of re-authenticating.- Default GDPR webhook handlers in
ShopifexWeb.WebhookController(customers/data_request,customers/redact,shop/redact), overridable. appPurchaseOneTimeCreatesupport for one-time charges.create_charge/2is public and overridable, and the recurring mutation accepts optionalreplacement_behavior,discount,currency_code, andline_items(multiple items / usage pricing) from plan data. The newverify_charge/3callback checks the charge's status with Shopify beforecomplete_payment/2creates aGrant(AppSubscriptionACTIVE/ACCEPTED,AppPurchaseOneTimeACTIVE).docs/parity-matrix.md— behavior parity matrix vs Shopify JS and Ruby.docs/upgrading.md— step-by-step 2.x → 3.0 upgrade guide.Shopifex.Test— public test helpers (ships in the package) for forging the tokens/HMACs Shopifex verifies:sign_session_token/2,put_shopify_session/3,sign_webhook/2,put_webhook_hmac/3,sign_query_hmac/2. Lets consuming apps test controllers/LiveViews behind the:shopify_*pipelines without Shopify.Shopifex.Plug.ShopifyApiAuthnow setsx-shopify-retry-invalid-session-request: 1on its401, so App Bridge'sauthenticatedFetchtransparently retries with a freshid_token(embedded tokens live ~60s) instead of surfacing the error.joseis now an explicit dependency.Shopifex.RedirectAfter.Ecto— a persistent, multi-node-safe implementation of theShopifex.RedirectAfterAgentbehaviour, backed by ashopifex_charge_redirectstable (no supervised process to add). Configure withconfig :shopifex, :redirect_after_agent, Shopifex.RedirectAfter.Ecto;mix shopifex.installgenerates the config + migration for new apps. Use it instead of the in-memory default whenever the app runs on more than one node.config :shopifex, :configure_webhooks_on_exchange?(defaulttrue) — setfalseto skip the idempotent webhook reconcile on every token re-exchange (first install still registers). Set:webhook_topicsto[]to disable Shopifex webhook registration entirely (e.g. TOML-managed webhooks) —configure_webhooks/1then makes no GraphQL call at all, rather than fetching current subscriptions to reconcile against nothing.Shopifex.Plug.ValidateHmac, require_timestamp: true— a per-plug option that rejects any signed request lacking atimestamp(defaultfalsekeeps the existing "missing timestamp is allowed" behavior for non-proxy flows).Shopifex.Plug.LoadProxyShop— resolves the shop from a verified app-proxy request's signedshopparam and exposes it viaShopifex.Plug.current_shop/1. Included by default in the:shopify_proxypipeline (afterValidateHmac), so proxy controllers getcurrent_shopwithout a bespoke plug. Passon_missing: :haltto reject unknown shops with401(default:passis non-breaking —current_shopis simplynil).- Per-pipeline HMAC timestamp tolerance.
Shopifex.Plug.ValidateHmacaccepts atimestamp_tolerance_secondsplug option that overrides the globalconfig :shopifex, :hmac_timestamp_tolerance_seconds, so an app-proxy pipeline can allow more clock/lag drift without widening the admin-load replay window. - Legacy OAuth
install/2andupdate/2send the authorization-code grant form-encoded withexpiring=1and persisttoken_expires_at/refresh_token_expires_atvia the sameShopifex.TokenResponse.shop_attrs/2helper the managed-install exchange uses, so legacy-flow shops also get the full token lifecycle. The defaultAuthController.auth/2forwards the complete signed query (not just embedded-context params) when noid_tokenis present, so a legacy non-embedded landing route still has an HMAC to re-verify.
Fixed
Embedded pages render inside the Shopify admin again on Phoenix 1.8. Phoenix 1.8's
put_secure_browser_headers/2addscontent-security-policy: base-uri 'self'; frame-ancestors 'self';, andShopifex.Plug.LoadInIframeonly deletedx-frame-options. Browsers enforce every CSP header, so that header blocked the admin iframe ("refused to connect") alongside theframe-ancestorspolicyShopifex.Plug.SetCSPHeaderadds.LoadInIframenow also drops theframe-ancestorsdirective from eachcontent-security-policyheader, keeping its other directives.Shopifex.Plug.EnsureScopesnormalises scope lists before comparing them.config :shopifex, :scopesand the shop's storedscopewere split with a bareString.split/2, so an empty:scopesconfig raised on every request under the new:raisedefault (the "missing" scope was""), anilconfig crashed with aFunctionClauseError, and"read_products, write_products"(space after the comma) never matched Shopify's"read_products,write_products"; the legacy:redirectalso sentscope=,for an empty config.EnsureScopesandShopifex.Plug.ManagedInstall(which already trimmed) now both parse throughShopifex.Scopes.split/1: whitespace around scope names is ignored, empty segments are dropped, and an empty ornil:scopesconfig requires nothing. Missing scopes are reported trimmed, and the:required_scopesplug option also accepts a list of scope names.Managed install: concurrent embedded loads no longer race the token exchange.
Shopifex.Plug.ManagedInstallnow takes the per-shopShopifex.TokenRefreshLease(the leaseShopifex.Auth.refresh/1already uses) around everyid_tokenexchange. Two concurrent loads of a shop with a stale token previously both exchanged and the last response to arrive was persisted unconditionally, even when it had been issued first, leaving a refresh token Shopify had already retired (background refresh then failed until the next embedded load); two concurrent first loads both inserted the shop (raising on the uniqueurlindex, or leaving duplicate rows that madeget_shop_by_url/1raiseEcto.MultipleResultsError). Now exactly one load exchanges; the others poll the shop row and build their session from the persisted pair without contacting Shopify, and a first install inserts the row once. A re-exchange of an existing shop is persisted with the sameFOR UPDATEcompareShopifex.Auth.refresh/1uses (a@doc falsepersist_token_pair/2helper inShopifex.Auth; the write no longer goes throughShopifex.Shops.update_shop/2), so a pair written concurrently is kept andconfigure_webhooks/after_exchangeare skipped for the superseded exchange. A load that cannot obtain or observe the lease within:token_refresh_wait_timeout_ms(15 s default) logs a warning and exchanges without coordination, as before. Theshopifex_token_refresh_leasestable is therefore required by the plug, not only by background refresh (seedocs/upgrading.md§2).The plans page's Select request is authenticated outside the Shopify admin. With
payment_routes(shopify_embedded: false)the plans page is reached through the payment guard's path-boundredirect_token, but its Select button POSTed onlyplan_id/redirect_after, relying on App Bridge to attach the Bearerid_token— which it does only inside the admin iframe. Every non-embedded plan selection therefore fell to the store selector and the merchant could not pay (2.x posted a Guardian token in the same request).ShopifexWeb.PaymentHTML.select_plan_path/1now appends aredirect_tokenbound to the shop and to/payment/select-plan(valid for one hour) to the fetch URL when the page was authenticated without anid_token;Shopifex.Plug.ShopifySessionaccepts it there and nowhere else, so a captured page can at most start a pending charge the merchant must still approve.Shopifex.Plug.sign_redirect/3gains a:max_ageoption (default still 90 s) and embeds an explicitexpclaim thatverify_redirect/2enforces; tokens signed before this change (noexp) are rejected. Embedded pages render byte-identical output. If you overriderender_plans/3with your own template, POST toselect_plan_path(conn).Shopifex.Plug.FetchFlashworks on Phoenix 1.8. It now delegates toPhoenix.Controller.fetch_flash/2— on Phoenix 1.7+ the plug it wrapped was a no-op and a subsequentput_flashraised.Shopifex.Plug.PaymentGuardno longer needsRouter.Helpers, so it works withhelpers: falserouters. It builds the plan-picker redirect frompath_prefixandURI.encode_query/1instead of a generated route helper.Non-integer
charge_idvalues respond403instead of crashing.complete_payment/2parsescharge_idwithInteger.parse/1and rejects a non-integer value the same way as any other unverifiable confirmation, rather than raising.Token refresh no longer performs Shopify HTTP inside a
SELECT … FOR UPDATEtransaction. The outbound request now holds neither the consumer's shop row lock nor a database connection. A short final transaction re-checks token fields before persisting, preventing a concurrent managed-install exchange from being overwritten.Legacy OAuth
install/2andupdate/2are testable again. Both were the onlyReq.postcall sites that did not appendApplication.get_env(:shopifex, :req_options, []), so the authorization-code grant could not be stubbed and had no test coverage at all — including theString.to_atom/1whitelist fix below. They now follow the same pattern asShopifex.Auth,Shopifex.API, andShopifex.Plug.ManagedInstall, and are covered by tests for the success path, a rejected code, token rotation on update, and the response whitelist.complete_payment/2no longer 500s on a redirect-cache miss. It now responds403(aPlug.Conn) instead of returning a bare{:error, :forbidden}tuple, which raised unless the app had wired anaction_fallback.Managed-install
auth/2redirect carries embedded-context params. The redirect to the app root now forwardsshop/host/id_tokenso App Bridge can re-initialize on the landing page (a server 302 doesn't inherit them and third-party cookies are blocked), and the landing route's:shopify_sessioncan authenticate the hop.Legacy OAuth
install/updateno longer callString.to_atom/1on the token response (atom-exhaustion hardening) — known response keys are mapped via a fixed whitelist.mix shopifex.gen.migrationnow indexesgrants.shop_id. The generatedgrantstable only had a GIN index ongrants;grant_for_guard/2filters byshop_idon every guarded request, so a plain btree index is now emitted (the migration generator gained an:indexindex type).mix shopifex.install's generated Grant schema compiles. It previously emitted an invalidfield :shop_id, {:references, ...}. The generated migration also createsshopifex_charge_redirects, and the grants→shops foreign key ison_delete: :delete_all.Managed-install token refresh is driven by token expiry, not
updated_at.Shopifex.Plug.ManagedInstallnow re-exchanges the offline access token whentoken_expires_atis within ~10 minutes of expiry (consistent withShopifex.Auth), instead of when the shop row'supdated_ataged past 50 minutes — an unrelated update to the shop row no longer masks an expired token.Macro billing flow now creates the grant.
Shopifex.RedirectAfterAgentset/2andget/1disagreed on key type (string vs integer), so the charge-id keyed lookup incomplete_payment/2missed and theGrantwas never created. Both now coerce the key consistently.Multi-node billing no longer drops grants. The billing redirect store is the in-memory, node-local
Shopifex.RedirectAfterAgentby default, so on a multi-node deploy (Fly.io, multiple pods) Shopify's/payment/completeredirect could land on a node with no cache entry — the merchant was charged but noGrantwas created, silently. Two changes fix this: (1)Shopifex.RedirectAfter.Ectois a shipped, DB-backed implementation that is safe across nodes (see Added), andmix shopifex.installnow generates it as the default for new apps; (2) when the lookup misses,complete_payment/2logs an actionableLogger.errorinstead of failing silently.Legacy OAuth authorization URLs are properly encoded.
Shopifex.Plug.ShopifySession's install redirect andShopifex.Plug.EnsureScopes's re-authorization redirect now build their query string withURI.encode_query/1, soscopeandredirect_uriare percent-encoded rather than interpolated raw. Also removed an unusedrequire LoggerfromShopifex.Plug.ShopifyApiAuth.Managed install picks up approved scope updates. When a shop's stored
scopelacks a scope listed inconfig :shopifex, :scopes,Shopifex.Plug.ManagedInstallre-exchanges theid_tokeneven though the access token is still fresh, and persists Shopify's current grant. Previously a merchant who had approved new scopes hitEnsureScopes's raise until the token aged into the refresh window — never, for a legacy nil-expiry shop.Shopifex.Plug.PaymentGuard's redirect stays authenticated without an App Bridge token. The redirect to/payment/show-plansnow carries a short-livedredirect_token(Shopifex.Plug.sign_redirect/3, 90 s) bound to the plans path, in addition to forwarding anid_tokenastokenwhen one is present.Shopifex.Plug.ShopifySessionaccepts the token only at the path signed into it, so a captured link cannot authenticate any other route or be used to mint a fresh credential. A legacy HMAC-authenticated or non-embedded request therefore reaches the plans page instead of the store selector.
Changed
- Webhook reconciliation lists up to 250 subscriptions (Shopify's maximum page size) instead of 100, so a topic past the first page is not re-created and delivered twice. The list is per app and per shop and Shopifex creates one subscription per configured topic, so the query is not paginated.
- The default Shopify Admin GraphQL API version is
2026-07(config :shopifex, :api_version). - Billing mutations no longer send
@idempotent. Shopify does not document the directive forappSubscriptionCreate/appPurchaseOneTimeCreate, and the official JS/Ruby libraries omit it. Recurring line items are passed as a$lineItemsGraphQL variable rather than interpolated into the query. - Webhook subscriptions self-heal.
Shopifex.Plug.ManagedInstallnow reconciles webhooks (idempotentconfigure_webhooks/1) on existing-shop token re-exchanges, not just first install — recovering from a registration that failed at install or topics added to:webhook_topicslater. It runs at the token-exchange cadence (at the same ~10-minute-before-expiry cadence as the token refresh itself), never on the hot per-load path. - Built-in pages use the Shopify-hosted App Bridge + Polaris web components.
The auth / payment / redirect pages now load App Bridge and Polaris from
cdn.shopify.comwith a<meta name="shopify-api-key">tag, and are rendered with Polaris web components (s-page,s-section, …) — no React. The vendored@shopify/app-bridge@3+ Polaris 4/7 bundle (assets/,priv/static/) was removed, so apps no longer need thePlug.Static at: "/shopifex-assets"endpoint entry. Themix shopifex.installtask no longer prints it. postgrexis now a:dev/:test-only dependency. The library never calls Postgrex directly (only the test dummy repo does); downstream apps already bring their own driver.cors_plugconstraint widened to~> 2.0 or ~> 3.0so downstream apps aren't pinned to the 2.x line.- Tests use
Req.Teststubs;exvcrand its cassettes were removed, along with orphanedmix.lockentries (jsx,exjsx,meck) left over from it.
2.0.1 - 2021-08-25
Added
- Ensure that the current shop scopes in the session are up-to-date based on config :shopifex, :scopes when the request is passed through :shopify_session or :shopify_admin_link pipelines.
- Add Shopifex.Plug.EnsureScopes plug which redirects to Shopify OAuth update if current shop scopes are not up-to-date
Changed
2.0.0 - 2021-08-17
Added
Changed
- Move
show_plansoptional callback fromShopifex.PaymentGuardbehaviour torender_plansinShopifexWeb.PaymentControllerbehavour