PCI Widget Web

As part of our embedded scope, you'll need secure access to sensitive card data. For data like PAN and CVV, using the PCI widget is mandatory due to PCI-DSS security requirements. If you're PCI-DSS certified, you can alternatively use the API to access this sensitive data directly.

The PCI widget offers several customization options to match your UI/UX requirements.

The widget integrates into your frontend through an iframe and displays card data for approximately 45 seconds. After this period, the card details are automatically hidden for security purposes.

You'll need two parameters for implementation:

  • traceId: A random, unique UUIDv4 that you generate when making the request. This ID helps trace the request through all systems involved and must remain consistent throughout the PCI widget request - use the same ID in both the iFrame URL and the OTP request (see endpoint).
  • widgetConfig: The configuration object for the widget, containing elements like the cardId (a Pliant UUIDv4) and design parameters. Full configuration details are available in the widget config section.
<iframe 
        src="{host}/card-details/widget?traceId={traceId}&params={widgetConfig}" 
        allow="clipboard-read; clipboard-write">
</iframe>

Here's an example of a fully parameterized iframe:

<iframe 
        src="https://pci-api.getpliant.com/card-details/widget?traceId=5c68c142-50a0-46e1-8a27-736a7908cc59&params=ewogICJ0aXRsZSI6ICJDYXJkIERldGFpbHMiLAogICJ0b2tlbiI6ICJ7cmVxdWVzdGVkIE9UUH0iLAogICJjYXJkSWQiOiAie1BsaWFudCdzIGNhcmRJZH0iLAogICJvdmVybGF5VGV4dCI6ICJTaG93IGNhcmQgZGV0YWlscyIsCiAgImNvcHlMYWJlbCI6ICJDb3B5IiwKICAiZnJhbWVJZCI6ICJjYXJkLWRldGFpbHMtd2lkZ2V0LWZyYW1lIiwKICAiY3NzQ2xhc3MiOiAid2lkZ2V0LWNvbnRhaW5lciIsCiAgInN0eWxlVXJsIjogIi4vd2lkZ2V0L3N0YXRpYy9wY2ktd2lkZ2V0LmNzcyIsCiAgInBhbiI6IHsKICAgICJsYWJlbCI6ICJDYXJkIG51bWJlciIsCiAgICAiZGlzcGxheSI6IHRydWUsCiAgICAiY2xpY2tUb0NvcHkiOiB0cnVlLAogICAgInRleHRPbkNvcHkiOiAiQ29weSBjYXJkIG51bWJlciIKICB9LAogICJjYXJkaG9sZGVyTmFtZSI6IHsKICAgICJsYWJlbCI6ICJDYXJkaG9sZGVyIG5hbWUiLAogICAgImRpc3BsYXkiOiB0cnVlLAogICAgImNsaWNrVG9Db3B5IjogdHJ1ZSwKICAgICJ0ZXh0T25Db3B5IjogIkNvcHkgY2FyZGhvbGRlciBuYW1lIgogIH0sCiAgImV4cGlyeURhdGUiOiB7CiAgICAibGFiZWwiOiAiRXhwIiwKICAgICJkaXNwbGF5IjogdHJ1ZSwKICAgICJjbGlja1RvQ29weSI6IHRydWUsCiAgICAidGV4dE9uQ29weSI6ICJDb3B5IGV4cGlyeSBkYXRlIgogIH0sCiAgImN2diI6IHsKICAgICJsYWJlbCI6ICJDVlYiLAogICAgImRpc3BsYXkiOiB0cnVlLAogICAgImNsaWNrVG9Db3B5IjogdHJ1ZSwKICAgICJ0ZXh0T25Db3B5IjogIkNvcHkgQ1ZWIgogIH0KfSA=" 
        allow="clipboard-read; clipboard-write">
</iframe>

Data Flow

The process works as follows:

  1. The cardholder authenticates on your frontend.
  2. The cardholder clicks a button to view sensitive card data.
  3. Your frontend requests a one-time password (OTP) to reveal this data, by sending this GET request through your backend, which then forwards it to Pliant's PCI API. See the endpoint documentation.

    curl 'https://{host}/card-details/widget/{cardId}/otp' \
    --header 'Pliant-Trace-Id: {random UUIDv4, generated by you}' \
    --header 'Authorization: Bearer {token}'
    1. Your backend must validate the request to ensure the requesting user has permission to access the card data.
    2. Include a Pliant-Trace-Id header in the OTP request to enable tracing through all systems.
  4. After receiving the OTP, compile the PCI widget configuration using the schema below. Base64-encode the JSON configuration for use as the widgetConfig parameter.
  5. Create and load the iframe with src="{host}/card-details/widget?traceId={traceId}&params={widgetConfig}" using the same trace ID from the OTP request.
  6. During iframe loading, an RSA key pair is generated for data encryption (valid only for a short time).
  7. The sensitive card data is requested using the public RSA key and your widget configuration.
  8. The system verifies the browser's user agent against a blacklist, allowing only actual browser requests (tools like Postman or CLI utilities are blocked).
  9. The public RSA key encrypts the card data response containing the sensitive information, with the widget config determining which specific fields are returned.
  10. The iframe decrypts the card data using the private RSA key and displays it temporarily.
  11. After 45 seconds, the iframe content is replaced with a static placeholder, and all sensitive data is permanently deleted from the page and browser clipboard.
  12. The system sends an event with the message {eventType: CARD_DATA_CLEARED, frameId: <frameId>} to the parent page. Your page should include an event handler that destroys the iframe when it receives this event. For errors, the system sends an event with the same structure but with eventType set to CARD_DATA_LOADING_FAILED.

Environments

Widget Config

The widget configuration is transmitted to the iframe as a base64-encoded JSON payload. For implementation examples, see examples for iframe widget usage.

{
  "title": "Card Details",
  "token": "{requested OTP}",
  "cardId": "{Pliant's cardId (36 chars UUIDv4)}",
  "overlayText": "Show card details",
  "copyLabel": "Copy",
  "frameId": "card-details-widget-frame",
  "cssClass": "widget-container",
  "styleUrl": "./widget/static/pci-widget.css",
  "pan": {
    "label": "Card number",
    "display": true,
    "clickToCopy": true,
    "textOnCopy": "Copy card number"
  },
  "cardholderName": {
    "label": "Cardholder name",
    "display": true,
    "clickToCopy": true,
    "textOnCopy": "Copy cardholder name"
  },
  "expiryDate": {
    "label": "Exp",
    "display": true,
    "clickToCopy": true,
    "textOnCopy": "Copy expiry date"
  },
  "cvv": {
    "label": "CVV",
    "display": true,
    "clickToCopy": true,
    "textOnCopy": "Copy CVV"
  }
} 

This configuration is attached to the URL as a base64-encoded string:

ewogICJ0aXRsZSI6ICJDYXJkIERldGFpbHMiLAogICJ0b2tlbiI6ICJ7cmVxdWVzdGVkIE9UUH0iLAogICJjYXJkSWQiOiAie1BsaWFudCdzIGNhcmRJZH0iLAogICJvdmVybGF5VGV4dCI6ICJTaG93IGNhcmQgZGV0YWlscyIsCiAgImNvcHlMYWJlbCI6ICJDb3B5IiwKICAiZnJhbWVJZCI6ICJjYXJkLWRldGFpbHMtd2lkZ2V0LWZyYW1lIiwKICAiY3NzQ2xhc3MiOiAid2lkZ2V0LWNvbnRhaW5lciIsCiAgInN0eWxlVXJsIjogIi4vd2lkZ2V0L3N0YXRpYy9wY2ktd2lkZ2V0LmNzcyIsCiAgInBhbiI6IHsKICAgICJsYWJlbCI6ICJDYXJkIG51bWJlciIsCiAgICAiZGlzcGxheSI6IHRydWUsCiAgICAiY2xpY2tUb0NvcHkiOiB0cnVlLAogICAgInRleHRPbkNvcHkiOiAiQ29weSBjYXJkIG51bWJlciIKICB9LAogICJjYXJkaG9sZGVyTmFtZSI6IHsKICAgICJsYWJlbCI6ICJDYXJkaG9sZGVyIG5hbWUiLAogICAgImRpc3BsYXki

Did this page help you?