Skip to main content
Card Element is the secure card entry component in rinne-js. It renders sensitive fields in an isolated context and returns encrypted values and validation state for your checkout UI. Use Card Element for all card transactions. Rinne expects encrypted values from mountedCard.values and does not accept plain PAN/CVC.

Create a Card Element

The Core API requires cardholder_name and last_digits (4 digits) when creating card transactions. Include 'name' in your fields array so the cardholder name is captured by the Card Element. If you omit 'name', you must collect the cardholder name through your own form input and pass it as cardholder_name in card_data when calling the API.
To process real card transactions, the merchant or organization must have an active Rinne affiliation for card processing.

Capture Payload Contract

cardElement.mount() returns a mountedCard object. In production checkout, send mountedCard.values.card to your backend.
Before the user finishes input, fields in mountedCard.values.card can still be empty strings.
number and cvv are encrypted in mountedCard.values.card. expiry_month and expiry_year are plain strings.

Options

Event Lifecycle

onComplete means all fields are filled. It does not guarantee the values are valid.

colorScheme

Set colorScheme to the same value as your page theme so the card iframe blends correctly with light or dark surfaces.

Field Control

Validation State

Use onChange to enable/disable your submit button.

Read Mounted Card Values

After mount, you can read encrypted values from mountedCard.values.
Card number and CVV are encrypted before exposure in mountedCard.values.

Submit Pattern

Never collect raw PAN/CVC in your own inputs. Use only encrypted values from mountedCard.values.

Live Demo

This sandbox demo mounts the card element directly in Mintlify, applies colorScheme based on the current docs theme, and shows real-time state plus encrypted values.

Theming

theme accepts:
  • A preset: 'clean' | 'minimal' | 'material'
  • A config object: { preset?, styles?, fonts? }
  • A function theme: (utils) => ({ styles, fonts })

Preset Preview

This live sandbox preview uses tabs to switch between built-in presets while keeping the same card configuration. The iframe window stays on a light surface for easier visual comparison.

Custom Styling

Theme styles are CSS-in-JS rules injected into the secure iframe. You can style CSS selectors, but you cannot change iframe HTML structure.

Full Theme Example

rinne-theme.ts

State Attributes for Selectors

Use these iframe attributes for state-aware styling:

Responsive Styling

Use a function theme and utils.media() so breakpoints match the parent document viewport.
Set both colorScheme and theme using the same page theme source so iframe and host container stay visually consistent.

Mount Errors

mount() throws when the target selector is invalid or the provider cannot render the component.

Unmount