This page documents
@whop/elements@1.9.0 and @whop/elements-react@1.9.0.v1.0.0.
Mounts inside
Payments. Create it to get a handle, then mount its elements on that handle. Call destroy() to remove the sub-controller and free its slot. Create it again to get a fresh handle.Exclusive.
CardFields is an alternative to PaymentElement or CardElement in this Payments handle. Mount one at a time. Destroy it before mounting another.Preview
A live, interactive demo of this sub-controller’s default arrangement with example data:Options
Pass these topayments.create('cardFields', { … }), or as props on <CardFields> in React. Parent-injected props never appear here.CardNetworkArt[]
The seller’s accepted card networks in display order — the matrix card entry’s
networks objects, whose API-served icons drive the number field’s brand art. Omit it to fetch alongside the key."compact" | "stacked"
stacked (default) shapes composed fields as a number row above expiration and security code. compact shapes one row. Separately mounted fields ignore this layout and render with full borders and rounded corners. Defaults to "stacked".string
Advanced Basis Theory publishable key. Omit it to fetch the key automatically.
Events
Pass callbacks in the create options or React props.onChange
Fires when completeness changes. complete becomes true after the buyer fills all three fields. Use it to enable confirmation. brand is the detected card network as the field reports it; network is the same detection in the API’s network vocabulary (matches the matrix card entry’s networks, null while unknown). last4 is the number’s last four digits, null until the number is far enough along. funding is the detected funding type (credit, debit, or prepaid), null until the number identifies one. issuingCountry is the lowercase two-letter code of the country the card was issued in, null until the number identifies one.object
Methods
Call these on the sub handle frompayments.create('cardFields', { … }).tokenize
Advanced method that tokenizes the three fields without creating a confirmation token. It emits tokenized to the payments controller. Validation errors appear on the failing field, and the method throws. Use payments.createConfirmationToken() to confirm a payment.Parametersobject
required
Promise<object>string
required
collect
payments.createConfirmationToken() calls this action for cardFields. Don’t call it directly. It tokenizes the fields and returns the data used to create the confirmation token.Parametersobject
required
Promise<object>object
required
object
required
update
Merges new props and callbacks into the sub-controller.ParametersPartial<CardFieldsSubOptions>
required
destroy
Destroys the sub-controller and its elements, then frees its exclusive slot. A later create("cardFields") starts fresh.Elements
The elements this sub-controller mounts. Each has its own page:CardNumberElement
PCI-isolated hosted card number field. Card numbers never reach the host page.
CardExpiryElement
PCI-isolated hosted card expiration field.
CardCvcElement
PCI-isolated hosted card security code field.

