CLI docs

Visa Agent Directory services (optional)Authentication

Visa Agent Directory services (optional)TAP specification

Authentication

How calls to the Visa Agent Directory services authenticate, how that differs from agent request signing, and how to compute an X-Pay-Token.

Markdownllms.txt
On this page

Registry transport credentials and agent request signatures have separate roles.

SurfaceCredentials / proofWhere used
VARS · X-Pay-TokenVDP API key + decrypted shared secret; HMAC SHA-256.?apiKey=… and x-pay-token on the registry call.
VARS · two-way TLS (mTLS)VDP client certificate/private key + HTTP Basic username/password.TLS handshake plus Authorization: Basic …; this mode sends no API-key query or X-Pay-Token.
VMRS merchant registryThe public OpenAPI omits authentication details.Select the product’s VDP project authentication; validate its headers / TLS requirements before use.
Agent → merchantAgent’s private TAP signing key, paired with its registered public key.RFC 9421 Signature-Input and Signature; profile may add Signature-Agent.
Visa → merchant ID tokenVisa’s signing key, selected using JWT kid and trusted issuer metadata.Verify the separate signed ID token inside consumer recognition data.
Payment → merchant encryptionMerchant’s VMRS public encryption key; merchant retains the private key.Protects an encrypted payment payload for the merchant.

X-Pay-Token, byte for byte

VARS signing formula
message = timestamp + resourcePath + queryString + requestBody
digest  = lowercaseHex(HMAC_SHA256(sharedSecret, UTF8(message)))
token   = "xv2:" + timestamp + ":" + digest
ComponentExact VARS ruleExample
timestampUTC Unix seconds. Generate after any queued delay.Math.floor(Date.now() / 1000)
resourcePathStrip the leading slash and the vars/ context segment./vars/v1/agents → v1/agents
queryStringSorted query pairs, no leading ?. Includes apiKey. Use identical encoded bytes in URL and HMAC.apiKey=YOUR_KEY&page=1&pageSize=30
requestBodyExact raw UTF-8 body bytes; empty string for body-less GET / DELETE / activation calls.Serialize once and reuse the same string.
Node.js X-Pay-Token request helper
import { createHmac } from "node:crypto";

// Serialize once. Hash and transmit the same UTF-8 string.
function varsXPayRequest({ baseUrl, path, method, apiKey,
                          sharedSecret, payload, query = {} }) {
  const body = payload === undefined ? "" : JSON.stringify(payload);
  const params = new URLSearchParams();
  for (const [key, value] of Object.entries(query))
    params.set(key, String(value));
  params.set("apiKey", apiKey);
  params.sort();
  const qs = params.toString();
  const resourcePath = path.replace(/^\//, "").replace(/^vars\//, "");
  const timestamp = String(Math.floor(Date.now() / 1000));
  const digest = createHmac("sha256", sharedSecret)
    .update(timestamp + resourcePath + qs + body, "utf8")
    .digest("hex");
  const token = "xv2:" + timestamp + ":" + digest;

  return fetch(baseUrl.replace(/\/$/, "") + path + "?" + qs, {
    method,
    headers: {
      accept: "application/json",
      "content-type": "application/json",
      "x-pay-token": token
    },
    ...(body === "" ? {} : { body })
  });
}

Compact JSON is convenient when generated once. Whitespace, query order and encoding must match the bytes sent; this guide does not assume server-side JSON canonicalization. HTTP method is not a component of this X-Pay-Token formula.

Environment and credential setup

Create / select a VDP project with the required API access, obtain credentials for the intended environment and complete the platform’s next-environment onboarding when applicable. The public OpenAPI specifies https://sandbox.api.visa.com. Visa CLI requires an explicit VARS base URL and never silently falls back to sandbox.

The current X-Pay setup guide describes uploading an RSA public key to receive an encrypted shared secret, then decrypting it using the corresponding private key and OAEP SHA-256. Those setup keys are separate from the agent’s TAP signing key.

For mTLS, set TLS 1.2 minimum, verify server certificates, refuse redirects and add HTTP Basic auth. Have the complete credential set for the mode you select.

Sources: TAP merchant specifications, VDP X-Pay Token authentication, VDP Two-Way SSL authentication, VDP quick start, VDP environment switching and testing, VDP going live.

Updated 9 Nov 2026