---
updatedAt: 2026-10-27T10:09:49.000Z
agentTools:
  projectIndex: https://docs.br-dge.io/llms.txt
---

# Post Response Module

Some payments cannot be completed in a single server-to-server call. The issuer may need to challenge your customer, or the payment method may need to send them to an external provider. When that happens, the BR-DGE REST API returns a **post-response action**: a small instruction telling you that something must happen in the customer's browser before the payment can proceed.

The Post Response Module carries out that instruction for you. You hand the module the `action` object exactly as your server received it, and the module renders the challenge, talks to the relevant provider, and resolves with the result you need to finish the payment.

<Callout icon="📘" theme="info">
  ### **Why this matters**

  Every PSP implements 3-D Secure differently: different iframes, different tokens, different callbacks. This module absorbs those differences so your checkout code only ever deals with one flow. If you switch or add a PSP through <Anchor target="_blank" href="https://docs.br-dge.io/docs/smart-routing">Smart Routing</Anchor>, your front-end code should not need to change.
</Callout>

***

## How it works

A post-response action is always a three-way conversation between your server, your customer's browser, and BR-DGE. Your server never handles the challenge itself — it only passes the action along.

```mermaid
sequenceDiagram
    autonumber
    participant Browser as Customer's browser
    participant Server as Your server
    participant BRDGE as BR-DGE REST API
    participant PSP as PSP / Issuer
 
    Browser->>Server: Submit checkout details
    Server->>BRDGE: POST /v1/payments
    BRDGE-->>Server: 202 Accepted, actionRequired: true, action: { ... }
    Server-->>Browser: The action object
    Browser->>Browser: handleAction(action)
    Browser->>PSP: SDK performs the challenge
    PSP-->>Browser: Authentication outcome
    Browser-->>Server: Resolved result (code, nonce)
    Server->>BRDGE: POST /v1/payments with the nonce
    BRDGE-->>Server: 201 Approved, or another action
    Server-->>Browser: Final outcome
```

Flow description:

1. Your server creates a payment and receives a `202 Accepted` response containing `actionRequired: true` and an `action` object. For 3-D Secure this arrives with <Anchor target="_blank" href="https://docs.br-dge.io/docs/response-codes#2001">response code `2001`</Anchor>.
2. Your server passes the `action` object to your client. Nothing else from the response is needed.
3. Your client passes it to `handleAction`. The module resolves with a result — typically a `nonce` under <Anchor target="_blank" href="https://docs.br-dge.io/docs/response-codes#2002">response code `2002`</Anchor>.
4. Your client sends that result to your server, which completes the payment using a `ProviderThreeDSecureNonce` payment instrument.
5. Depending on the PSP, step 4 may return *another* action. If it does, repeat from step 2.

<Callout icon="❗️" theme="error">
  ### **Step 5 is not optional**

  A single payment can require more than one round of authentication. Build your integration as a loop that keeps calling `handleAction` while `actionRequired` is `true`, rather than assuming one challenge is enough. Integrations that handle only the first action will fail intermittently on certain PSPs and card ranges.
</Callout>

For the wider context, refer to <Anchor target="_blank" href="https://docs.br-dge.io/docs/payment-flows#3-d-secure-payment-flow">3-D Secure Payment Flow</Anchor> and <Anchor target="_blank" href="https://docs.br-dge.io/docs/rest-api-introduction#post-response-actions">Post-Response Actions</Anchor>.

***

## Before you begin

You will need:

| Requirement                                                                                                                                        | Notes                                                                     |
| -------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------- |
| A <Anchor target="_blank" href="https://docs.br-dge.io/docs/rest-api-introduction#authorization">Client API Key</Anchor>                           | Safe to expose in the browser. Never use a Server API Key in client code. |
| The <Anchor target="_blank" href="https://docs.br-dge.io/docs/web-sdk-introduction#comcarde-javascript-client">Comcarde JavaScript Client</Anchor> | This module is a plugin and cannot be used on its own.                    |
| A server that can relay the `action` object to your client                                                                                         | Any transport is fine: JSON response, template variable, WebSocket.       |

The Web SDK is plain ES5 JavaScript. There is no build step, no bundler and no framework requirement — the scripts attach a global `comcarde` object to the page.

<Callout icon="🚧" theme="warn">
  ### **Promise support**

  `handleAction` returns a Promise. If you support browsers without native Promise support, load a polyfill _before_ the SDK scripts. If you are unsure whether your SDK version bundles one, <Anchor target="_blank" href="https://docs.br-dge.io/docs/support#contact-support">ask support</Anchor>.
</Callout>

***

## Install

Add the module script to your page, after the client script. Use the sandbox asset host while developing and the production host for live traffic.

```html EU Sandbox
<script src="https://sandbox-assets.comcarde.com/web/v2/js/client.min.js"></script>
<script src="https://sandbox-assets.comcarde.com/web/v2/js/post-response-action.min.js"></script>
```

```html EU Production
<script src="https://assets.comcarde.com/web/v2/js/client.min.js"></script>
<script src="https://assets.comcarde.com/web/v2/js/post-response-action.min.js"></script>
```
```html NA Production
<script src="https://assets-amer-01.api.br-dge.io/web/v2/js/client.min.js"></script>
<script src="https://assets-amer-01.api.br-dge.io/web/v2/js/post-response-action.min.js"></script>
```

<Callout icon="📘" theme="info">
  ### **Dedicated environments**

  If you have a dedicated BR-DGE environment, your asset host will differ from the two above. <Anchor target="_blank" href="https://docs.br-dge.io/docs/support#contact-support">Contact support</Anchor> if you are unsure which to use.
</Callout>

Load order matters: `client.min.js` must be parsed before the module script runs, and both must be present before you call `comcarde.client.create`.

***

## Quick start

The minimum viable integration. Create the client, create the module, hand it an action.

```javascript
comcarde.client.create(
  {
    authorization: clientApiKey // your Client API Key
  },
  function (clientErr, clientInstance) {
    if (clientErr) {
      console.error('Client creation failed', clientErr);
      return;
    }
 
    comcarde.postResponseAction.create(
      {
        client: clientInstance
      },
      function (err, postResponseActionInstance) {
        if (err) {
          console.error('Module creation failed', err);
          return;
        }
 
        // The 'action' object from your server's payment response.
        var action = actionFromServerResponse;
 
        postResponseActionInstance
          .handleAction(action)
          .then(function (response) {
            // The action completed. Inspect response.code to decide what to do next.
            console.log(response.code, response.message);
          })
          .catch(function (handleErr) {
            console.error('handleAction failed', JSON.stringify(handleErr));
          });
      }
    );
  }
);
```

<Callout icon="👍" theme="okay">
  ### **Parse once, not twice**

  `handleAction` expects a JavaScript **object**, not a JSON string. If your server sends the whole payment response as JSON and your client already parses it, pass `response.action` straight through. Only call `JSON.parse` if you are handling a raw string, for example a value injected into a template:

  ```javascript
  var action = JSON.parse(actionJsonFromServerResponse); // string in
  var action = paymentResponse.action;                   // already an object
  ```

  Calling `JSON.parse` on an object is a common cause of `THREE_D_SECURE_ERROR_INVALID_ACTION_TYPE`.
</Callout>

***

## API reference

### `comcarde.postResponseAction.create(options, callback)`

Creates a module instance bound to a client instance.

| Parameter        | Type     | Required | Description                                                                                                                                                             |
| ---------------- | -------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `options.client` | Object   | Yes      | A client instance from `comcarde.client.create`.                                                                                                                        |
| `options.styles` | Object   | No       | Presentation overrides for the challenge window. Refer to <Anchor target="_blank" href="#controlling-the-challenge-z-index">Controlling the challenge z-index</Anchor>. |
| `callback`       | Function | Yes      | Node-style callback, `function (err, instance)`.                                                                                                                        |

The callback receives an error **or** an instance — always check `err` before using the instance. Errors follow the standard <Anchor target="_blank" href="https://docs.br-dge.io/docs/web-sdk-introduction#errors">Web SDK error shape</Anchor>:

```json
{
  "code": "4001",
  "message": "Access denied."
}
```

Create the instance once when your checkout page loads and reuse it. You do not need a fresh instance per action.

### `instance.handleAction(action[, callbacks])`

Executes a post-response action. Returns a Promise.

| Parameter   | Type   | Required | Description                                                 |
| ----------- | ------ | -------- | ----------------------------------------------------------- |
| `action`    | Object | Yes      | The `action` object from the REST API response, unmodified. |
| `callbacks` | Object | No       | Progress callbacks. Refer to [Callbacks](#callbacks).       |

| Outcome  | Meaning                                                                                                               |
| -------- | --------------------------------------------------------------------------------------------------------------------- |
| Resolves | The action ran to completion. **This does not mean the payment succeeded** — check `response.code`.                   |
| Rejects  | The action could not be completed. Refer to <Anchor target="_blank" href="#error-reference">Error reference</Anchor>. |

### The action object

Pass this through verbatim. Do not reshape it, add fields, or strip fields — the module uses `type` to select the correct PSP-specific handler.

```json
{
  "action": {
    "type": "3D_SECURE",
    "paymentId": "22669f90-5bf0-45df-ba8c-ea6d4235a5da",
    "data": {
      "clientToken": "aaabbb",
      "verifyCardPayload": "payload"
    }
  }
}
```

| Field       | Type   | Description                                                                        |
| ----------- | ------ | ---------------------------------------------------------------------------------- |
| `type`      | String | The kind of action, for example `3D_SECURE`. Determines how the module handles it. |
| `paymentId` | String | The BR-DGE payment this action belongs to. Useful for correlating logs.            |
| `data`      | Object | Opaque, PSP-specific payload. Contents vary; treat as a black box.                 |

<Callout icon="🚧" theme="warn">
  ### **Do not branch on&#x20;**`data`

  The keys inside `data` differ between PSPs and may change as connections are added. Reading them in your own code couples your checkout to a specific PSP and defeats the purpose of the module.
</Callout>

### The resolved response

| Field              | Type   | Description                                                                                                  |
| ------------------ | ------ | ------------------------------------------------------------------------------------------------------------ |
| `code`             | String | A [BR-DGE response code](https://docs.br-dge.io/docs/response-codes) describing the outcome. Branch on this. |
| `message`          | String | Human-readable explanation. Useful for logs; not intended for display to customers.                          |
| `paymentId`        | String | The payment this result belongs to.                                                                          |
| `nonce`            | String | Present on `2002`. Use this on your server to complete the payment.                                          |
| `threeDSecureInfo` | Object | Optional authentication detail. See below.                                                                   |

The codes you are most likely to see:

| Code                                                      | Meaning                                            | What to do                                                                              |
| --------------------------------------------------------- | -------------------------------------------------- | --------------------------------------------------------------------------------------- |
| [`2002`](https://docs.br-dge.io/docs/response-codes#2002) | 3-D Secure additional payment with nonce required. | Send `nonce` to your server and complete the payment.                                   |
| [`2004`](https://docs.br-dge.io/docs/response-codes#2004) | 3-D Secure processing error.                       | Treat as a failed authentication attempt. Decide whether to retry or fail the checkout. |

Other codes are possible depending on the payment method and PSP, so write your handler with a `default` branch rather than assuming only the two above.

#### `threeDSecureInfo`

Supplied when the PSP returns authentication detail. Always check the object exists before reading it.

| Field                    | Type    | Description                                                                                 |
| ------------------------ | ------- | ------------------------------------------------------------------------------------------- |
| `pspStatus`              | String  | Status description as returned by the PSP. Raw, PSP-specific text — log it, don't parse it. |
| `threeDSecureVersion`    | String  | The protocol version used, for example `"2"`.                                               |
| `liabilityShifted`       | Boolean | Whether liability for fraud has moved to the issuer.                                        |
| `liabilityShiftPossible` | Boolean | Whether the payment instrument was eligible for 3-D Secure at all.                          |

### Callbacks

You can optionally pass functions that fire at points during execution, which is useful for managing spinners and re-enabling your pay button.

```javascript
var callbacks = {
  windowClosed: function () {
    // The customer dismissed the challenge window.
    hideSpinner();
    enablePayButton();
  },
  actionCompleted: function () {
    // The action finished; the promise is about to resolve.
    hideSpinner();
  }
};
 
postResponseActionInstance.handleAction(action, callbacks);
```

| Callback          | Fires when                                                                           |
| ----------------- | ------------------------------------------------------------------------------------ |
| `windowClosed`    | The challenge window or overlay is closed, including when the customer dismisses it. |
| `actionCompleted` | The action has completed.                                                            |

<Callout icon="❗️" theme="error">
  ### **Callback support is not universal**

  Not every action type supports callbacks, and the set available depends on the action type and the PSP handling your payment. Treat them as progress hints, not guarantees — never rely on `actionCompleted` as your only completion signal. Put the logic that must always run in `.then()` and `.catch()`. [Contact support](https://docs.br-dge.io/docs/support#contact-support) to confirm which callbacks apply to the actions configured on your account.
</Callout>

***

## Controlling the challenge z-index

3-D Secure challenges are rendered in a modal window layered over your checkout page. If your own page has high-stacking elements — a sticky header, a cookie banner, a basket drawer, a loading overlay — they can appear on top of the challenge, or hide it entirely. The customer sees a blank or partially obscured overlay and abandons.

Pass `threeDSModalZIndex` in the `styles` object when creating the module to place the challenge window at a specific z-index:

```javascript
comcarde.postResponseAction.create(
  {
    client: clientInstance,
    styles: {
      threeDSModalZIndex: 12000
    }
  },
  function (err, postResponseActionInstance) {
    if (err) {
      console.error('Module creation failed', err);
      return;
    }
 
    // ... handleAction as usual
  }
);
```

| Style                | Type   | Description                                                                |
| -------------------- | ------ | -------------------------------------------------------------------------- |
| `threeDSModalZIndex` | Number | Forces the 3-D Secure challenge window to render at the specified z-index. |

Set this to a value above the highest z-index on your checkout page. Audit what you actually use rather than guessing — third-party scripts such as chat widgets, consent managers, and session-recording tools frequently sit in the tens of thousands.

<Callout icon="👍" theme="okay">
  ### **Configure it once**

  `styles` is set when the module is created, not per action, so a single value covers every challenge on the page. Set it during your normal checkout initialisation rather than trying to adjust it when an action arrives.
</Callout>

<Callout icon="🚧" theme="warn">
  ### **z-index only competes within the same stacking context**

  If an ancestor of the challenge creates its own stacking context — through `transform`, `filter`, `opacity` below `1`, `will-change`, or its own `position` plus `z-index` — raising `threeDSModalZIndex` will not lift the challenge above elements outside that context. If a large value makes no difference, the problem is the stacking context, not the number. Inspect the ancestor chain before increasing it further.
</Callout>

Because this affects presentation only, it cannot cause an authentication failure — but it is a common cause of *apparent* ones, where the challenge renders correctly and the customer simply cannot see or interact with it. If you see an unexplained cluster of `THREE_D_SECURE_METHOD_FAILURE` errors or `windowClosed` callbacks, check this before escalating.

***

## Worked example: 3-D Secure

This is the full pattern, including the liability-shift decision and the error path.

```javascript
comcarde.client.create(
  {
    authorization: clientApiKey // your Client API Key
  },
  function (clientErr, clientInstance) {
    if (clientErr) {
      console.error('Client creation failed', clientErr);
      return;
    }
 
    comcarde.postResponseAction.create(
      {
        client: clientInstance
      },
      function (err, postResponseActionInstance) {
        if (err) {
          console.error('Module creation failed', err);
          return;
        }
 
        var action = paymentResponse.action;
 
        postResponseActionInstance
          .handleAction(action)
          .then(function (response) {
            var paymentId = response.paymentId;
 
            if (response.code === '2002') {
              // Authentication finished. A nonce is available to complete the payment.
              var info = response.threeDSecureInfo;
 
              if (info && info.liabilityShifted) {
                // Authentication succeeded, or the issuer does not support 3-D Secure
                // while the payment method does. Either way, fraud liability now sits
                // with the issuer. Complete the payment on your server.
                completePaymentOnServer(paymentId, response.nonce);
                return;
              }
 
              // Liability has NOT shifted. You may still complete the payment, but you
              // must set threeDSecureRequired to false on the follow-up request, and
              // you carry the fraud risk. This is a commercial decision.
              if (info && info.liabilityShiftPossible) {
                // Instrument was eligible for 3-D Secure but authentication did not
                // succeed. Higher risk.
              } else {
                // Instrument was never eligible for 3-D Secure.
              }
 
              handleUnauthenticatedPayment(paymentId, response.nonce, info);
              return;
            }
 
            if (response.code === '2004') {
              // An error occurred during authentication.
              showRetryableError();
              return;
            }
 
            // Any other code: log it and fail safe rather than silently continuing.
            console.warn('Unexpected code from handleAction', response.code, response.message);
            showGenericError();
          })
          .catch(function (handleErr) {
            // handleErr usually carries a 3-D Secure action error code explaining what
            // went wrong. Include it verbatim in any support request.
            console.error(
              'Exception while processing 3-D Secure action: ' + JSON.stringify(handleErr)
            );
            showGenericError();
          });
      }
    );
  }
);
```

### Deciding what to do when liability has not shifted

`liabilityShifted: false` is not automatically a decline. It is a risk decision only you can make.

| `liabilityShifted` | `liabilityShiftPossible` | Interpretation                                                                                                          | Typical action                                                 |
| ------------------ | ------------------------ | ----------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------- |
| `true`             | —                        | Authentication succeeded, or the issuer does not participate while the instrument does. Liability sits with the issuer. | Complete the payment.                                          |
| `false`            | `true`                   | The instrument was eligible for 3-D Secure, but authentication did not succeed.                                         | Highest risk. Most merchants decline, or retry authentication. |
| `false`            | `false`                  | The instrument was never eligible for 3-D Secure.                                                                       | Complete only if you accept the fraud risk.                    |

To complete a payment where liability has not shifted, set [`threeDSecureRequired`](https://docs.br-dge.io/reference/createpaymentusingpost) to `false` on the follow-up request. Otherwise it will be rejected.

<Callout icon="❗️" theme="error">
  ### **Regulatory context**

  Proceeding without a liability shift may conflict with [Strong Customer Authentication](https://docs.br-dge.io/docs/strong-customer-auth) obligations in your market. Confirm your position before enabling this path in production.
</Callout>

***

## Error reference

When `handleAction` rejects, the error usually carries one of the codes below. Log the entire error object — not just the code — and include it in any support request along with the `paymentId`.

### General 3-D Secure errors

| Code                                  | Description                                                                                | Where to look first                                                                                                                                                 |
| ------------------------------------- | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `THREE_D_SECURE_ERROR`                | A problem occurred during the 3-D Secure verification process.                             | Generic. Raise with support, quoting the `paymentId`.                                                                                                               |
| `THREE_D_SECURE_METHOD_FAILURE`       | No nonce was received during the 3-D Secure verification process.                          | The challenge did not complete. Check whether the customer abandoned it, or whether the window was blocked.                                                         |
| `THREE_D_SECURE_ACTION_REQUIRED`      | A problem occurred during the 3-D Secure verification process.                             | Generic. Confirm you passed the full `action` object.                                                                                                               |
| `THREE_D_SECURE_ACTION_INVALID`       | A problem occurred during the 3-D Secure verification process.                             | Generic. Usually a malformed or reshaped `action` object.                                                                                                           |
| `THREE_D_SECURE_UNSUPPORTED_PSP`      | The PSP for this action is not supported by this version of the SDK.                       | Your SDK version is behind. Update to the latest asset URL and retest.                                                                                              |
| `THREE_D_SECURE_ERROR_NO_RESPONSE`    | The server did not respond in time. May also indicate a bad request from the issuer's ACS. | Transient in many cases. Check for network restrictions or content security policy rules blocking the ACS domain.                                                   |
| `THREE_D_SECURE_ERROR_INVALID_ORIGIN` | This origin is not allowed.                                                                | Check the [`origin`](https://docs.br-dge.io/reference/createpaymentusingpost) you submitted on the payment request matches the page actually hosting the challenge. |

<Callout icon="📘" theme="info">
  ### **On the generic descriptions**

  Three of the codes above share the same description. They are distinct conditions internally, so quote the exact code when contacting support — it materially speeds up diagnosis.
</Callout>

### Malformed action errors

These indicate the `action` object reaching `handleAction` is not what the module expected. In almost every case the cause is in the relay between your server and your client: partial serialisation, an object being stringified twice, or only part of the payload being forwarded.

| Code                                            | Description                                |
| ----------------------------------------------- | ------------------------------------------ |
| `THREE_D_SECURE_ERROR_INVALID_ACTION_TYPE`      | An invalid action type was provided.       |
| `THREE_D_SECURE_ERROR_MISSING_PROPERTY_ACS_URL` | The required `acsUrl` property is missing. |
| `THREE_D_SECURE_ERROR_MISSING_PROPERTY_TOKEN`   | The required `token` property is missing.  |
| `THREE_D_SECURE_ERROR_MISSING_PROPERTY_JWT`     | The required `jwt` property is missing.    |

### PSP-specific errors

| Code                                             | PSP                                                                   | Description                                               |
| ------------------------------------------------ | --------------------------------------------------------------------- | --------------------------------------------------------- |
| `BARCLAYCARD_THREE_D_SECURE_HTML_ERROR`          | [Barclaycard Smartpay Fuse](https://docs.br-dge.io/docs/smartpayfuse) | The `htmlAnswer` was invalid.                             |
| `STRIPE_THREE_D_SECURE_ERROR_FAILED_TO_LOAD_SDK` | [Stripe](https://docs.br-dge.io/docs/stripe)                          | Failed to load the Stripe SDK.                            |
| `TRUST_THREE_D_SECURE_ERROR_FAILED_TO_LOAD_SDK`  | [Trust Payments](https://docs.br-dge.io/docs/trust-payments)          | Failed to load the Trust Payments SDK.                    |
| `NUVEI_THREE_D_SECURE_METHOD_PAYLOAD`            | [Nuvei](https://docs.br-dge.io/docs/nuvei)                            | `methodPayload` object missing from `threeDSecureAction`. |
| `NUVEI_THREE_D_SECURE_C_REQ`                     | [Nuvei](https://docs.br-dge.io/docs/nuvei)                            | `cReq` object missing from `threeDSecureAction`.          |
| `ADYEN_THREE_D_SECURE_MISSING_POST_URL`          | [Adyen](https://docs.br-dge.io/docs/adyen)                            | `URL` missing from the payment response.                  |
| `ADYEN_THREE_D_SECURE_MISSING_PA_REQ`            | [Adyen](https://docs.br-dge.io/docs/adyen)                            | `PaReq` object missing from `threeDSecureAction`.         |
| `ADYEN_THREE_D_SECURE_MISSING_MD`                | [Adyen](https://docs.br-dge.io/docs/adyen)                            | `MD` object missing from `threeDSecureAction`.            |

The two `FAILED_TO_LOAD_SDK` errors mean a third-party script could not be fetched from the customer's browser. Check your content security policy allows the PSP's script domains.

***

## Troubleshooting

| Symptom                                                           | Likely cause                                                                                                                                                                                                                    |
| ----------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `comcarde.postResponseAction is undefined`                        | The module script did not load, or ran before `client.min.js`. Check load order and the network tab.                                                                                                                            |
| Rejects immediately with a missing-property error                 | The `action` object was reshaped, double-parsed, or only partially forwarded from your server. Log it on both sides and compare.                                                                                                |
| Challenge window never appears                                    | A popup or iframe was blocked. Call `handleAction` from within the customer's click handler rather than after an intervening `await` or timeout.                                                                                |
| Challenge appears behind your header, overlay or cookie banner    | Stacking order. Set [`threeDSModalZIndex`](#controlling-the-challenge-z-index) above the highest z-index on your page.                                                                                                          |
| Challenge is visible but unclickable, or shows as a blank overlay | Another element is layered on top of it. Same fix as above; if raising the value changes nothing, check for an ancestor creating its own stacking context.                                                                      |
| Payment succeeds in sandbox but fails live                        | Mismatched hosts. Confirm the asset host, API subdomain and API key all belong to the same environment.                                                                                                                         |
| Works on one card, fails on another                               | Different card ranges route to different PSPs. Check your integration handles repeat actions and does not read PSP-specific fields from `data`.                                                                                 |
| `THREE_D_SECURE_METHOD_FAILURE` under load                        | Often customer abandonment rather than a fault. Correlate against your `windowClosed` callback before escalating — and rule out a [z-index](#controlling-the-challenge-z-index) problem, which looks identical in your metrics. |

Some PSPs require additional fields on the original payment request before 3-D Secure will work at all — in particular [`browserData`](https://docs.br-dge.io/reference/createpaymentusingpost), [`channel`](https://docs.br-dge.io/reference/createpaymentusingpost) and [`origin`](https://docs.br-dge.io/reference/createpaymentusingpost). If authentication fails consistently for a given PSP, confirm those are populated before investigating the client.

***

## Testing

Use the [sandbox](https://docs.br-dge.io/docs/rest-api-introduction#environment-subdomains) asset host and API subdomain together, and drive challenges with the [simulator PSPs](https://docs.br-dge.io/docs/testing-simulator-psps).

Worth covering explicitly before you go live:

* A frictionless authentication that resolves with `2002` and a liability shift.
* A challenge rendered on your **real checkout page**, with headers, banners and any third-party widgets present, to confirm the [z-index](#controlling-the-challenge-z-index) is high enough. A challenge that renders fine in isolation can still be buried in production.
* A challenge the customer **abandons**, to verify your `windowClosed` handling and that your pay button becomes usable again.
* A payment requiring **two** consecutive actions, to prove your loop works.
* A `2004` processing error, to verify your error path.

<Callout icon="❗️" theme="error">
  ### **PCI compliance in sandbox**

  Use only mock payment instrument data against the sandbox. Never submit real cardholder data to a test environment.
</Callout>

***

## Related documentation

* [Web SDK Introduction](https://docs.br-dge.io/docs/web-sdk-introduction) — creating the client and handling SDK errors
* [Post-Response Actions](https://docs.br-dge.io/docs/rest-api-introduction#post-response-actions) — the server-side view
* [3-D Secure Payment Flow](https://docs.br-dge.io/docs/payment-flows#3-d-secure-payment-flow) — end-to-end sequence
* [POST /v1/payments](https://docs.br-dge.io/reference/createpaymentusingpost) — see the `Payment with ProviderThreeDSecureNonce` example for completing an authenticated payment
* [Response Codes](https://docs.br-dge.io/docs/response-codes) — full code list
* [Auto 3-D Secure Step-up](https://docs.br-dge.io/docs/3-d-secure-auto-step-up) — automatic step-up behaviour
* [Support](https://docs.br-dge.io/docs/support#contact-support) — include the `paymentId` and the full error object