Skip to main content
New to authentication on Gnosis Pay? Read Authentication & Tokens first the PSE SDK relies on a valid access token (authModuleToken) obtained via the SIWE authentication flow.
The Payment Secure Elements (PSE) SDK lets you display and manage sensitive card data such as card number, expiration, CVV, and PIN directly in your application, without that data ever touching your own front-end or back-end code. Card data is rendered inside PCI-compliant iframes hosted by Gnosis Pay, and communicates with your app only through secure, origin-verified postMessage events.
PSE v3 requires a wallet signature (EIP-712) before each sensitive operation, adding a second factor on top of your authModuleToken. This is the current supported version.

Installation

Install via npm:
Or load directly via CDN:

Backend Setup: mTLS and the Ephemeral Token

Before initializing the SDK on the front-end, your backend must establish a secure connection to the PSE private API to obtain an ephemeral token.

Secure connection using mTLS authentication

Mutual TLS (mTLS) is a form of authentication where both parties in a connection verify each other using the TLS protocol. Your backend establishes an mTLS connection with the Gnosis Pay private PSE API to receive an ephemeral token.

Generating mTLS certificates

After signing up through the Partners Dashboard, you’ll receive an App ID instantly. Use it to generate a private key and Certificate Signing Request (CSR):
Share only ${APP_ID}.csr.pem with the Gnosis Pay team. Never share the .key.pem private key file with anyone.
Once we receive your CSR, we’ll sign it and return your signed certificates. These, along with your private key, are used to establish the mTLS connection.

Establishing mTLS authentication (Node.js)

Store your signed certificates and private key securely in your environment:
The ephemeral token is valid for a very short time frame. Generate a new one for every SDK usage.

Backend: ephemeral token relay endpoint

Your backend needs an endpoint that proxies ephemeral token requests to the PSE private API using the mTLS setup above. Example using Express:
CLIENT_CERT and CLIENT_KEY are the base64-encoded signed certificate and private key stored in your environment variables.

EIP-712 Two-Factor Authentication

PSE v3 requires a wallet signature before each sensitive operation. This acts as a second factor: even if an authModuleToken is compromised, an attacker cannot view card data or change a PIN without also controlling the user’s wallet.

How it works

Before initializing the SDK, your front-end must:
  1. Request a one-time challenge from the auth module.
  2. Ask the user’s wallet to sign the returned EIP-712 typed data.
  3. Pass the resulting signature and nonce to the SDK constructor.
The PSE service forwards both values to the auth module, which verifies the signature and marks the nonce as consumed. Each challenge is single-use and expires after 5 minutes.

Get PCI EIP-712 Challenge

Issues a one-time EIP-712 challenge. The response is a complete typed-data object that can be passed directly to signTypedData (convert message.nonce to BigInt first).
message.nonce is returned as a decimal string representing a uint256. Convert it to BigInt before passing it to signTypedData.

Signing the challenge

The challenge must be fetched immediately before each SDK initialization. Do not reuse a nonce across different operations or SDK instances as it will be rejected after the first use.

Initialize the SDK

After completing the EIP-712 challenge/sign step above, initialize the SDK with pseVersion: 3:
The authModuleToken expires every 15 minutes. Handle the onInvalidToken callback to refresh your access token via the Authenticating with SIWE flow and re-initialize the SDK.

Display card details

Use ElementType.CardData to display the full card number, expiration date, and security code.
Use action: "view-details" when fetching the EIP-712 challenge for this element.

View card PIN

Use ElementType.CardPin to display the card’s current PIN inside the secure iframe.
Use action: "view-pin" when fetching the EIP-712 challenge for this element.

Set / change card PIN

Use ElementType.SetCardPin to render a PIN entry form that lets the cardholder set or change their PIN.
Use action: "change-pin" when fetching the EIP-712 challenge for this element.

Refresh the ephemeral token

If the current ephemeral token has expired, you’ll receive an onInvalidToken callback. Refresh it without re-creating the SDK instance:

Available Elements

Each element is rendered in a secure iframe to ensure PCI compliance.

Element Lifecycle

Elements can be initialized and destroyed:

Callbacks

The SDK provides callbacks to handle events from the iframe elements:

Customizing Element Styling

For security reasons, the only way to apply custom styling to iframe elements is to prepare and share a CSS file with the Gnosis Pay team. This file, named <partner_name>.css, will be incorporated into the iframe. Standard styling is applied to iframe elements by default. Selectors you can override include:
  • .pse-container : shared class for all iframe containers
  • #pse-card-data-container : main container for displaying card data
  • .pse-card-field : container for each card data field (card number, expiry date, security code)
  • .pse-card-label : labels for each field
  • .pse-card-value : container for the actual card data values

Styling workflow

  1. In your front-end, load the element you wish to customize (e.g., the card data).
  2. Locate the custom CSS file with your name in either the “Style Editor” in Firefox or the “Sources” panel in Chrome/Brave (e.g., gnosis_pay_ui.css).
  3. Apply your desired styling changes reflect immediately in your interface.
  4. Save the file and send it to Gnosis Pay for application in production.