Capabilities
The payment card SDK uses secure iframes to display the following information on a merchant page:- Primary account number (PAN)
- Expiration date (EXP)
- CVV
- Card information copy buttons
SDK URLs
Select the SDK URL that matches your environment.Use the sandbox SDK during development and integration testing. Replace it with the production SDK before going live.
Get the integrity Hash
Retrieve the sandbox SDK integrity hash from the following URL:
https://paysdk.keysecure.io/Sbox/0.0.1/integrity.json
Retrieve the production SDK integrity hash from the following URL:
https://paysdk.keysecure.io/SDK/prod/0.0.1/integrity.json
Example response:
files["index.min.js"] into the integrity attribute of the <script> tag.
Load the SDK
Add the following<script> tag to your HTML page to load the sandbox SDK:
Prerequisites
Register Page Origins
Register the origin of every page that embeds the SDK in the merchant portal, for example:- HTTPS is required.
- Register the exact origin. Wildcards such as
*.merchant.comare not supported. - Contact KeySecure technical support if the origin registration option is not available in the merchant portal.
- Content Security Policy (CSP) may block the SDK on unregistered pages.
Obtain a Client Access Token on the Backend
The Client Access Token must be obtained by the merchant backend. Never exposeApi-Key, Access-Token, or other server-side credentials in the browser.
data.client_access_token to the frontend. See Issue PCI Client Access Token for complete parameter details.
Frontend Integration
Prepare the Containers
Initialize the SDK
Destroy and Resize
When
bootstrap is called repeatedly with the same token, the SDK destroys the associated components before rebuilding them. Because the token is a one-time credential, the application should still avoid duplicate initialization and request a new token before reloading the components.
API Configuration Reference
Error Handling
Initialization Errors
Readerror.code in callbackEvents.onFailure(error):
Copy Errors
Readerror.code in onCopyFailure(error):
Style Customization
For security,styles only supports the following CSS properties. Unsupported properties are ignored:
Integration Checklist
- The page origin is registered and exactly matches the actual HTTPS page.
- The SDK URL matches the current environment.
-
integritycontains the latest SRI hash for the selected SDK file. - The backend obtains the Client Access Token, and the frontend never receives server credentials.
- The token is not logged, persisted, or reused.
- Copy button containers have
position: relativeand explicit dimensions. - Sensitive page responses include
Cache-Control: no-store, no-cache. -
widget.destroy()is called when leaving or unmounting a sensitive view. - Initialization and copy failure callbacks are handled.
Security Requirements
- Do not attempt to extract plaintext card data from the DOM, network requests, or internal SDK messages.
- Do not write the Client Access Token to databases, cookies, logs, or analytics events.
- Avoid placing the card information page inside nested iframes, which may break parent origin validation.
- Do not run screen recording, session replay, or unnecessary third-party analytics scripts on sensitive pages.
- Do not listen to, construct, or reuse internal SDK communication channels.
Browser Compatibility
Troubleshooting
The page reports aframe-ancestors CSP violation
Confirm that the current page origin is registered. Request a new Client Access Token after registration, then initialize the SDK again.
The SDK repeatedly returns TOKEN_INVALID
The token is a one-time credential. Check whether React Strict Mode, SPA route transitions, or repeated rendering triggers initialization twice, and call widget.destroy() when unmounting the component.
Nothing happens when a copy button is clicked
Confirm that the copy container uses position: relative and has non-zero dimensions. The Clipboard API requires a user gesture; do not simulate the click with a timer.
The iframe is blank
Inspect the browser Network and Console panels. Confirm that requests do not return 403, the container is visible, and CSP or Permissions Policy is not blocking the iframe.
If the issue persists, provide the browser, SDK URL, error code, and reproduction steps to KeySecure technical support. Never include a Client Access Token, full card number, or CVV in a support ticket or chat.