Shopify
Require wallet age verification at checkout for selected Shopify products.
Let shoppers browse your store and require proof of being 18 or over when their checkout contains selected products. Shopify manages the customer account and checkout. Ver.iD verifies the wallet credential; your connector records a temporary permission for that signed-in customer.
This guide uses Yivi and asks for its over-18 attribute. It does not request a birthdate or copy identity documents into Shopify. For wallet login to customer accounts, follow Shopify Plus customer login.
How it works
In this diagram, Client is the connector backend. A theme block starts the journey, and a Cart and Checkout Validation Function checks the result independently on Shopify's servers. A browser flag or a hidden checkout button cannot grant permission. See Shopify's validation API.
- A signed-in customer selects Verify I am 18 or over with Yivi in the store.
- Shopify forwards a signed request identifying the store and customer to the connector.
- The connector starts a Ver.iD disclosure. The customer approves the over-18 attribute in Yivi.
- The connector validates the signed result and confirms that the same Shopify customer is still signed in.
- It writes an app-owned permission valid until the next midnight in the shop's timezone.
- Shopify's Function permits checkout containing restricted products only while that customer's permission is valid.
What you need
| Requirement | Where to get it |
|---|---|
| Shopify Plus, store-owner access and a custom developer app | Your Shopify developer organization |
| A store eligible for your app's Functions distribution | Shopify Functions availability |
| The connector backend, age adapter, validation Function and theme extension | Download the Shopify age-verification example (ZIP) |
| Node.js 22.12 or later and Corepack/Yarn | The connector host |
| A public HTTPS origin for the connector, with persistent Host headers and cookies | Your hosting administrator |
| A prepared Studio organization and Yivi activated | Prepare your organization |
| A dedicated disclosure and attached OAUTH secret | Create a disclosure and OAuth secrets |
| Yivi with the trusted over-18 credential | Your wallet; see wallet availability and status |
The downloadable custom app contains a Shopify Function and requires Shopify Plus. App Store distribution has different plan rules; this guide covers the custom-app route. See Shopify Function availability.
Use these values throughout the guide:
| Value | Description |
|---|---|
<connector-origin> | Public HTTPS origin without a trailing slash, such as https://age.example.com |
<shop> | The canonical your-store.myshopify.com hostname |
| Shopify OAuth callback | <connector-origin>/oauth/callback |
| Ver.iD disclosure callback | <connector-origin>/wallet/callback |
| Shop timezone | The IANA timezone configured on the store, such as Europe/Amsterdam |
| Client ID and secret | Separate credentials for the Shopify app and the Studio disclosure |
The connector uses Shopify Admin and Function API version 2026-10. Keep the extension manifest, generated schema and deployed app version aligned.
Configuration
This example marks one product as requiring proof of being 18 or over. A signed-in customer completes a wallet disclosure, returns to the cart and can continue checkout until the permission expires.
Download the Shopify age-verification example (ZIP) and extract it. Open examples/integrations in the extracted bundle. It contains the sibling age, shopify and shopify-backend directories used below. Keep that layout: the backend imports the shared disclosure adapter and the Function build imports the shared age policy.
In your Shopify developer dashboard, select the app's distribution method and enable the protected customer data access needed for its customer metafield. See Shopify's customer-data access procedure.
Configure Ver.iD
- Create a disclosure for this store and environment. Select Yivi and the trusted
pbdf.gemeente.personalData.over18attribute. - Create a mapping. Set both its input key and output claim to
ageOver18, and use:
(attributeData) => attributeData.ageOver18 === 'Yes';This comparison accepts the exact positive Yivi value Yes. It returns a JSON boolean; the strings "true", "false" and "Yes / No" are not positive proof.
- Attach the mapping to the disclosure. Open Settings → Edit and set Token type to
ver-id/ssi/disclosure/v1+JWT. - In Ver.iD Studio → Verify → Disclosures → your flow → Redirect URIs, add
<connector-origin>/wallet/callback. Attach an OAUTH secret, choose an active brand and activate the flow. - Test the disclosure. The signed result must contain boolean
trueatmapping.ageOver18.valuefor a positive credential.
Keep the disclosure client identifier, organization UUID and secret's Key (as base64url) value. Obtain the expected signing issuer from your Ver.iD deployment administrator; it can differ from the HTTPS discovery issuer.
Configure the connector
Install the pinned dependencies with corepack yarn install --immutable in age and then in shopify-backend. In shopify-backend, copy .env.example to a private .env and fill in:
| Variable | Value |
|---|---|
APP_ORIGIN | <connector-origin> |
SHOPIFY_SHOP | <shop> |
SHOPIFY_API_KEY | Your developer app's Client ID |
SHOPIFY_API_SECRET | That app's client secret |
SHOP_TIMEZONE | The store's IANA timezone |
SESSION_SECRET | A separate private random value of at least 32 characters |
VERID_ISSUER | https://ssi.oauth.ver.id/ |
VERID_DISCLOSURE_CLIENT_ID | The disclosure's client identifier |
VERID_CLIENT_SECRET | Its attached secret's Key (as base64url) value |
VERID_ORGANIZATION_UUID | The organization that owns the disclosure |
VERID_TOKEN_ISSUER | The expected signing issuer from trusted configuration |
Supply this environment through your host's private configuration mechanism. Route the HTTPS origin to the backend's configured PORT and preserve Host and cookies. Disable caching and request logging for the OAuth, wallet, proxy and /verify/<ticket> routes: both query strings and ticket-bearing paths contain temporary authorization data. Keep TLS certificate validation enabled.
Build and install the developer app
In shopify-backend, sign in to the Shopify CLI with the account that owns the developer app, then run the configuration and build helpers:
corepack yarn exec shopify auth login
node scripts/shopify.mjs link
node scripts/shopify.mjs configure
node scripts/shopify.mjs schema
node scripts/shopify.mjs build
node scripts/check-function.mjsThe link helper selects the app using SHOPIFY_API_KEY from your private .env; it does not prompt for a different app. configure creates the app manifest from the supplied template. Confirm these settings:
| Setting | Value |
|---|---|
| Application URL | <connector-origin> |
| Embedded app | false |
| OAuth redirect URL | <connector-origin>/oauth/callback |
| Access scopes | write_products,write_customers,write_validations,write_app_proxy |
| App proxy URL | <connector-origin>/proxy |
| App proxy prefix and subpath | apps and verid-age |
| Function API version | 2026-10 |
| Function handle | verid-age-validation |
| Function target | cart.validations.generate.run |
Resolve schema, type-generation, theme and Wasm build errors before deploying. Preserve the Function and theme extension UIDs assigned to your own app; never copy another app's UID. Upload a version for review:
node scripts/shopify.mjs deployThe command uploads without releasing. In the Dev Dashboard, open Apps → your app → Versions, select the uploaded version and choose Release when its configuration and extensions are correct. App deployment does not host the connector backend or activate the checkout rule. See Shopify's version-release procedure.
Start the backend with the private environment supplied:
node --env-file=.env server.mjsOpen <connector-origin>/install and authorize your development store. The callback returns to Configure Ver.iD age verification. The storefront password alone does not authorize the app.
Activate enforcement and select products
- In the connector's configuration page, select Check private app-owned definitions.
- Select Activate deployed checkout validation. The connector enables its own deployed Function with
blockOnFailure=true. - In Shopify Admin, open Settings → Checkout → Checkout Rules and confirm that the Ver.iD rule is active. Its runtime-failure setting must block checkout; leave Allow all customers to submit checkout disabled. See Shopify's activation procedure.
- In the connector, enter the restricted product's Product GID, tick Require age verification and select Save product restriction. Use the product's Admin API identifier, not a variant or customer identifier.
- Leave a second product unrestricted. To remove a restriction later, save the same Product GID with the checkbox cleared.
- Open the store's theme editor and add the Ver.iD age verification block. Keep its app-proxy route at
/apps/verid-age.
To find the Product GID, run this Admin API product query through your app's authenticated GraphQL client and copy the intended product's id:
query ProductsForAgeVerification {
products(first: 20) {
nodes {
id
title
}
}
}The rule must be enabled as well as deployed. Shopify's blockOnFailure setting also blocks runtime exceptions; returning a validation error already blocks checkout progress.
Complete the customer journey
- Open the storefront in a fresh browser session, pass its development-store password page and sign in as a customer. A Shopify administrator session is separate.
- Add the restricted product and attempt checkout. It must remain blocked without age permission.
- Return to the store and select Verify I am 18 or over with Yivi. On the handoff page, select Continue to age verification to open the connector's HTTPS origin, then select Verify with Yivi.
- Scan the request with Yivi and approve the over-18 attribute. Continue in the original browser.
- Return to the cart as the same Shopify customer. Checkout should permit a test order until the next midnight in the store's timezone.
- Repeat with only the unrestricted product, then a mixed cart. The unrestricted cart needs no age permission; the mixed cart does.
Cancel a new disclosure and confirm it creates no permission. Signed-out checkout, an expired permission and direct checkout of a restricted product must remain blocked. An unrestricted product must still be purchasable without a disclosure.
Restarts and account binding
Run one backend process. Browser sessions use PostgreSQL, but merchant authorization and pending disclosure transactions are process-local. After a backend restart, open /install to authorize the store again, then repeat the definition and checkout-rule activation checks. Restart interrupted wallet requests.
The permission is bound to the signed-in Shopify customer account. It does not establish that the wallet holder is the named owner of that account. Keep the checkout rule's blockOnFailure=true setting.