Skip to content

[Issue]: Not able to create a Checkout Payment Session on deployed TEST environment #1491

@mwritter

Description

@mwritter

Description

Creating an Adyen Checkout Payment session work fine on local development, but Im getting a 401 response with the same setup on the deployed test environment.

Steps to reproduce

  1. Install Adyen api-library
npm install --save @adyen/api-library
  1. Create a Client and CheckoutAPI payments session
// consts.ts
import { Client } form ''@adyen/api-library"

export const client = new Client({
     apiKey: "API_KEY",
     environment: "TEST"
})

// server.ts
import { CheckoutAPI } form ''@adyen/api-library"
import { client } from "./consts"

export function createSession(request, options) {
   ...
   const checkoutAPI = new CheckoutAPI(client)
   return checkoutAPI.PaymentsAPI.sessions(request, options)
}

Actual behavior

In local development everything is working as expected.

In the deployed test environment the session is returning a 401. Environment variables are the same and set correctly in both local and deployed, and the deployed url is whitelisted in the Customer Area under 'allowed origins'. Any insight into what might be the issue would be greatly appreciated.

{
  "statusCode": 401,
  "name": "HttpClientException",
  "responseHeaders": {
    "date": "Mon, 05 May 2025 14:48:17 GMT",
    "content-type": "application/json",
    "transfer-encoding": "chunked",
    "connection": "close",
    "traceparent": "00-cdd43292383b2eda5477c0c17d71d089-2287a9d8d1c98069-01",
    "x-frame-options": "SAMEORIGIN",
    "x-content-type-options": "nosniff",
    "cache-control": "no-cache, no-store, private, must-revalidate, max-age=0",
    "pragma": "no-cache",
    "expires": "0",
    "set-cookie": [...],
    "www-authenticate": "BASIC realm=\"Adyen PAL Service Authentication\"",
    "strict-transport-security": "max-age=31536000; includeSubDomains",
    "cf-cache-status": "DYNAMIC",
    "server": "cloudflare",
    "cf-ray": "93b109b29c1b3908-IAD",
    "alt-svc": "h3=\":443\"; ma=86400"
  },
  "responseBody": "{\"status\":401,\"errorCode\":\"000\",\"message\":\"HTTP Status Response - Unauthorized\",\"errorType\":\"security\"}",
  "errorCode": "000"
}

Expected behavior

Adyen Checkout Payment sessions can be created the same on both local and deployed test environments.

Code snippet or screenshots (if applicable)

No response

Adyen Node API Library version

25.0.0

Node.js version

20.18.0

NPM version

10.8.2

Operating System

Linux

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions