Billing SDK/Billing SDK
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

src/components/payment-method-selector-demo.tsx
"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

PropTypeDescription
onProceed(method: PaymentMethod, data: FormData) => voidFired on “Proceed with Payment”. Receives selected method and collected form data.
classNamestringOptional 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

src/components/payment-method-selector-demo.tsx
"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