Introduction
The Display SDK is a secure client-side tool that lets you show sensitive payment data directly in your web or mobile app, without storing or processing raw card data on your servers. It uses secure fields to render tokenized data from your vault, helping you stay PCI compliant while delivering a seamless user experience. Some example use cases are: Card display in finance apps: Allow users to temporarily view full card details or CVV before making a payment or setting up wallets. Customer support tools: Enable support agents to show users card info during particular workflows or troubleshooting. This guide explains how to integrate your frontend with Payrails Display SDK to show tokenized cardholder data without receiving any sensitive data on your servers. You’ll be able to display all the fields stored under a card record, such as card number and expiration date, in a customized UI without compromising on security.Implementation
Thedisplay-sdk is a library for creating and managing display elements for payment forms. It provides a simple API to initialize the SDK, create elements, and customize their styles and translations.
Installation
Install the SDK via npm:Usage
Initialization
To use the SDK, initialize it with a response object and optional configuration options.Creating Elements
You can create display elements for different types of input fields, such as card number, expiry date, etc.Destroying Elements
To clean up and unmount all created elements, use thedestroy method.
API Reference
DisplaySDK
static init(initResponse: DisplaySDKInitResponse, options?: DisplaySDKOptions): DisplaySDK
Initializes the SDK with the given response and options.
initResponse: An object containing initialization data. The response is valid for 10 minutes.options: Optional configuration for styles and translations.
createElement(type: DisplayElementType): DisplayElement
Creates a new display element of the specified type.
type: The type of the element to create. Possible values are:DisplayElementType.CardNumberDisplayElementType.ExpiryYearDisplayElementType.ExpiryMonthDisplayElementType.SecurityCodeDisplayElementType.CardHolderNameDisplayElementType.CopyToClipboardNEW
destroy(): void
Destroys all created elements and cleans up resources.
DisplaySDKOptions
Configuration options for the SDK.
styles: An object defining style configurations for elements.translations: An object defining translations for elements.
Examples
Custom Styles
Custom Translations
DisplayElementType
An enumeration of possible element types:
CardNumberExpiryYearExpiryMonthSecurityCodeCardHolderNameCopyToClipboardNEW
Copy To Clipboard element NEW
Creates a new button element which allows copying any of the card display valuesDisplayElementType.
Note that this feature requires a PCI compliance check of the use case and can be enabled by Payrails Compliance Team upon evaluation. To request this feature, please get in touch with our support team.
New configuration as of DisplaySDK@1.0.7:
Regular button with default
Button that copies multiple fields at once
Button with all the available configuration
Deprecated configuration (still supported in DisplaySDK@1.0.7):
Regular button with default
Button that copies multiple fields at once