complete-age-verification operation.
How It Works
- Enable
age_verificationon the session (or session profile). - The customer opens checkout and verifies their age before they can pay.
- They authenticate with BankID or MitID.
- The session records
AGE_VERIFICATION_COMPLETEDwithverified_identity.age_over. - Checkout continues as usual. The transaction copies that identity unless the payment type already has one.
Step-by-Step Implementation
1. Configure the Session
Setage_verification on POST /v1/sessions:
2. Customer Completes Verification
Hosted checkout. Nothing extra to build. Checkout asks the customer to verify their age before they can pick a payment method, then sends them to BankID or MitID and brings them back to the session. Custom or API checkout. If you start a payment while verification is still required, the response contains only this operation:href. After they pass, they come back with sid. Retry the payment. The operation is gone once age_over meets minimum_age_required.
Starting verification again reuses the pending identity-provider URL for a few minutes, so the customer is not sent through BankID or MitID twice.
3. Receive the Session Event
A successful verification appendsAGE_VERIFICATION_COMPLETED. The national identity number is never included.
verified_identity is copied onto it.
Configuration Options
The identity provider country is taken from, in order:
order.billing_address.countryorder.shipping_address.countryconfiguration.countries.preferred_country
If the country is missing or unsupported, the customer picks from the providers above.
Verified Age
The exact age is not stored.age_over is the highest of 21, 18, 16, and 15 that the customer meets, and that is still at least minimum_age_required.
Failures and Redirects
If verification fails or is cancelled, the customer is sent back to the session URL witherror and merchant_reference (when available). Embed context (ui, sdk) is kept.
Direct Pay
POST /v1/sessions/{session_id}/pay is blocked until verification completes:
redirect_url, then retry the pay request.
The customer has to complete verification themselves. Merchant-initiated or headless pay can still use age verification if you send the customer to
redirect_url first, but it may not fit flows where no customer is present.Identity Verification
If a payment type on the session also needs identity verification, age verification collects that identity at the same time. The customer is not asked to authenticate twice. The national identity number is never exposed on the session event or on the transaction in API responses. If the payment type later verifies identity itself, that identity is kept on the transaction.See Also
- Create a session: enable
age_verificationwhen you create the session - Show checkout: hosted checkout handles the redirect for you
- Handling payment: the transaction after checkout completes