Skip to content
English
Invoice comes with Pro. Its preview shows once you unlock it.

Usage

import { ShopInvoice } from './ShopInvoice.jsx'

// Without onPay or onDownload, both finish after a short wait.
<ShopInvoice
  locale="en"
  currency="USD"
  invoice={invoice}  // { number, order, status: 'paid' | 'due' | 'overdue', issued, due, taxRate, delivery, card, link, note, from: { name, tagline, lines, logo: '/logo.svg' }, to }
  items={lines}      // [{ id, name, variant, price, qty }]
  loading={!invoice}
  error={loadError}
  onRetry={reload}
  onPay={async (amount) => (await api.payInvoice(invoice.number)).ok}
  onDownload={() => api.downloadPdf(invoice.number)}
/>

Props

PropTypeDefaultWhat it does
locale'en' | 'zh-CN' | 'es' | 'ja''en'Language of the built-in text and the sample invoice.
invoice{ number, order, status, lateDays?, issued, due, taxRate, delivery, card, link, note, from: { name, tagline, lines, logo?: string | ReactNode }, to: { name, lines } }sample invoiceThe invoice. Tax is charged on the lines and the delivery at taxRate (0.08 for 8%). `from.logo` is the shop’s mark, a picture’s address or your own element; without it the initials of `from.name` stand in its place.
itemsArray<{ id, name, variant, price, qty }>sample linesThe lines of the invoice.
status'paid' | 'due' | 'overdue'invoice.statusThe status shown first; paying turns it to paid.
link / currencystring / stringinvoice.link / by localeThe address the copy button copies; the ISO currency code.
loading / errorboolean / boolean | stringfalseShows the skeleton, or the error banner with a retry button (a string replaces its sentence).
onPay / onDownload / onRetry(total) => Promise<boolean | void> / () => Promise<boolean | void> / () => void—Pays the invoice (resolve false to show the payment error); downloads the PDF; reloads after an error.
labelsobject—Replaces any built-in text (keys as in copy.js).
classNamestring—Added to the root section.

Add it to your project

Pro includes the full source of this block. Copy its prompt to install it with your coding agent.

ShopInvoice.jsxshop-invoice.csscopy.jskit.jsxkit.cssui/base-button/ui/copy-button/ui/rolling-number/ui/status-tag/ui/alert-banner/ui/success-check/ui/skeleton-shimmer/tokens.cssREADME.md

The block, its stylesheet and text, the shared kit, the components it uses and tokens.css install together into one folder.