Authenticate with 3DS
Open the 3DS bank challenge in a modal overlay when a transaction requires authentication.
The pay.authentication() method renders the 3DS bank challenge in a modal overlay when a charge, hold, or payment method returns requires_authentication. The customer completes verification without leaving your page.
pay.authentication(options)Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
clientSecret | string | Yes | The client_secret from the linked authentication session created on your server. |
Returns
Nothing. The method returns immediately after it opens the challenge overlay.
To learn the outcome, wait for the authentication_session.authenticated or authentication_session.failed webhook event, or poll GET /v1/sessions/authentication/{id} from your server.
What happens next depends on the confirm field of the linked authentication session:
confirm: true(the default): Pay.com confirms the original transaction after successful authentication. Don't call a confirm endpoint. Wait for the transaction's webhook event.confirm: false: After the session is authenticated, confirm the original transaction from your server with the matching endpoint (confirm a charge, confirm a hold, or confirm a payment method).
Example
// After receiving requires_authentication from a charge, hold, or payment method:
const authSession = await createLinkedAuthSession(resourceId)
// Opens the challenge and returns immediately
pay.authentication({
clientSecret: authSession.client_secret
})
// On your server: wait for the authentication_session.authenticated
// webhook (or poll the session). If the linked session was created with
// confirm: false, then confirm the original charge, hold, or payment method.Was this page helpful?