Nasaq
Components

Cash Collect

A cash-on-delivery panel - order total plus delivery fee minus prepaid, the amount received, and live short, exact or change-due feedback, with quick amounts and confirm.

PreviewOpen ↗

Code

<CashCollect orderTotalMinor={8500} deliveryFeeMinor={1500} onConfirm={(minor) => save(minor)} />

Delivery · beta

Live examples and controls: Cash Collect in the lab.

Install

npx shadcn@latest add https://docs.nasaqui.com/r/cash-collect.json

What the courier must take at the door and what to hand back. Amounts are integer minor units (cents, halalas).

When to use

  • Confirming cash at drop-off.

When not to use

  • Card or wallet payment: use Price and your payment flow.
  • Settling a courier at day end: use Wallet or the ledger.

Import

import { CashCollect, cashBreakdown } from "@fadymondy/nasaq/web";
// inside this monorepo: "@nasaq/web"

Quick start

<CashCollect orderTotalMinor={8500} deliveryFeeMinor={1500} onConfirm={(minor) => save(minor)} />

Anatomy

CashCollect  data-slot="cash-collect"  data-state
├─ breakdown: total, fee, prepaid, due
├─ CurrencyInput + quick amounts
├─ state line: short / exact / change
└─ Confirm

API

PropTypeDefaultDescription
orderTotalMinornumberrequiredGoods total.
deliveryFeeMinornumber0Added to the total.
prepaidMinornumber0Already paid; subtracted.
currencystring"USD" ("SAR" in Arabic)ISO currency.
collectedMinor / defaultCollectedMinornumber | nullnoneControlled or initial received amount.
onCollectedChange(minor) => voidnoneInput change.
onConfirm(minor) => voidnoneConfirm tapped.
allowShortbooleanfalseAllow confirming less than due.
quickAmountsnumber[]derivedQuick-pick buttons, minor units.
loadingbooleanfalseDisables confirm.
locale / labels"en" | "ar" / partial stringscontextLanguage and overrides.

cashBreakdown({ orderTotal, deliveryFee, prepaid, collected }) returns { due, collected, shortBy, change, state } where state is unpaid, short, exact or over.

Examples

Lab stories: short, short allowed, change due, partly or fully prepaid, Arabic.

Accessibility

The state line is a polite live region. The input is labelled; confirm is disabled while short unless allowShort.

RTL & i18n

The amount field stays LTR inside RTL pages so digits do not reorder. Arabic copy is built in.

Styling & tokens

Uses --status-success, --status-warning, --status-danger. Target [data-state].

Do / Don't

  • Do work in minor units end to end.
  • Don't round change; show it exactly.

CurrencyInput, Wallet, RouteStops.

Lab

https://docs.nasaqui.com/?path=/docs/components-delivery-cash-collect--docs

On this page