Payment ProcessingPayment Method Selector
Payment Method Selector
Interactive selector for Cards, Digital Wallets, UPI (India), and BNPL services with inline forms and smooth motion.
Preview
Payment Methods
Cards
Visa, Mastercard, etc.
Digital Wallets
Apple Pay, Cash App, etc.
UPI
Unified Payments Interface (India)
BNPL Services
Klarna, Affirm, and similar options
"use client"
import { PaymentMethodSelector } from "@/components/billingsdk/payment-method-selector"
export function PaymentMethodSelectorDemo() {
return (
<div className="w-full max-w-md mx-auto min-h-[600px] flex items-center justify-center">
<PaymentMethodSelector
onProceed={(method, data) => {
console.log("Demo: Proceed with:", method, data)
}}
/>
</div>
)
}
Installation
npx shadcn@latest add @billingsdk/payment-method-selector
pnpm dlx shadcn@latest add @billingsdk/payment-method-selector
npx shadcn@latest add @billingsdk/payment-method-selector
npx @billingsdk/cli add payment-method-selector
pnpm dlx @billingsdk/cli add payment-method-selector
npx @billingsdk/cli add payment-method-selector
Usage
import { PaymentMethodSelector } from "@/components/billingsdk/payment-method-selector"
<PaymentMethodSelector
onProceed={(method, data) => {
console.log("Selected method:", method)
console.log("Form data:", data)
}}
/>
Props
Prop | Type | Description |
---|---|---|
onProceed | (method: PaymentMethod, data: FormData) => void | Fired on “Proceed with Payment”. Receives selected method and collected form data. |
className | string | Optional class names for the root container. |
Types
type PaymentMethod = "cards" | "digital-wallets" | "upi" | "bnpl-services"
type FormData = {
// Cards
cardNumber?: string
expiryDate?: string
cvv?: string
cardholderName?: string
// Wallets
email?: string
phone?: string
// UPI
upiId?: string
// BNPL
income?: string
}
Payment Methods
- Cards
- Form: card number, expiry, CVV, name
- Notes: secure card payments with fraud protection
- Digital Wallets (Apple Pay, Google Pay, Cash App, Venmo)
- Form: email, phone
- Notes: quick checkout, biometric auth
- UPI (India) (PhonePe, Google Pay, Paytm, BHIM)
- Form: UPI ID
- Notes: real‑time bank transfers
- BNPL Services (Klarna, Affirm, Afterpay, Sezzle)
- Form: email, phone, income (optional)
- Notes: split payments, flexible terms
Theming
Styled with shadcn/ui
. Customize via CSS variables or switch themes in the preview header. See Theming.
Example
"use client"
import { PaymentMethodSelector } from "@/components/billingsdk/payment-method-selector"
export function PaymentMethodSelectorDemo() {
return (
<div className="w-full max-w-md mx-auto min-h-[600px] flex items-center justify-center">
<PaymentMethodSelector
onProceed={(method, data) => {
console.log("Demo: Proceed with:", method, data)
}}
/>
</div>
)
}
Credits
- Created by @rajoninternet
Payment Success Dialog
A confirmation dialog that celebrates a successful payment with the paid amount and product name, plus actions to proceed or go back.
Payment Method Manager
The Payment Method Manager component provides a PCI-compliant UI for managing billing payment methods. Uses redirect-to-gateway approach for secure add/edit operations with no direct handling of sensitive data.