cardToken to pass to your server for payment processing.
This element is the standard way to collect card details in a Headless Checkout flow.
Usage
validate() then submit():
Options
styles CardStyles
Optional. Customize the appearance of the card input fields.
CardStyles reference
CardElementStyle reference
Each field style (cardNumber, cardExpiration, cardVerification) accepts:
CardElementStyleVariant supports these CSS properties:
Methods
validate() → Promise<boolean>
Returns true if all card fields contain valid input. Use this before submitting to surface validation errors to the buyer.
submit() → Promise<{ cardToken: string }>
Tokenizes the card and returns a cardToken. Pass this token to your server to complete the payment - never send raw card data from your frontend.
destroy()
Removes the iframe and cleans up all event listeners. Call this when navigating away or unmounting a component.
Full example
React
Related
Checkout Widget
Embed a complete buy-now checkout button and modal
Server SDK - Checkout
Build headless checkout flows server-side