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.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: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 anApp ID instantly. Use it to generate a private key and Certificate Signing Request (CSR):
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 anauthModuleToken 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:- Request a one-time challenge from the auth module.
- Ask the user’s wallet to sign the returned EIP-712 typed data.
- Pass the resulting signature and nonce to the SDK constructor.
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 tosignTypedData (convert message.nonce to BigInt first).
- Sandbox
- Production
message.nonce is returned as a decimal string representing a uint256. Convert it to BigInt before passing it to signTypedData.Signing the challenge
Initialize the SDK
After completing the EIP-712 challenge/sign step above, initialize the SDK withpseVersion: 3:
Display card details
UseElementType.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
UseElementType.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
UseElementType.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 anonInvalidToken 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
- In your front-end, load the element you wish to customize (e.g., the card data).
- 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). - Apply your desired styling changes reflect immediately in your interface.
- Save the file and send it to Gnosis Pay for application in production.