Subscription payment card
paddle/subscription-payment-cardFreeComponent
Payment method and next billing summary card. Auto-resolves payment method display labels from Paddle type/brand/last4 fields. Shows next payment amount, date, and portal link to update payment details.
Install it
npx shadcn@latest add https://developer.paddle.com/r/subscription-payment-card.jsonSource
1"use client"23import * as React from "react"4import { CreditCard, Calendar, ExternalLink } from "lucide-react"5import { Card, CardContent, CardHeader, CardTitle } from "@/registry/new-york/ui/card"6import { Skeleton } from "@/registry/new-york/ui/skeleton"7import { Separator } from "@/registry/new-york/ui/separator"8import { cn } from "@/lib/utils"9import type {10 NextPaymentData,11 PaymentMethodData,12} from "@/registry/new-york/blocks/paddle-helpers/lib/paddle-types"13import { getPaymentMethodDisplay } from "@/registry/new-york/blocks/paddle-helpers/lib/paddle-payment-method-display"14import { getPaymentMethodIcon } from "@/registry/new-york/blocks/paddle-helpers/lib/payment-method-icons"15import {16 formatMoney,17 formatDate,18} from "@/registry/new-york/blocks/paddle-helpers/lib/paddle-format"1920export type SubscriptionPaymentCardProps = {21 /**22 * Next payment details. Absent when subscription is paused or canceled.23 *24 * Pass `undefined` for all three data props (`nextPayment`, `paymentMethod`,25 * `updatePaymentMethodUrl`) to render the skeleton loading state.26 */27 nextPayment?: NextPaymentData28 /**29 * Payment method details. Pass raw fields from `transaction.payments[0].method_details`30 * — the component resolves the display label automatically.31 * Absent when not available from transaction history.32 */33 paymentMethod?: PaymentMethodData34 /** Portal deep link to update payment method. Absent for manual collection. */35 updatePaymentMethodUrl?: string36 className?: string37}3839export function SubscriptionPaymentCard({40 nextPayment,41 paymentMethod,42 updatePaymentMethodUrl,43 className,44}: SubscriptionPaymentCardProps) {45 const isLoading =46 nextPayment === undefined && paymentMethod === undefined && updatePaymentMethodUrl === undefined4748 if (isLoading) {49 return <SubscriptionPaymentCardSkeleton className={className} />50 }5152 const displayLabel = paymentMethod53 ? (paymentMethod.label ??54 getPaymentMethodDisplay(paymentMethod.type, paymentMethod.cardBrand, paymentMethod.last4))55 : undefined5657 const PaymentMethodIcon = paymentMethod58 ? (getPaymentMethodIcon(paymentMethod.type, paymentMethod.cardBrand) ?? CreditCard)59 : CreditCard6061 const expiryLabel =62 paymentMethod?.expiryMonth !== undefined && paymentMethod?.expiryYear !== undefined63 ? `Expires ${String(paymentMethod.expiryMonth).padStart(2, "0")}/${String(paymentMethod.expiryYear).slice(-2)}`64 : undefined6566 return (67// … truncated
What it pulls in
npm packages
Other registry items
Files it writes
More from paddle
All 14 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Billing interval togglebilling-interval-toggle | paddle | Components | Free | no deps | |
| Checkout summarycheckout-summary | paddle | Components | Free | no deps · 3 files | |
| Plan change breakdownplan-change-breakdown | paddle | Components | Free | 1 dep · 3 files | |
| Plan change previewplan-change-preview | paddle | Components | Free | 1 dep · 3 files | |
| Pricing cardspricing-cards | paddle | Components | Free | 1 dep · 2 files | |
| Pricing select cardspricing-select-cards | paddle | Components | Free | 1 dep · 4 files | |
| Subscription alertsubscription-alert | paddle | Components | Free | 1 dep · 3 files | |
| Subscription status cardsubscription-status-card | paddle | Components | Free | 1 dep · 3 files |
