React Checkout Form
A glass React checkout form for card or UPI payments, with a live card preview, input formatting and an order summary.
npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/payment-checkout.jsonOrder summary
Amount due
$31.32
- Pro planBilled monthly
- $29.00
- Sales tax (8%)
- $2.32
- Total due today
- $31.32
- Payments are encrypted end to end.
- Cancel or change your plan anytime.
PaymentCheckoutdefaultPaymentCheckoutLabels
Checkout
Fill in any 16-digit card number, a name, an expiry like 12/29 and a CVC, or a UPI ID like name@bank.
Order summary
Amount due
$31.32
- Pro planBilled monthly
- $29.00
- Sales tax (8%)
- $2.32
- Total due today
- $31.32
- Payments are encrypted end to end.
- Cancel or change your plan anytime.
import { PaymentCheckout, type PaymentDetails, type PaymentMethod } from "@/components/sheenui/blocks/payment-checkout";
// Package build (after the first npm release, or a packed tarball): import { PaymentCheckout, type PaymentDetails, type PaymentMethod } from "@sheenui/theme";
// Your call; send a provider token, not the raw card (see PCI note)
async function createPayment(method: PaymentMethod, details: PaymentDetails) {
const res = await fetch("/api/payments", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ method, details }),
});
if (!res.ok) throw new Error("Payment failed");
}
export function Example() {
return (
<PaymentCheckout
currency="USD"
lines={[
{ label: "Pro plan", description: "Billed monthly", amount: 29 },
{ label: "Sales tax (8%)", amount: 2.32 },
]}
onPay={async (method, details) => {
await createPayment(method, details);
}}
/>
);
}Files to copy
12 folders · 15 files · 4 packages
- From
theme/src/ blocks/{payment-checkout.tsx, icons.tsx}components/button/components/glass-card/components/input/components/spinner/components/status-icons/components/tabs/blocks/payment-checkout/hooks/{use-direction.ts, use-latest.ts, use-magnetic.ts, use-media-query.ts, use-preferences.ts}motion/{gate.ts, light-follower.ts, tokens.ts}lib/{cn.ts, field-size.ts, form.ts, heading.ts, state-light.tsx}styles/
- shadcn CLI
npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/payment-checkout.jsonRegistry item: payment-checkout. The styles need the Tailwind v4 glass UI setup.- Packages
pnpm add @base-ui/react clsx motion tailwind-merge
Card only, in euros, with a promo code
One method hides the tabs; currency and locale format the amounts. Try the code SHEEN10: onApplyPromo resolves to a discount line, or to null to reject a code.
Team order summary
Amount due
285,60 €
- Team plan5 seats, billed yearly
- 240,00 €
- VAT (19%)
- 45,60 €
- Total due today
- 285,60 €
- Invoice by email
import { PaymentCheckout, type PaymentDetails, type PaymentMethod } from "@/components/sheenui/blocks/payment-checkout";
// Package build (after the first npm release, or a packed tarball): import { PaymentCheckout, type PaymentDetails, type PaymentMethod } from "@sheenui/theme";
// Your call; send a provider token, not the raw card
async function createPayment(method: PaymentMethod, details: PaymentDetails) {
const res = await fetch("/api/payments", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ method, details }),
});
if (!res.ok) throw new Error("Payment failed");
}
export function Example() {
return (
<PaymentCheckout
methods={["card"]}
currency="EUR"
locale="de-DE"
lines={[
{ label: "Team plan", description: "5 seats, billed yearly", amount: 240 },
{ label: "VAT (19%)", amount: 45.6 },
]}
onApplyPromo={(code) => (code.trim().toUpperCase() === "SHEEN10" ? { label: "Promo SHEEN10", amount: -24 } : null)}
assurances={[{ text: "Invoice by email" }]}
onPay={async (method, details) => {
await createPayment(method, details);
}}
/>
);
}Without the flip and the light
flipCard and stateLight are on by default. Turn them off for the plain card: the preview stays on its front and the card is never lit. The same states are still written as text.
Plain order summary
Amount due
$31.32
- Pro planBilled monthly
- $29.00
- Sales tax (8%)
- $2.32
- Total due today
- $31.32
- Payments are encrypted end to end.
- Cancel or change your plan anytime.
import { PaymentCheckout } from "@/components/sheenui/blocks/payment-checkout";
// Package build (after the first npm release, or a packed tarball): import { PaymentCheckout } from "@sheenui/theme";
export function Example() {
return (
<PaymentCheckout
flipCard={false}
stateLight={false}
labels={{ title: "Plain card details", summary: "Plain order summary", processing: "Contacting your bank" }}
onPay={() => new Promise<void>((resolve) => setTimeout(resolve, 1400))}
/>
);
}Card data and PCI DSS
The card fields are ordinary inputs, so onPay receives the raw card number, expiry and CVC. Do not post those to your own server: that puts it in PCI DSS scope (SAQ D). In production use your payment provider's hosted or tokenised fields (Stripe Elements, Adyen Drop-in, Braintree Hosted Fields) in place of the card inputs and pass only the token on, or treat this block as the layout and validation reference. The UPI method carries no card data.
Props
PaymentCheckoutLabels keys and English defaults (38)
Keyboard
Accessibility
- The flip and the state light are visual only: processing is announced through a status region, a refusal is an alert and the paid result takes focus.
- Reduced motion: the preview cross-fades instead of turning, the check is drawn at once.
- Errors are visible text linked to their field (aria-describedby); a failed check focuses the first invalid field.
- onPay failures use role="alert"; promo changes and the paid result are announced through a status region.
- The numeric fields raise the numeric keyboard and carry autocomplete hints (cc-number, cc-exp, cc-csc).
All exports on this page
PaymentCheckout— A checkout card: card or UPI details with live validation, an order summary, an optional promo code and a success state.defaultPaymentCheckoutLabels— The English PaymentCheckoutLabels used when labels is omitted; a partial labels prop is merged over it.
When to use the payment checkout form
- Use PaymentCheckout as a credit card form with a live card preview in the payment step of a purchase flow, where one side collects card or UPI details and the other shows an order summary with a total.
- Use it for a subscription upgrade screen, passing lines like a Pro plan billed monthly and an onApplyPromo callback that returns a negative discount line for a valid code.
- Use it for storefronts that serve India, since methods can be ["card", "upi"] or just ["upi"], and currency and locale control how every amount is formatted.
- Skip it when you need to collect raw card data on your own servers; use your payment provider's hosted or tokenized fields and treat this block as a layout and validation reference.
- Pair it with an Input for any billing address fields you add around it, and a Button-based confirmation page after the success panel. It already uses Tabs for method switching.
Frequently asked questions
Related pages
20 blocks pages in all: browse them on All blocks.
By Lokendra Singh Rathore (GitHub, opens in a new tab). Published , updated .