Payment
Collect or update a customer payment method so a charge can be taken.
Payment details
Encrypted and processed securely.
Example result — your output may vary with your context and the prompt you pass.
# Payment: Card Form
## Context
Flexnative UI intent — a reference solution from the shadcn/ui registry (@flx). The intent frames the problem; the decision is one approach to it.
## Problem
Collect or update a customer payment method so a charge can be taken.
## Decision
- Best for: The default for taking a card the first time. A direct form with number, expiry, and CVC keeps the flow on your page and works for any card brand or region.
- Trade-off: Typing full card details is the highest-friction option and puts compliance on you, so pair it with a trusted processor and clear security cues.
## Registry Item
@flx/payment-1
## Stack
- UI: shadcn/ui
- Styling: Tailwind CSS
- shadcn components: Button, Card, Input, Input Group, Label
- npm: lucide-react
## Registry Source
https://ui.flexnative.com/r/payment-1.json
## Preview
https://ui.flexnative.com/intents/payment#1
## Reference Implementation
```tsx
'use client'
import { useState } from 'react'
import { CreditCard, Lock } from 'lucide-react'
import { Button } from '@/components/ui/button'
import {
Card,
CardContent,
CardFooter,
CardHeader,
CardTitle,
} from '@/components/ui/card'
import { Input } from '@/components/ui/input'
import {
InputGroup,
InputGroupAddon,
InputGroupInput,
} from '@/components/ui/input-group'
import { Label } from '@/components/ui/label'
export function Payment1() {
const [number, setNumber] = useState('')
const formatNumber = (raw: string) =>
raw
.replace(/\D/g, '')
.slice(0, 16)
.replace(/(.{4})/g, '$1 ')
.trim()
return (
<Card>
<CardHeader>
<CardTitle>Payment details</CardTitle>
</CardHeader>
<CardContent className="flex flex-col gap-4">
<div className="flex flex-col gap-2">
<Label htmlFor="cf-name">Name on card</Label>
<Input
id="cf-name"
placeholder="Ada Lovelace"
autoComplete="cc-name"
/>
</div>
<div className="flex flex-col gap-2">
<Label htmlFor="cf-number">Card number</Label>
<InputGroup>
<InputGroupAddon>
<CreditCard />
</InputGroupAddon>
<InputGroupInput
id="cf-number"
inputMode="numeric"
placeholder="4242 4242 4242 4242"
value={number}
onChange={(e) => setNumber(formatNumber(e.target.value))}
/>
</InputGroup>
</div>
<div className="flex gap-3">
<div className="flex flex-1 flex-col gap-2">
<Label htmlFor="cf-exp">Expiry</Label>
<Input id="cf-exp" placeholder="MM / YY" inputMode="numeric" />
</div>
<div className="flex flex-1 flex-col gap-2">
<Label htmlFor="cf-cvc">CVC</Label>
<Input id="cf-cvc" placeholder="123" inputMode="numeric" />
</div>
</div>
</CardContent>
<CardFooter className="flex flex-col gap-3">
<Button className="w-full">Save card</Button>
<p className="text-muted-foreground flex items-center gap-1.5 text-xs">
<Lock className="size-3" />
Encrypted and processed securely.
</p>
</CardFooter>
</Card>
)
}
```Paste into your AI tool and adapt it to your context.
Other ways
Reach for these when the context shifts. Each is copyable too.
Payment methods
Visa ending in 4242Expires 08 / 27
DefaultMastercard ending in 8210Expires 11 / 26
Amex ending in 0005Expires 03 / 28
Saved Methods
Checkout
or pay with card
Express Wallets