Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 46 additions & 3 deletions integrations/wallets/embedded-card-capture.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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 |
Expand Down Expand Up @@ -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
<KernelCardCapture
token={captureToken}
className="acme-card"
evervaultTheme={{
fonts: ["https://fonts.googleapis.com/css2?family=Inter:wght@400;500&display=swap"],
styles: {
body: { fontFamily: "Inter, system-ui, sans-serif", color: "#1f1147" },
"[ev-component=card]": { gap: 16 },
label: { display: "block", marginBottom: 6, fontSize: 13, fontWeight: 500 },
input: {
height: 46,
padding: "0 12px",
border: "1px solid #d9d0f5",
borderRadius: 10,
fontSize: 16,
"&::placeholder": { color: "#9a8fbf" },
"&:focus": { borderColor: "#7b4dff" },
},
".field[ev-valid=false] input": { borderColor: "#d1243a" },
".error": { marginTop: 6, fontSize: 12, color: "#d1243a" },
},
}}
/>
```

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`.
Expand All @@ -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
Expand Down
19 changes: 15 additions & 4 deletions integrations/wallets/embedded-card-cvc.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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 |
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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.
Loading