VerifyID

Magento 2

Install and configure the VerifyID age verification module for Magento 2 and Adobe Commerce, with MitID and BankID.

Overview

The VerifyID module for Magento 2 adds age verification with MitID (Denmark) and BankID (Sweden). Shoppers verify their age before checkout in the VerifyID card, which covers the page, and the module checks the verification again on the server when the order is placed, so an unverified age-restricted order cannot be placed through any checkout.

ItemValue
ModuleVerifyID_AgeVerification
Composer packageverifyid/module-age-verification
Version1.0.0
LanguagesDanish, Swedish, Norwegian (Bokmål), English, with a language switch in the verification card
Downloadverifyid-magento2.zip on the Plugin page of the VerifyID Dashboard
LicenceProprietary licence from VerifyID ApS (LICENSE.txt in the zip)

The module calls the VerifyID API for you. You do not need the API endpoints from the other pages of these docs.


Requirements

ComponentRequirement
MagentoMagento Open Source 2.4.6 – 2.4.9, or Mage-OS releases based on them (tested: 2.4.6-p15, 2.4.7-p10, 2.4.8-p5, 2.4.9 and Mage-OS 3.6.0; Adobe Commerce runs the same code paths but was not tested)
PHP8.1 – 8.5, within the range your Magento version supports (8.5 only with Magento 2.4.9)
VerifyIDAn active VerifyID subscription and the plugin key from the VerifyID Dashboard
ServerOutbound HTTPS (port 443) to app.verifyid.dk, the storefront served over HTTPS, Magento cron running
ThemesLuma and Luma-based themes, Hyvä Theme (no compatibility module needed)

Installation

Install the module one way only: the zip in app/code or Composer. Installing both makes Magento report that the module is already defined. Run every command from the Magento root as the user that owns the Magento files (not root).

In the VerifyID Dashboard, open Plugin, choose the MitID Plugins or BankID Plugins tab and click Download on the Magento 2 card. Both tabs give the same file, verifyid-magento2.zip, which contains app/code/VerifyID/AgeVerification.

Terminal
cd /path/to/magento
unzip /path/to/verifyid-magento2.zip
bin/magento maintenance:enable
bin/magento module:enable VerifyID_AgeVerification
bin/magento setup:upgrade
bin/magento setup:di:compile
bin/magento setup:static-content:deploy da_DK en_US   # every locale you use
bin/magento cache:flush
bin/magento maintenance:disable

To upgrade, run bin/magento maintenance:enable first, then delete app/code/VerifyID/AgeVerification, unzip the new version and run the commands from setup:upgrade on. Replace the files only while maintenance mode is on.

The Composer package is a zip with composer.json at its root (verifyid-module-age-verification-1.0.0.zip). Use it as an artifact repository:

Terminal
cd /path/to/magento
mkdir -p artifacts
cp /path/to/verifyid-module-age-verification-1.0.0.zip artifacts/
composer config repositories.verifyid artifact ./artifacts
composer require verifyid/module-age-verification:1.0.0
bin/magento maintenance:enable
bin/magento module:enable VerifyID_AgeVerification
bin/magento setup:upgrade
bin/magento setup:di:compile
bin/magento setup:static-content:deploy da_DK en_US
bin/magento cache:flush
bin/magento maintenance:disable

Commit composer.json, composer.lock and artifacts/ to your deployment repository. To upgrade, add the new zip to artifacts/, run bin/magento maintenance:enable, then composer require verifyid/module-age-verification:<new version> and the commands from setup:upgrade on.

List every locale your store views and admin users use in setup:static-content:deploy (for example da_DK sv_SE nb_NO en_US). Check the result with bin/magento module:status VerifyID_AgeVerification.

After installing

Connect your account

Add the plugin key and enable the module (Configuration). The module stays disabled until you enable it.

Register every storefront host

Add each host to your VerifyID account (Register your storefront domains).

Set ages

Set ages on products, categories, tags or a store default (Setting ages).

Check cron and test

Make sure Magento cron runs (the module adds verifyid_cleanup daily and verifyid_pending_holds every 15 minutes). Then place one test order per storefront host with a real MitID or BankID. Each test is a billed verification.


Configuration

Open Stores › Configuration › VerifyID › Age Verification. Admin users need the ACL resource VerifyID Age Verification. Most settings, including Enable, the plugin key and the MitID/BankID switches, are set at Default Config or website scope; Preferred Method, texts and appearance can also be set per store view.

Plugin key

  1. Copy your plugin key from the VerifyID Dashboard.
  2. Paste it into Plugin Key, set Enable Age Verification to Yes and click Save Config.
  3. Click Test Connection. It checks the key and the account status without starting a verification, so nothing is billed. The result also lists the storefront hosts of this scope that you must register.

From the command line: bin/magento verifyid:ping (also free).

The plugin key works like a password to your VerifyID dashboard. The module stores it encrypted, never sends it to browsers and never writes it to a log. Do not email it or paste it into support tickets.

Main settings

SettingDefaultNotes
MitID (Denmark)YesVerifies 16+ and 18+ only
BankID (Sweden)NoVerifies every age tier
Preferred MethodAutomaticThe method named in the cart notice when both methods can verify the cart. It does not change the card: the card always shows a button for every method that can verify the cart, MitID first.
Store Default AgeNoneApplies to products with no own, tag or category age
Tags Attribute(none)Product attribute holding tags such as 18+ or +18
Verification Valid For (minutes)60How long a verification counts for the shopper's cart and browser session (15 – 1440)
Exempt Customer Groups(none)For example verified B2B groups. Guests can never be exempt.
Admin-created OrdersSkip and add an order commentOr Require a valid verification
When VerifyID Is UnavailableBlock restricted ordersFail closed (recommended). The alternative accepts and puts the order on hold for manual review.
Allow Self-declarationNoFor customers outside Denmark and Sweden; accepted only when the order is not delivered to a covered country
Checkout Gate Routescheckout_index_indexPages that send shoppers with an unverified, age-restricted cart to the verification page first
Verify on All PagesNoA blocking overlay on every page until the visitor is verified

Texts (per store view, plain text only), appearance (logo, colours, z-index and the language switch) and the start limits under Advanced can also be changed. Leave Advanced at its defaults unless VerifyID support asks otherwise.


Register your storefront domains

VerifyID only accepts verifications from hosts registered in your VerifyID account, and every verification start is billed, including starts that VerifyID refuses because the host is not registered.

Register every host where shoppers verify:

  • each website's and store view's secure base URL host, with and without www (for example shop.dk, www.shop.dk, shop.se, www.shop.se);
  • every staging or test host on which you use a live plugin key.

Shoppers return from MitID or BankID to https://your-host/verifyid/verify/return, and VerifyID checks that host. Test Connection lists the hosts it finds, but cannot confirm that they are registered: only a real (billed) verification can, so verify once yourself on each host after go-live.

If a host is not registered, VerifyID answers 403, the admin shows a notice naming the host, and the module pauses new verifications for that store view so the failures are not billed again and again. Register the host, then click Test Connection to end the pause.


MitID and BankID

Cart requiresMitIDBankID
16+YesYes
18+YesYes
19+, 20+, 21+, 23+, 25+NoYes
  • MitID can only verify 16+ and 18+. When both methods are enabled, the card shows both buttons, MitID first. When the cart needs 19+ or more, the card shows only the BankID button, with one line saying that MitID can verify only 16+ and 18+.
  • If only MitID is enabled and the cart needs more than 18+, the shopper cannot check out. Enable BankID or use 16+/18+ ages only. When you save the configuration, the admin warns you about ages above 18+ that no enabled method can verify.
  • A verification counts only when the verified tier is at least the cart's requirement. If the shopper adds a product with a higher age, they verify again.
  • The module stores only the tier (for example 18+), never the shopper's exact age, name or CPR/personal identity number.

What shoppers see

When a verification is needed, an opaque full-screen layer covers the shop and only the VerifyID card shows: the VerifyID logo (or yours), a title, a short text, two numbered steps and one full-width button per method. It is the card of the earlier VerifyID plugins. The page stays loaded underneath, so the checkout carries on after the verification.

WhereWhenCan the shopper close it?
Verification page /verifyid/verifyThe checkout gate sends a shopper with an unverified, age-restricted cart here before checkout. Works without JavaScript.No. A small back to cart link leads back to the cart.
Cart page and checkoutThe shopper clicks the link in the cart notice, or the order was blocked at placement because the cart is not verifiedYes, with × or Escape. The cart and checkout stay as they were.
Every pageVerify on All Pages is on and the visitor is not verified yetNo

Buttons

Methods enabledCart needs 16+ or 18+Cart needs 19+ to 25+
MitID and BankIDMitID and BankID, MitID firstBankID only, with a line saying why MitID is missing
MitID onlyMitIDNo button: the shop cannot verify this cart
BankID onlyBankIDBankID

The order is always MitID, then BankID; Preferred Method does not change it. A method that VerifyID has paused after repeated errors stays on the card as a disabled button with the reason.

One click, one verification

Each click on a MitID or BankID button starts one verification, and VerifyID bills every started verification, including one that the shopper cancels or that fails. While a start runs, every button on the card is disabled, so a double click cannot start two. Opening or closing the card and switching its language start nothing. If the shopper clicks the same button again within 5 minutes without finishing, they return to the verification that is already open, and nothing new is billed.

Language switch

The card has a small language menu in its top corner: Dansk, Svenska, English and Norsk.

  • The store view's language is the default. Danish, Swedish and Norwegian store views open the card in their language; every other locale opens it in English.
  • A choice changes the card's texts at once, without reloading the page, and is kept while the shopper stays in the same browser tab. It changes only the card, not the rest of the shop.
  • Your own texts (Texts) are shown in the store view's language. The other languages use the module's built-in texts.

Set it under Stores › Configuration › VerifyID › Age Verification › Appearance, per store view if you like:

SettingDefaultNotes
Show language switchYesNo hides the menu; the card then uses the store view's language only
Languages in the switchDansk, Svenska, English, NorskThe store view's own language is always offered. With only that language, the menu is hidden.

Setting ages

Age tiers: 16+, 18+, 19+, 20+, 21+, 23+, 25+. A product with no age requirement needs no verification.

Where to set them

  • Product: Catalog › Products › (product) › VerifyID Age Verification › VerifyID age requirement: Use category / store default, Exempt, or a tier. The attribute has global scope (one value for all store views).
  • Many products: in the product grid, select products, then Actions › Set VerifyID age.
  • CSV import: column verifyid_age_requirement with Exempt, 16+, 18+, … (empty = use category / store default).
  • Category: Catalog › Categories › (category) › VerifyID Age Verification › Age Requirement. Subcategories inherit it when Age Rules › Categories Inherit Parent Ages is on (default).
  • Store default: Age Rules › Store Default Age, for a store-wide requirement.
Terminal
bin/magento verifyid:category:set-age 12 18               # category 12 requires 18+
bin/magento verifyid:category:set-age 12 21 -r --dry-run  # preview 21+ for category 12 and subcategories
bin/magento verifyid:category:set-age 12 none             # remove the requirement
bin/magento verifyid:product:explain <SKU>                # show how a product's age is worked out

Order of precedence

  1. Exempt on the product beats everything.
  2. Otherwise the higher of the product's own age and its tag age. A product's own value wins even when it is lower than its category's.
  3. Otherwise the highest age among the product's categories. Store root categories (for example Default Category) are ignored.
  4. Otherwise the Store Default Age.

For the cart, the highest line wins:

  • configurable product: the parent's age, or the selected child's when the child has its own value;
  • bundle product: the highest of the bundle and its selected children;
  • grouped product: the higher of the item and its grouped parent.

Example. Category Beer is 18+ and category Spirits is 21+. A whisky in both categories needs 21+. An alcohol-free beer in Beer set to Exempt needs nothing. A cart with a beer and the whisky needs 21+, so the card shows only the BankID button.

Tags (18+ or +18)

Choose a text, select or multiselect product attribute under Age Rules › Tags Attribute. Values are split on commas, semicolons, | and new lines. A tag counts only when it is exactly NN+ or +NN with a known tier; when several match, the highest wins.

Attribute valueTag age
18+18
+2121
beer, 18+18
18+; +2121
Alcohol 18+none (not an exact tag)
18none (no +)
17+none (not a known tier)

How enforcement works

  1. A cart with age-restricted items shows a notice, and the checkout gate sends the shopper to the verification page (/verifyid/verify) before checkout, where the VerifyID card covers the page (What shoppers see).
  2. The shopper clicks MitID or BankID, verifies and returns to the shop. The module checks the result from the server. A verification is single use, tied to the browser that started it, and valid for 60 minutes by default.
  3. At order placement, every way of placing an order runs the same server-side check: Luma checkout, Hyvä Checkout, one-step checkouts, REST, GraphQL, express checkouts, multishipping and admin orders. Without a valid verification for the cart's age, the order is not created. Browser-side checks alone are never trusted.

Each order records the VerifyID status, method, verified tier, required age and time, in the order view and as columns in the Sales › Orders grid.

Exceptions

These orders are not checked against a verification. Review them before you rely on the module for compliance.

CaseDefault
Admin-created ordersSkipped, with an order comment (or set Require a valid verification)
API orders with an integration or admin token (ERP, POS, marketplaces)Skipped and recorded on the order (Skip Check for Integrations)
Orders written straight to the order repository (POST /V1/orders, bulk imports)Treated as trusted imports: not checked, not recorded
Cron and CLIChecked (Skip Check for Cron and CLI = No)
Exempt customer groupsSkipped and recorded
Self-declaration (when enabled)Accepted only for orders not delivered to a covered country, and recorded
VerifyID unavailable or no valid plugin keyRestricted orders blocked (fail closed), unless you choose accept and hold

Headless storefronts: version 1.0 enforces the check on REST and GraphQL orders, but has no API to start a verification from a headless frontend. That API is planned for version 1.1.


Hyvä

  • Hyvä Theme works without extra configuration or a compatibility module. The storefront script has no dependencies (no RequireJS, Knockout, Alpine.js or Tailwind), renders the card on the cart and checkout in a Shadow DOM and reads the shopper's state from Hyvä's private content. The card uses no theme classes.
  • Hyvä Checkout is covered twice: the checkout gate (checkout_index_index) sends unverified shoppers to the verification page before the checkout loads, and the order placement check blocks the order if the cart changed in the meantime. Hyvä Checkout shows the module's message.
  • Other one-step checkouts: add their full action name (for example onestepcheckout_index_index) to Checkout Gate Routes. The placement check works regardless.

The module also works with Magento's full-page cache and Varnish without VCL changes. If your CDN strips unknown query parameters, keep token_age_verified and token_age_verified_new on /verifyid/verify/return.


Troubleshooting

The module logs to var/log/verifyid.log (more detail with Advanced › Debug Logging). The log never contains the plugin key, verification tokens, device ids or shopper names, so you can send it to VerifyID support.

SymptomCause and fix
VerifyID answers 403; admin notice "VerifyID refused verifications for website …"The subscription is not paid, or the storefront host is not registered. Pay or register the host, then click Test Connection to end the pause.
Test Connection: "Could not reach VerifyID"The server cannot make outbound HTTPS requests to app.verifyid.dk. Check the firewall, proxy and DNS.
Test Connection: "The plugin key was not recognised"Copy the key again from the dashboard, without spaces. Check the scope (Default Config or website).
Shoppers see "Age verification is temporarily unavailable"VerifyID failed repeatedly and new starts are paused (15 minutes by default), or the key or account has a problem. Check the admin notice and the log.
The cart says the shop cannot verify the ageThe cart needs more than 18+ and only MitID is enabled. Enable BankID.
The card shows only the BankID buttonThe cart needs 19+ or more, which MitID cannot verify. This is expected.
The card has no language menuAppearance › Show language switch is No, or Languages in the switch offers only the store view's language.
A shopper verified but checkout asks againThe verification expired, a product with a higher age was added, or the shopper finished in another browser or app. They verify again in the same browser.
"Too many verification attempts" for many shoppers at onceThe shop runs behind a proxy, CDN or load balancer and all shoppers share one IP limit. Configure trusted proxies (below).
Orders On hold (verification unavailable)When VerifyID Is Unavailable is set to accept and hold. Check the customers' ages before these orders ship.
The card appears behind the header or cookie bannerRaise Appearance › Overlay z-index.
A product has an unexpected ageRun bin/magento verifyid:product:explain <SKU>. Store root categories are ignored and a product's own value beats its categories.
CSP blocks the redirect to MitID or BankIDThe module's CSP whitelist adds https://netseidbroker.dk and https://www.ident.nets.eu to form-action. If you set CSP outside Magento, add them there.

Behind Varnish, a load balancer or a CDN

PHP then sees the proxy's IP address. Tell the module which proxies to trust in app/etc/env.php; it uses the rightmost address in the forwarding header that is not a trusted proxy:

app/etc/env.php
'verifyid' => [
    'client_ip' => [
        // IPs or CIDRs of every proxy in front of PHP
        'trusted_proxies' => ['10.0.0.0/8', '172.16.0.0/12'],
        // $_SERVER key of the forwarding header; default HTTP_X_FORWARDED_FOR
        'header' => 'HTTP_X_FORWARDED_FOR',
    ],
],

For Cloudflare, list Cloudflare's IP ranges and set header to HTTP_CF_CONNECTING_IP.

Switching off or uninstalling

To switch VerifyID off, set Enable Age Verification to No. Uninstalling deletes VerifyID's data, including the age-verification details stored on orders, so export what you need for audits and back up the database first. Follow the uninstall steps in README.md inside the zip.

On this page