Looking for ePay classic docs? Go to docs.epay.dk
ePay documentationDocsePay documentation

With Verify

Use this guide if you need to verify the customer's age as part of the payment flow.

ePay Verify lets you add age verification directly to ePay Checkout. This is useful when selling age-restricted products where you need to confirm that the customer meets a required minimum age before the payment can be completed.

Verify works as part of the payment session. Your backend creates a payment session with age verification requirements, and ePay handles the verification flow in Checkout.

What you will build

In this guide, you will:

Create an order in your system

Create a payment session with age verification

Redirect the customer to ePay Checkout

Let ePay handle the age verification flow

Complete a test payment

Receive the payment result

Confirm that your order can be updated correctly

How Verify works

Verify adds an age verification requirement to a payment session.

The basic flow is:

Customer starts checkout on your website

Your backend creates a payment session with age verification

ePay returns the information needed to open Checkout

Customer opens ePay Checkout

ePay determines whether age verification is required

Customer completes the age verification if needed

Customer completes the payment

ePay sends the payment result to your backend

How the verification is handled depends on the selected payment method.

For MobilePay, ePay can use available age information from MobilePay/Vipps. If the customer does not meet the age requirement, the payment is declined in the MobilePay/Vipps flow.

For cards and other payment methods, the customer may be asked to verify their age with MitID in Checkout. If the verification succeeds, the customer can continue the payment. If the verification fails, the payment cannot be completed.

Example: Start age verification before payment

This example creates a payment session with age verification and shows a button that starts the verification flow.

script.js
// -------------------------------// Payment Request Setup// -------------------------------// Create headers for the payment requestconst headers = new Headers();const demoApiKey = "test_93dc98ae-ff87-4671-a821-cda33fdfc26e"; // Demo API key: NEVER use this client-side in productionheaders.append("Content-Type", "application/json");headers.append("Accept", "application/json");headers.append("Authorization", `Bearer ${demoApiKey}`);// Define the payment payload dataconst paymentData = {  pointOfSaleId: "0195a362-5bf4-7bb9-a419-2367fda11e6f",  amount: 100, // minor amount  currency: "DKK",  ageVerification: {    minimumAge: 18,    country: "DK",  },};// Setup the fetch optionsconst requestOptions = {  method: "POST",  headers: headers,  body: JSON.stringify(paymentData),  redirect: "follow",};// -------------------------------// Helper: Create Verify Button// -------------------------------function createVerifyButton() {  const button = document.createElement("button");  button.id = "payment-button";  button.textContent = "Verify age and continue to payment";  document.body.appendChild(button);  return button;}// -------------------------------// Helper: Dynamically Load External Module// -------------------------------/** * Dynamically loads an external script module. * * @param {string} scriptUrl - The URL of the external module. * @param {Function} onLoadCallback - A callback function to run once the module loads. */function loadExternalModule(scriptUrl, onLoadCallback) {  const scriptEl = document.createElement("script");  scriptEl.type = "module";  scriptEl.src = scriptUrl;  scriptEl.onload = onLoadCallback;  document.body.appendChild(scriptEl);  console.log("Dynamically loading external script:", scriptUrl);}// -------------------------------// Payment Request & Hosted Fields Initialization// -------------------------------fetch("https://payments.epay.eu/public/api/v1/cit", requestOptions)  .then((response) => response.json())  .then((result) => {    console.log("Payment response:", result);    // Extract session and payment details from the response    const sessionId = result.session.id;    const sessionKey = result.key;    const paymentWindowLink = result.paymentWindowUrl;    const button = createVerifyButton();    // Dynamically load the external payment module using the URL from the response    loadExternalModule(result.javascript, () => {      // Initialize hosted fields with session data and callbacks      epay.setSessionId(sessionId).setSessionKey(sessionKey).init();      button.addEventListener("click", () => {        epay.startAgeVerification({          successUrl: paymentWindowLink,          failureUrl: paymentWindowLink,        });      });    });  })  .catch((error) => {    console.error("Error during payment request:", error);  });

Before you start

You need:

  • An API key
  • A Point of Sale ID
  • A backend endpoint that can create payments
  • A success URL
  • A failure URL
  • A notification URL
  • The minimum age required for the purchase
  • The delivery country for the age verification

Your API key must only be used server-side. Never expose your API key in frontend code.

Step 1: Create an order in your system

Before creating the payment in ePay, create an order in your own system.

Set the order status to pending.

const order = await createOrder({  amount: 10000,  currency: "DKK",  status: "pending",  requiresAgeVerification: true,  minimumAge: 18,});

The order should not be marked as paid yet.

Step 2: Create a payment session with age verification

Create a payment session from your backend and include the ageVerification object.

API referencePOSTInitialize Payment Session/public/api/v1/citInitializes a new payment session with the ePay Payments API.
const body = JSON.stringify({  "pointOfSaleId": "<POINT_OF_SALE_ID>",  "amount": 10000,  "currency": "DKK",  "reference": "ORDER-1001",  "notificationUrl": "https://example.com/api/epay/notification",  "successUrl": "https://example.com/payment/success",  "failureUrl": "https://example.com/payment/failure",  "ageVerification": {    "minimumAge": 18,    "country": "DK"  }})fetch("https://payments.epay.eu/public/api/v1/cit", {  method: "POST",  headers: {    "Content-Type": "application/json",    "Authorization": "Bearer <TEST_API_KEY>",    "Idempotency-Key": "<UUID>"  },  body})

Use your own order reference so you can match the ePay payment to the order in your system.

Step 3: Understand the request body

pointOfSaleId, amount, and currency are always required in the request body.

The full schema below also includes advanced fields such as customer, orderLines, subscription, allowedPaymentMethods, returnUrl, retryUrl, generateQrCode, reportExpired, dynamicAmount, and ageVerification.

The table below covers the request fields used when initializing a payment session.

Prop

Type

pointOfSaleIduuid
Id of the point of sale to associate the payment with.
amountinteger
The amount of the payment in minor units. Example: 2.50 DKK must be sent as 250. If the amount is 0, a token is created without charging the customer.
currencystring
The currency code of the payment using ISO 4217 alpha-3, for example DKK.
reference?string | null
Your own payment or order reference. It should be unique per payment. Only ASCII alphanumeric characters and dashes are allowed, with a max length of 36.

Type

Worldline-specific behavior: - is removed if present, and if the value is longer than 12 characters, only the left part is used.
transactionType?PAYMENT | MOTO | null
The type of transaction to process. Most merchants should use PAYMENT.

Type

PAYMENT is the normal checkout flow. MOTO is for Mail Order / Telephone Order and requires a special acquirer agreement.

Default

PAYMENT
scaMode?SKIP | NORMAL | FORCE | null
Controls how 3D Secure is handled.

Type

SKIP does not attempt 3DS and leaves liability with the merchant. NORMAL attempts 3DS normally. FORCE requests a challenge flow, although third parties in the 3DS chain may still ignore it.
timeout?integer | null
How long the session stays valid in minutes.

Type

Minimum 1, maximum 120.
instantCapture?OFF | VOID | NO_VOID | null
Controls whether the payment is captured immediately.

Type

OFF does not capture immediately. VOID captures immediately and voids the authorization if capture fails. NO_VOID captures immediately and keeps the authorization if capture fails.
allowedPaymentMethods?string[] | null
Limits which payment methods are shown for this session.

Type

If only one redirect-based method such as VIPPS_MOBILEPAY is allowed, the customer is redirected directly to that method. If they cancel, they return to returnUrl or failureUrl.
exemptions?string[] | null
Exemptions to apply when possible. Using exemptions can shift fraud liability from the issuer to the merchant.

Type

Supported values are TRA and LVT.
maxAttempts?integer | null
Maximum allowed payment attempts for the session.

Type

Minimum 1, maximum 25.
generateQrCode?boolean | null
If true, the response includes a Base64 QR code version of the payment window URL.

Default

false
reportFailure?boolean | null
If true, failed transaction attempts are also reported to notificationUrl.
reportExpired?boolean
If true, sessions that reach the expired state are also reported to notificationUrl.

Default

false
dynamicAmount?boolean | null
Lets the cardholder define the transaction amount instead of using the initialized amount.

Type

This gives client-side control over the amount and is only meant for special cases. Must be enabled by ePay support.

Default

false
notificationUrl?uri | null
The URL where ePay sends payment status notifications and webhooks.

Type

Maximum length 1024. Supports URL templating.
preAuthUrl?uri | null
Enables pre-authorization webhooks before authorization is attempted.

Type

Maximum length 1024.
returnUrl?uri | null
Where the browser is returned when the customer clicks the back button in the payment window.

Type

Checkout only. Overrides the payment window default. Maximum length 1024. Supports URL templating.
successUrl?uri | null
Where the customer is redirected after a successful payment.

Type

Maximum length 1024.
failureUrl?uri | null
Where the customer is redirected when no more payment attempts are allowed.

Type

Maximum length 1024.
retryUrl?uri | null
Optional redirect for failed attempts when more attempts are still allowed.

Type

If omitted, the customer is redirected to failureUrl. Maximum length 1024.
textOnStatement?string | null
Text shown on the cardholder bank statement.

Type

Minimum length 1, maximum length 39.
attributes?object | null
Pass-through attributes returned back to the merchant on webhooks.

Type

Maximum total size is 1kb.
customerId?string | null
Merchant-defined customer identifier that uniquely represents the customer in your own system.

Type

Required for stored payment methods and enhanced age verification. Do not use guest IDs.
customer?object | null
Customer details used during SCA / 3DS and by payment methods such as Klarna.

Type

See the customer table below.
orderLines?object[] | null
Line items that make up the purchase. Used by some payment methods such as Klarna.

Type

Maximum 1000 items. See the orderLines table below.
subscription?object | null
Creates or updates a reusable subscription from the same CIT checkout flow.

Type

See the subscription table below. When a subscription is initialized, scaMode is always set to FORCE.
ageVerification?object | null
Requires the customer to verify that they meet a minimum age before the transaction can continue.

Type

See the ageVerification table below.
customer

Prop

Type

firstName?string | null
The first name of the paying customer.
lastName?string | null
The last name of the paying customer.
birthdate?date | null
The date of birth of the customer in YYYY-MM-DD format.
email?string | null
The email address of the paying customer.
phoneNumber?string | null
The phone number of the paying customer.

Type

Use E.164 with a single space between country code and local number, for example +45 12345678.
shippingAddress?object | null
Shipping address of the purchase. Leave empty when nothing is shipped.

Type

Uses countryCode, postalCode, city, line1, and optional line2 / line3. countryCode must be ISO 3166-1 alpha-2.
billingAddress?object | null
Billing address of the customer.

Type

Uses the same address shape as shippingAddress. If billing and shipping are the same, send both with identical values.
orderLines[]

Prop

Type

descriptionstring
Descriptive name of the order line item.
imageUrl?url | null
Optional image URL that can be used in merchant-provider communications such as Klarna flows.

Type

Maximum length 1024. A minimum resolution of 250x250 is recommended.
quantityinteger
Quantity of the order line item.

Type

Must be a non-negative number.
totalAmountinteger
Total order line amount in minor units, including tax and discounts.
unitPriceinteger
Single-item price in minor units, before discount and typically including taxes.
typePHYSICAL | DISCOUNT | SHIPPING_FEE | SALES_TAX | DIGITAL | GIFT_CARD | STORE_CREDIT | SURCHARGE | OTHER
Type of the order line item.
subscription

Prop

Type

id?uuid | null
Optional subscription ID to update an existing active subscription with new payment details.
amount?integer | null
Optional recurring amount in minor units when it differs from the current checkout amount.

Type

If the customer should not pay now, set top-level amount to 0 and set subscription.amount to the future recurring amount.
typeSCHEDULED | UNSCHEDULED
Subscription type.

Type

SCHEDULED is for fixed intervals such as monthly billing. UNSCHEDULED is for pay-as-you-go charging.
reference?string | null
Optional merchant-defined subscription reference. Falls back to the session reference if omitted.
expiryDate?date | null
Optional subscription expiry date used during 3DS. ePay does not reject charges after this date.
interval?object | null
Optional subscription schedule for SCHEDULED subscriptions.

Type

Contains period (DAY, WEEK, MONTH, YEAR) and frequency (1-31). Omit for UNSCHEDULED.
billingAgreement?object | null
Optional automatic billing agreement created from the subscription.

Type

Contains required billingPlanId and optional reference / nextChargeAt. Mutually exclusive with subscription.id and subscription.interval.
ageVerification

Prop

Type

minimumAgeinteger
Minimum required age for the purchase.

Type

Minimum 0, maximum 99.
country?DK | null
Country code deciding which electronic identity method is presented to the customer.

Type

For Danish customers this is typically verified with MitID.

POS defaults and request overrides

In Advanced Point of Sale Settings in the ePay backoffice, you can configure defaults for scaMode, timeout, instantCapture, maxAttempts, notificationUrl, successUrl, failureUrl, and exemptions. If a value is sent in the API request, it overrides the Point of Sale default for that session.
Avoid using scaMode: "SKIP" outside tests. Many acquirers do not accept payments without 3D Secure data, and liability can shift to the merchant.
DocumentationUse pre-authorization webhooks for risk checks and dynamic updatesReview the full pre-auth flow, payload shape, response fields, and the tradeoffs before enabling preAuthUrl on a payment session.

The ageVerification object tells ePay that the customer must meet a minimum age before the payment can be completed.

Step 4: Understand the age verification object

Use:

  • ageVerification.minimumAge for the required minimum age. It must be between 0 and 99.
  • ageVerification.country for the delivery country as an ISO 3166 alpha-2 country code such as DK.

The country determines which electronic ID flow is presented to the customer. For Denmark, this is MitID.

Step 5: Redirect the customer to Checkout

The response contains the information needed to open ePay Checkout.

Redirect the customer to the payment window URL returned by ePay.

return redirect(payment.paymentWindowUrl);

The customer now completes the age verification and payment in the ePay-hosted payment page.

Step 6: Complete a test payment

Open Checkout and complete the payment using a test payment method.

If age verification is required, the customer must complete the verification before the payment can continue.

A successful payment should redirect the customer to your success URL.

A failed payment should redirect the customer to your failure URL or allow the customer to try again, depending on your setup.

Step 7: Handle the payment result

Use your notification URL or webhook to update the order in your backend.

Do not mark the order as paid only because the customer lands on your success page.

DocumentationHandle notification URLs and webhooks correctlyUse the full guide for webhook payloads, authorization validation, retries, duplicate handling, and safe order updates.

Recommended order flow:

Create order as pending

Create ePay payment session with age verification

Redirect customer to Checkout

Customer completes age verification if required

Customer completes the payment

Receive payment result server-side

Verify the result

Mark order as paid

Step 8: Show the final status to the customer

Your success page should show the customer that the payment was completed or is being confirmed.

If your backend has not processed the payment result yet, show a neutral message such as:

Your payment has been received and is being confirmed.

Avoid showing a final paid state before your backend has confirmed the payment result.

Optional: Avoid repeated age checks for returning customers

For returning customers, you may want to avoid asking for age verification every time they make a purchase.

There are two common ways to do this:

Store the verification result in your own system

Send a unique customerId when creating the payment session

If you store the result in your own system, associate the verification outcome with the customer's profile and use it when deciding whether future payments require age verification.

If you send a unique customerId, ePay can associate the verification result with that customer and reuse it for future payments with the same customer ID.

{  "customerId": "CUSTOMER-1001",  "ageVerification": {    "minimumAge": 18,    "country": "DK"  }}

Only use stable customer IDs that identify the same customer across payments.

Common problems

I get unauthorized when creating the payment

Check that:

  • You are using the correct API key
  • The API key belongs to the correct environment
  • The request is made from your backend
  • The authorization header is formatted correctly

The customer is not asked to verify age

Check that:

  • The ageVerification object is included in the payment session request
  • minimumAge is set correctly
  • country is set correctly
  • The payment method supports the expected verification flow
  • The customer has not already been verified through a reusable customer ID

The payment is declined during age verification

Check that:

  • The customer meets the required minimum age
  • The correct delivery country is used
  • The customer completed the required electronic ID flow
  • The selected payment method supports the age verification flow

The customer returns, but my order is not paid

Check that:

  • Your notification URL is publicly available
  • Your backend receives the notification
  • Your backend matches the payment to the correct order
  • Your system updates the order based on the server-side result

Returning customers are asked to verify age again

Check that:

  • You send the same customerId for the same customer
  • The customer ID is stable across payments
  • Your own system stores and reuses the verification result if you handle this locally
  • The payment session still includes the correct age verification requirements

What you built

You have now created your first ePay Verify payment.

You created a payment session with age verification, redirected the customer to ePay Checkout, completed the verification flow and handled the payment result server-side.

Next steps

How is this guide?

On this page