diff --git a/integrations/wallets/embedded-card-capture.mdx b/integrations/wallets/embedded-card-capture.mdx index e573bbc5..141fc19a 100644 --- a/integrations/wallets/embedded-card-capture.mdx +++ b/integrations/wallets/embedded-card-capture.mdx @@ -27,11 +27,11 @@ use `action.url` instead when a hosted page is acceptable. it needs no frontend ## Install ```bash -bun add @onkernel/vault-react -# or: npm install @onkernel/vault-react +bun add @onkernel/vault-react@^0.5.0 +# or: npm install @onkernel/vault-react@^0.5.0 ``` -the package requires react 18 or later and ships no styles. +the package requires react 18 or later and ships no styles. use 0.5.0 or later: earlier versions can't render cards stored in Evervault and report those capture links as `unavailable`. ## Get a capture token on your backend @@ -129,6 +129,7 @@ export function AddCard({ captureToken }: { captureToken: string }) { | `baseUrl` | api origin; defaults to `https://api.onkernel.com` | | `className` | added to the root element, in both the form and completion views | | `fieldCss` | css applied inside the card number, expiry, and cvc iframes | +| `evervaultTheme` | theme for Evervault's card fields; see [Evervault card fields](#evervault-card-fields) | | `labels` | partial override of the component's text | | `email` | prefills the email input; the cardholder can still change it | | `onComplete` | runs once after KERNEL confirms the card was added | @@ -218,6 +219,38 @@ css on your page can't reach inside the hosted fields. pass `fieldCss` instead; `fieldCss` supports nested pseudo-classes, `@font-face`, media queries, and the state classes `&.invalid`, `&.valid`, `&.empty`, `&.dirty`, and `&.touched`. the component reads it once, when it mounts; remount the component to change it. +### Evervault card fields + +when your organization stores KERNEL cards in Evervault, the component renders Evervault's card component (card number and expiry) instead of the fields above. `fieldCss` doesn't apply there: Evervault renders each field's label, input, and error inside its own iframe. pass `evervaultTheme` instead. its `styles` are css-in-js rules keyed by selector, which Evervault injects into its iframe: + +```tsx + +``` + +without a theme, Evervault's inputs render unbordered. the `number`, `expiry`, and `expirationPlaceholder` labels set the Evervault field labels and expiry placeholder. the component reads the theme and labels once, when it mounts. you can pass both `fieldCss` and `evervaultTheme`; the component uses whichever matches the card vault. + ### Text override any of these keys through `labels`: `title`, `description`, `completeTitle`, `completeDescription`, `number`, `expiry`, `expirationPlaceholder`, `cvc`, `email`, `emailHint`, `submit`, `submitting`, `retry`, `checkAgain`, and `missingToken`. @@ -234,6 +267,16 @@ frame-src https://js.verygoodvault.com; connect-src 'self' https://api.onkernel.com; ``` +if your organization stores cards in Evervault, also allow Evervault's origins. Evervault requires its sdk to load from its cdn, so it can't be pinned with an integrity hash: + +```text +script-src ... https://js.evervault.com; +frame-src ... https://ui-components.evervault.com; +connect-src ... https://keys.evervault.com; +``` + +if the Evervault sdk or component doesn't load within 30 seconds, for example because your CSP blocks its frame, the component reports `network` and shows a retry button. + if `fieldCss` uses `@font-face`, also allow the font's source. you don't need to allow the hosted-fields analytics endpoint; blocking it doesn't affect card capture. ## Handle completion diff --git a/integrations/wallets/embedded-card-cvc.mdx b/integrations/wallets/embedded-card-cvc.mdx index 52641186..c67d913e 100644 --- a/integrations/wallets/embedded-card-cvc.mdx +++ b/integrations/wallets/embedded-card-cvc.mdx @@ -18,11 +18,11 @@ The cardholder enters the code in a secure hosted field. Your page, your servers ## Install ```bash -bun add @onkernel/vault-react@^0.4.0 -# or: npm install @onkernel/vault-react@^0.4.0 +bun add @onkernel/vault-react@^0.5.0 +# or: npm install @onkernel/vault-react@^0.5.0 ``` -The package requires React 18 or later and ships no CSS. +The package requires React 18 or later and ships no CSS. Use 0.5.0 or later if your organization stores KERNEL cards in Evervault; earlier versions can't render the Evervault CVC field. ## Deliver the capability from your backend @@ -131,6 +131,7 @@ The server-derived merchant, amount, and card's last four digits remain visible. | `baseUrl` | API origin; defaults to `https://api.onkernel.com`. HTTPS required; HTTP loopback is allowed for local development. Paths, query strings, fragments, and URL credentials aren't allowed. | | `className` | Root class in both form and completion views | | `fieldCss` | CSS inside the secure CVC iframe; read at mount | +| `evervaultTheme` | Theme for the Evervault CVC field when cards are stored in Evervault; read at mount. See [embedded card capture](/integrations/wallets/embedded-card-capture#evervault-card-fields) | | `labels` | Partial text overrides; see below | | `onComplete` | Runs once after a 2xx response with `status: "approved"` confirms collection, not payment | | `onError` | Receives only a fixed error code | @@ -180,6 +181,8 @@ Style the surrounding form through your `className`. Give the iframe container a Page CSS can't reach into the iframe. Use `fieldCss` for input styling, including nested selectors such as `&:focus`, `&.invalid.touched`, `&::placeholder`, media queries, and `@font-face`. Supply it before mounting; remount to change it. +When your organization stores KERNEL cards in Evervault, the component renders Evervault's component for the CVC alone. Page CSS and `fieldCss` can't style it; pass `evervaultTheme`, which uses the same format as on [embedded card capture](/integrations/wallets/embedded-card-capture#evervault-card-fields). The `cvc` and `cvcPlaceholder` labels set its label and placeholder. The component posts the encrypted CVC to KERNEL with the same capability; neither your application nor KERNEL can decrypt it. + Override these `labels` keys: `title`, `description`, `completeTitle`, `completeDescription`, `cvc`, `cvcPlaceholder`, `submit`, `submitting`, `loading`, `retry`, and `missingToken`. Set the title, descriptions, and completion copy to your application's wording; defaults use KERNEL's lowercase copy and mention KERNEL. Error messages are fixed. ## Allow the component in your CSP @@ -192,6 +195,14 @@ frame-src https://js.verygoodvault.com; connect-src 'self' https://api.onkernel.com; ``` +If your organization stores cards in Evervault, also allow Evervault's origins: + +```text +script-src ... https://js.evervault.com; +frame-src ... https://ui-components.evervault.com; +connect-src ... https://keys.evervault.com; +``` + Collect loads a pinned, integrity-checked script and submits from its iframe origin. You don't need the inbound proxy hostname or Collect analytics endpoints in your page's `connect-src`. If you use external fonts, allow their source in the appropriate context and test the iframe rendering. The hosted fallback cannot itself be framed. ## Handle completion and expiry @@ -224,4 +235,4 @@ The form is removed from use after `expired`, `unavailable`, `invalid_response`, - Treat the CVC capability as a secret. Never put it in a path, query string, cookie, browser storage, logs, traces, or analytics. If you deliver a link, use a fragment and clear it after completion or terminal invalidation. - Don't add native CVC inputs, raw-value callbacks, analytics, or session replay around the component. Control scripts and dependencies that can modify the surrounding page. - Raw CVC stays in the secure hosted field and the card vaulting provider's processing. Your page and KERNEL never receive it. This preserves the isolated-field boundary used by embedded card capture; it doesn't certify your PCI scope or SAQ eligibility. Confirm your integration's eligibility and script-security requirements with your acquirer or QSA. -- The hosted field submission origin is `https://js.verygoodvault.com`; no provider credentials or callback secrets belong in your frontend. +- For VGS cards, the hosted field submission origin is `https://js.verygoodvault.com`. For Evervault cards, the component posts only Evervault ciphertext to the KERNEL API. No provider credentials or callback secrets belong in your frontend.