Reveal Card Details
Display an issued card's PAN, expiry, CVV and PIN inside Wirex-served iframes without the values reaching your page.
Before You Start
Read the following guides before proceeding:
| Guide | Why |
|---|---|
| Web SDK | Isolation model and package map |
| SDK Setup | Client id (partner id), environments, installation, CSP |
| Card Details | Confirmation methods and action-token rules |
| Card Issuance | How the card id is produced |
Overview
@wirexapp/card-reveal-web displays an issued card's sensitive details — full PAN, expiry, CVV and PIN —
inside Wirex-served iframes. The frame fetches the values directly from the Wirex API and renders them in
place. Copy-to-clipboard runs inside the frame. Your page mounts the element and receives status events; it
never receives the values.
The element calls the same endpoints documented in Card Details:
| Requested row | Endpoint the frame calls |
|---|---|
number, expiry | POST /api/v1/cards/{cardId}/details |
cvv | POST /api/v1/cards/{cardId}/cvv |
pin | POST /api/v1/cards/{cardId}/pin |
cardholder | None — rendered from the cardholderName you pass |
Prerequisite: Mint an Action Token
Reveal requires a one-shot action_token on top of the user token. Mint it through the confirmation flow —
authenticated with the same user token — immediately before mounting the element.
const nonce = Math.floor(Date.now() / 1000);
const message = `By signing this I confirm that I am executing action GetCardDetails at ${nonce}`;
const messageSignature = await wallet.signMessage(message);
const { action_token: actionToken } = await fetch(
`${baseUrl}/api/v1/confirmation/signature/verify`,
{
method: 'POST',
headers: {
'Authorization': `Bearer ${accessToken}`,
'X-User-Wallet': userEoaAddress,
'X-Chain-Id': chainId,
'Content-Type': 'application/json'
},
body: JSON.stringify({ action_type: 'GetCardDetails', message_signature: messageSignature, nonce })
}
).then(response => response.json());| Property | Value |
|---|---|
| Validity | 5 minutes |
| Scope | GetCardDetails — one token covers the PAN, CVV and PIN endpoints of one reveal |
| Usage | Mint a fresh token each time the user opens the details view |
SMS OTP confirmation produces the same token under the field name token. Both methods are documented in
Card Details.
Mount the Element
import { createCardReveal } from '@wirexapp/card-reveal-web';
const reveal = createCardReveal(
{ environment: 'uat', clientId: 'a4f6c1e2-9b03-4d77-8a51-2f0c6b8e4d19' },
{
cardId: '64120850-73a1-4df5-a074-d463258c9deb',
actionToken,
fetchDetails: true,
fetchCvv: true,
fields: ['cardholder', 'number', 'expiry', 'cvv'],
cardholderName: 'ALEX GREY',
auth: {
getBearerToken: () => session.getAccessToken(),
userEmail: user.email,
userWallet: user.walletAddress,
},
onStateChange: ({ status, errorMessage }) => {
if (status === 'error') showToast(errorMessage);
},
onCopied: ({ field }) => analytics.track('card_detail_copied', { field }),
},
);
await reveal.mount(document.querySelector('#card-details'));
// When the user closes the details view:
reveal.destroy();Configuration
| Field | Type | Required | Description |
|---|---|---|---|
cardId | string | Yes | Issued card to reveal |
actionToken | string | Yes | Step-up token from confirmation, valid for 5 minutes |
fetchDetails | boolean | Yes | Requests the number and expiry rows. Ignored when fields is set |
fetchCvv | boolean | Yes | Requests the cvv row. Ignored when fields is set |
fields | array | No | Exact rows to render, in order: cardholder, number, expiry, cvv, pin. Drives which endpoints the frame calls |
cardholderName | string | No | Rendered as a plain, non-sensitive row |
auth.getBearerToken | () => Promise<string> | Yes | Returns a fresh user token |
auth.userEmail | string | No | Sent as X-User-Email. A cross-origin frame cannot read your session |
auth.userWallet | string | No | Sent as X-User-Wallet |
appearance | object | No | Whitelisted styling tokens — see Appearance and Localization |
strings | object | No | Translated labels — see Strings Keys |
onStateChange | (state) => void | No | { status, errorMessage? } |
onCopied | (event) => void | No | { field } — which row the user copied. The value never leaves the frame |
copy | button | text | row | none | No | Copy control. Default button. See Copy Behavior |
copyByField | object | No | Per-row copy override: { pin: 'none' }. Accepts button, row, none |
showLabels | boolean | No | Default true. false renders no label element; the label becomes the value's accessible name |
rowStyle | plain | boxed | No | Default plain. boxed draws each row as a pill from the box tokens |
layout | column | row | No | Default column (stacked). row places the fields side by side, equal widths |
masked | boolean | object | No | Rows that mount masked: true for all, or { cvv: true, pin: true }. Default nothing masked. See Masking |
maskToggle | button | text | row | none | No | In-frame show/hide control on every sensitive row. Default none |
maskToggleByField | object | No | Per-row maskToggle override |
maskAfter | number | object | No | Milliseconds after which a shown row re-masks. A number for every row, or { pin: 10000 }. Default never |
onMaskedChange | (event) => void | No | { masked, field?, reason } — the masked state the frame applied |
onRevealRequested | (event) => void | No | { field }. When passed, the toggle does not reveal; it asks your page, and you reveal with setMasked() |
fetchDetailsandfetchCvvare required by the TypeScript config type even whenfieldsis set. When
fieldsis present it decides the rows; the two flags are not read. Omittingfieldsrenders
cardholder, thennumberandexpirywhenfetchDetailsistrue, thencvvwhenfetchCvvis
true— thepinrow is reachable only throughfields.
The chain identifier and the API base URL are the frame service's own configuration. Neither is a config
field, so your page cannot point a reveal request at another host.
Identity Headers
auth.userEmail and auth.userWallet are sent as X-User-Email and X-User-Wallet. A
user token carries the user id, wallet address and
email in its own claims, so the API resolves the cardholder from the token and does not read these headers.
Setting both is safe with a user token and rejected with an S2S token, which reads exactly one identity
header and returnsErrorInvalidField(field: user_identifier) when given more. This is one more
reason the bearer must be a user token. See
User Identity Headers.
Layout Options
By default the frame stacks rows as label and value with an icon copy button. Four options make one frame
match layouts that otherwise take several frames and host-drawn chrome:
| Option | Effect |
|---|---|
showLabels: false | Values only. The row is exactly as tall as its value (add the spacingUnit: '0px' token for a flush row). With copy: 'button' the row is floored at the icon's hit target (copyIconSize + 12px) |
copy: 'row' or 'none' | The whole row copies, or nothing does — no icon width reserved |
rowStyle: 'boxed' | Each row is a pill drawn inside the frame from colorBackground, colorBorder, borderRadius, borderWidth and controlMinHeight, with 16px horizontal padding, spacingUnit vertical padding and fieldGap between pills |
layout: 'row' | Fields side by side, equal widths, fieldGap apart |
The wordSpacing appearance token spreads the card number's four-digit groups apart, as card artwork does.
A card-artwork layout — number on one line, expiry and CVV side by side — is two frames:
const shared = {
cardId, actionToken, auth, appearance,
fetchDetails: true, fetchCvv: true,
showLabels: false, copy: 'row', rowStyle: 'boxed',
};
createCardReveal(sdk, { ...shared, fields: ['number'] });
createCardReveal(sdk, { ...shared, fields: ['expiry', 'cvv'], layout: 'row' });Group rows into one frame where you can.
numberandexpiryshare one
POST /api/v1/cards/{cardId}/detailscall.fields: ['expiry', 'cvv']in one row frame calls it once;
two single-field frames call it twice with the same action token.
Layouts are frame-wide. A mixed arrangement — one field full-width above a row of others — is two frames.
Unknown fields entries are dropped.
Masking
Each sensitive row — number, expiry, CVV, PIN — can be hidden and shown in place, without a second
step-up. The state is per row and lives in the frame. The user changes it through an in-frame control you
opt into; your page changes it through setMasked().
// Self-contained: CVV and PIN start hidden, every sensitive row has an eye.
const reveal = createCardReveal(sdk, {
...config,
masked: { cvv: true, pin: true },
maskToggle: 'button',
maskAfter: { pin: 10000 },
onMaskedChange: ({ masked, field, reason }) => analytics.track('card_masked', { field, reason }),
});
// Host-driven: your own button, no in-frame control.
const reveal = createCardReveal(sdk, { ...config, masked: true });
showButton.onclick = () => reveal.setMasked(false); // every row
hideCvvButton.onclick = () => reveal.setMasked({ cvv: true }); // one row, the rest untouched
// Gated: the eye only asks; reveal after your own check.
const reveal = createCardReveal(sdk, {
...config,
masked: true,
maskToggle: 'button',
onRevealRequested: async ({ field }) => {
if (await biometrics.verify()) reveal.setMasked({ [field]: false });
},
});| Rule | Detail |
|---|---|
| Fetch | Values are fetched once, at mount, under the actionToken. Masking and unmasking never refetch and never need a new token |
| Rendering | The value text is replaced in the frame's DOM, not overlaid: card number •••• •••• •••• 1111 (last four stay), expiry ••/••, CVV and PIN one glyph per character. The glyph is the first character of the maskedPlaceholder string |
| Layout | The masked text has as many characters as the value, so the row keeps its height and the iframe does not resize |
| Cardholder | Never masked and never listed in onMaskedChange |
| Copy | The copy control stays and copies the real value. Masking is a display aid against shoulder-surfing and screen sharing, not an access control. Use copy: 'none' or copyByField when a field must not be copyable |
Toggle with copy: 'row' | The row's single click copies, so that row gets no toggle |
| Gate | With onRevealRequested, the toggle only asks and the row stays masked until you call setMasked({ [field]: false }). Hiding is never gated |
| Timer | maskAfter counts from the moment the value is visible and reports reason: 'timeout' |
| Older frames | A frame deployment that predates masking ignores masked and shows the values; it never sends onMaskedChange — that is how you detect it |
Masking does not replace short-lived mounting. Mount the element only when the user asked to see the
card. PCI SSC guidance says a full PAN should not stay on screen indefinitely; enforce your re-mask
policy withmaskAfter, or with your own timer andsetMasked(true).
onMaskedChange payload:
| Field | Description |
|---|---|
masked | Map of every rendered maskable row to a boolean — { number: true, expiry: true, cvv: false } |
field | The row that changed, for user and timeout |
reason | init, user, host or timeout |
Object.values(masked).every(Boolean) means every row is hidden.
Element State
onStateChange: ({ status, errorMessage }) => {
// status: 'loading' | 'ready' | 'error'
}| Status | Meaning |
|---|---|
loading | The frame verified its init and started fetching. Nothing renders yet |
ready | At least one requested row loaded |
error | Every requested fetch failed. errorMessage is safe to display |
A partial failure reports
ready, noterror. Rows whose fetch failed render an em dash while the
rows that succeeded render their values. The error banner and theerrorstatus appear only when nothing
loaded at all.
Causes of error: an expired actionToken (older than 5 minutes), an unknown card id, a card status that does not
permit the operation, or a backend failure. The action_token error reasons are listed in
Card Details.
Copy Behavior
Copy writes to the clipboard from inside the frame in every mode. Your page receives no clipboard content and
no event payload containing values — onCopied carries the field name and nothing else. The reveal iframe is
the only frame in the SDK granted clipboard-write; the collect frames are granted no permissions at all.
copy | Control |
|---|---|
button (default) | Icon button beside each value; a checkmark for 2 seconds after copying |
text | Text button from the copy string; shows copied for 2 seconds |
row | The whole row is a real button (click, Enter, Space); the copied state shows on the value and is announced to assistive technology |
none | No copy control. The value stays selectable text |
copyByField overrides the mode per row — { cvv: 'none', pin: 'none' } keeps the icon everywhere but on
the CVV and PIN. An invalid entry leaves that row on copy.
Strings Keys
| Key | Default |
|---|---|
cardholderLabel | Cardholder |
cardNumberLabel | Card Number |
expiryLabel | Expiry date |
cvvLabel | CVV/CVC |
pinLabel | PIN |
copy | Copy |
copied | Copied |
show | Show — the mask toggle's text (maskToggle: 'text') and accessible name while masked |
hide | Hide — the same while shown |
maskedPlaceholder | • — the glyph drawn for each hidden character (first character of the string) |
loadError | Failed to load card details |
Lifecycle
- Mount the element when the user asks to see the details; call
destroy()when the view closes. setMasked()is the only option that changes after mount. Every other option is read at mount.- Elements are single-use. Re-opening the view requires a new element and a fresh
actionToken. mount()rejects when the frame document cannot load or refuses to initialize. See
Events and Error Handling.
Your Responsibilities
- Keep the reveal element short-lived. It exists for the duration of a user-initiated details view.
- Mint the
action_tokenimmediately before mounting. A token minted earlier in a flow expires 5 minutes
after issue. - Do not proxy
POST /api/v1/cards/{cardId}/details,/cvvor/pinthrough your own backend. Proxying
cardholder data is permitted only when that backend is itself PCI DSS compliant, which the SDK exists to
avoid.
Exports
| Export | Returns |
|---|---|
createCardReveal(sdk, config) | { mount(container), setMasked(boolean | { [field]: boolean }), destroy() } |
Updated about 12 hours ago

