For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
RegisterLoginSandbox Login
GuidesRecipesAPI Reference
GuidesRecipesAPI Reference
  • Getting Started
    • Getting Started with Checkout
    • Account Setup
    • Card Checkout with Credits
    • Card Checkout
    • Direct USDC Settlement
    • Fiat/Crypto Pay-ins
    • Secure Marketplace Checkout
    • EVM Checkout
    • How to Enable Checkout with Credit Cards
    • Quick Start Marketplace Implementation
    • Payouts
    • Common FAQs
  • Checkout
    • Settlement Locations
  • Payouts
    • Payout Overview
    • What is a Payout
  • Subscriptions
    • Subscriptions Overview
  • Marketplaces
    • Marketplace Overview
    • How Marketplaces Work
    • How to Withdraw USDC
    • Countries Eligible for USDC Withdraw
    • Marketplaces Webhooks
    • Marketplaces Implementation
  • Developer Resources
    • Custom Branding
    • Checkout Implementation
      • ACH Implementation
      • USDC Implementation
      • Wallets
      • SEPA/UK Pay-in
      • Developer React Environment Properties
      • Credit Cards Implementation
        • Card Form Components
        • Tokenize Credit Cards
    • Webhooks
  • Merchant Dashboard
    • Login & Account Access
    • Users and Roles
    • Rate Limits
    • Developer Contact
LogoLogo
RegisterLoginSandbox Login
On this page
  • When to Use Card Form Components
  • Available Components
  • Installation
  • Tokenizing a New Card
  • Refreshing a Saved Card Token (CVV Only)
  • Tokenizing Card Number Only (No CVV)
  • tokenize() Response
  • Theming
  • Responsive Layout
  • Component Props Reference
  • CoinflowCardForm / CoinflowCardNumberForm
  • CoinflowCvvForm
  • Token Expiration
  • Migrating from Legacy Card Inputs
Developer ResourcesCheckout ImplementationCredit Cards Implementation

Card Form Components

Was this page helpful?
Previous

Implement Credit Card Checkout

Developers can use this documentation to tokenize credit cards when using our card checkout APIs.
Next
Built with

Coinflow’s Card Form components provide a streamlined, PCI-compliant way to collect credit card information directly in your application. Instead of managing separate card number, CVV, and expiration inputs, these components bundle everything into a single embeddable form with one tokenize() method.

When to Use Card Form Components

Use these components when you want to:

  • Collect card details for a new card checkout without building your own form layout
  • Tokenize a card number with expiration for use with the Card Checkout API
  • Re-collect a CVV only for a saved card before calling the Saved Card Checkout API
  • Apply custom theming (fonts, colors, placeholders) to match your brand

Available Components

ComponentDescription
CoinflowCardFormFull card input — card number, expiration date, and CVV. Renders in a single row on wide containers and automatically reflows to two rows when space is constrained
CoinflowCardNumberFormCard number and expiration date only (no CVV)
CoinflowCvvFormCVV-only input for re-tokenizing a saved card

All three components expose a tokenize() method via a ref that returns a token you can pass to the Coinflow checkout APIs.

Installation

$npm install @coinflowlabs/react

Tokenizing a New Card

Use CoinflowCardForm to collect the full card details (number, expiration, CVV) and tokenize them in a single call.

1import {useRef} from 'react';
2import {
3 CoinflowCardForm,
4 CardFormRef,
5 CoinflowEnvs,
6} from '@coinflowlabs/react';
7
8function NewCardCheckout() {
9 const cardFormRef = useRef<CardFormRef>(null);
10
11 const handleTokenize = async () => {
12 try {
13 const result = await cardFormRef.current?.tokenize();
14 if (!result) return;
15
16 console.log('Token:', result.token);
17 console.log('Exp Month:', result.expMonth);
18 console.log('Exp Year:', result.expYear);
19
20 // Pass result.token, result.expMonth, result.expYear
21 // to the Card Checkout API endpoint
22 } catch (err) {
23 console.error('Tokenization failed:', err);
24 }
25 };
26
27 return (
28 <div>
29 <CoinflowCardForm
30 ref={cardFormRef}
31 merchantId="your-merchant-id"
32 env="sandbox"
33 />
34 <button onClick={handleTokenize}>Pay</button>
35 </div>
36 );
37}

Refreshing a Saved Card Token (CVV Only)

When a customer pays with a saved card, you need to re-collect the CVV and refresh the token. Use CoinflowCvvForm with the saved card’s token from the Get Customer endpoint.

1import {useRef} from 'react';
2import {CoinflowCvvForm, CardFormRef} from '@coinflowlabs/react';
3
4function SavedCardCheckout({savedCardToken}: {savedCardToken: string}) {
5 const cvvFormRef = useRef<CardFormRef>(null);
6
7 const handleTokenize = async () => {
8 try {
9 const result = await cvvFormRef.current?.tokenize();
10 if (!result) return;
11
12 // Pass result.token to the Saved Card Checkout API endpoint
13 console.log('Refreshed token:', result.token);
14 } catch (err) {
15 console.error('CVV tokenization failed:', err);
16 }
17 };
18
19 return (
20 <div>
21 <CoinflowCvvForm
22 ref={cvvFormRef}
23 merchantId="your-merchant-id"
24 env="sandbox"
25 token={savedCardToken}
26 />
27 <button onClick={handleTokenize}>Pay with Saved Card</button>
28 </div>
29 );
30}

In Vue, the CoinflowCardForm component accepts a variant prop to switch between 'card-form', 'card-number-form', and 'cvv-form' modes.

Tokenizing Card Number Only (No CVV)

Use CoinflowCardNumberForm when you only need to collect the card number and expiration — for example, when saving a card for future use without an immediate charge.

1import {useRef} from 'react';
2import {CoinflowCardNumberForm, CardFormRef} from '@coinflowlabs/react';
3
4function SaveCardForLater() {
5 const cardNumberRef = useRef<CardFormRef>(null);
6
7 const handleTokenize = async () => {
8 const result = await cardNumberRef.current?.tokenize();
9 if (!result) return;
10
11 // Store result.token, result.expMonth, result.expYear for later use
12 console.log('Token:', result.token);
13 };
14
15 return (
16 <div>
17 <CoinflowCardNumberForm
18 ref={cardNumberRef}
19 merchantId="your-merchant-id"
20 env="sandbox"
21 />
22 <button onClick={handleTokenize}>Save Card</button>
23 </div>
24 );
25}

tokenize() Response

The tokenize() method returns a CardFormTokenResponse:

FieldTypeDescription
tokenstringThe PCI-compliant card token to pass to checkout APIs
expMonthstring (optional)Two-digit expiration month (e.g., "05") — returned by CoinflowCardForm and CoinflowCardNumberForm
expYearstring (optional)Two-digit expiration year (e.g., "30") — returned by CoinflowCardForm and CoinflowCardNumberForm

CoinflowCvvForm only returns token since expiration details are already stored with the saved card.

Theming

All card form components accept a theme prop to customize the look and feel. Theme values are passed as a MerchantTheme object.

PropertyTypeDescription
fontstringFont family name — any Google Font is supported (e.g., "Inter", "Red Hat Display")
fontSizestringFont size for input text (e.g., "12px", "14px")
backgroundstringBackground color for input fields (e.g., "#ffffff", "#1a1a1a")
textColorstringInput text color
styleMerchantStyleBorder radius style — MerchantStyle.Rounded, MerchantStyle.Pill, or MerchantStyle.Sharp
showCardIconbooleanShow the detected card brand icon (Visa, Mastercard, etc.) to the left of the card number input
cardNumberPlaceholderstringPlaceholder for the card number field
cvvPlaceholderstringPlaceholder for the CVV field
expirationPlaceholderstringPlaceholder for month/year fields (format: "MM / YY")
1<CoinflowCardForm
2 ref={cardFormRef}
3 merchantId="your-merchant-id"
4 env="sandbox"
5 theme={{
6 font: 'Inter',
7 fontSize: '14px',
8 background: '#ffffff',
9 textColor: '#111827',
10 style: MerchantStyle.Rounded,
11 showCardIcon: true,
12 cardNumberPlaceholder: 'Card number',
13 cvvPlaceholder: 'CVV',
14 expirationPlaceholder: 'MM / YY',
15 }}
16/>

The theme values shown above are examples for illustration. Configure your branding in the Merchant Dashboard or contact the Coinflow integrations team to set these values for your account.

Responsive Layout

CoinflowCardForm automatically adapts its layout to the width of the container you place it in — no configuration is required.

  • Wide containers — the card number, expiration, and CVV render together on a single row.
  • Narrow containers — when there isn’t enough horizontal space for all three fields, the form reflows to two rows: the card number on the first row, with the expiration and CVV on the second.

This is especially useful in mobile checkout UIs, where a single-row layout can clip the card number in narrow viewports. The form measures its own container and switches layouts on the fly, including when the viewport is resized or rotated.

Because the form’s height changes when it reflows, the embedded iframe reports its content height back to the SDK, which resizes the iframe automatically so the fields are never clipped.

To let the form size itself correctly, place it in a container whose width you control and whose height is allowed to grow. Avoid setting a fixed height on the component or its wrapping element — doing so prevents the form from expanding to its two-row layout.

Responsive reflow and automatic height adjustment are built in to CoinflowCardForm. To pick up this behavior, update to the latest version of your SDK (@coinflowlabs/react, @coinflowlabs/vue, @coinflowlabs/angular, or @coinflowlabs/react-native). No code changes are needed.

Component Props Reference

CoinflowCardForm / CoinflowCardNumberForm

PropTypeRequiredDescription
merchantIdstringYesYour Coinflow merchant ID
envCoinflowEnvsNo"sandbox" or "prod" (defaults to "prod")
themeMerchantThemeNoCustom theming options
onLoad() => voidNoCallback when the form iframe has loaded

CoinflowCvvForm

PropTypeRequiredDescription
merchantIdstringYesYour Coinflow merchant ID
envCoinflowEnvsNo"sandbox" or "prod" (defaults to "prod")
themeMerchantThemeNoCustom theming options
tokenstringYesThe saved card token from Get Customer
onLoad() => voidNoCallback when the form iframe has loaded

Token Expiration

Tokens expire if not used within 7 days of creation. Once used, a token is valid for 5 minutes in production. In the sandbox environment, tokens remain valid indefinitely. If a token expires, call tokenize() again to generate a new one.

Migrating from Legacy Card Inputs

If you are currently using CoinflowCardNumberInput and CoinflowCvvInput, the new Card Form components simplify your integration:

LegacyNew
CoinflowCardNumberInput + CoinflowCvvInput + manual expiration inputCoinflowCardForm (all-in-one)
CoinflowCardNumberInput + manual expiration inputCoinflowCardNumberForm
CoinflowCvvOnlyInputCoinflowCvvForm
ref.current.getToken()ref.current.tokenize()
CSS string-based styling (css prop)Object-based theming (theme prop)

The legacy components continue to work but are deprecated. New integrations should use the Card Form components.