Skip to Content
@get-asset/reactComponents

Receipt Rule Editor

Styled drop-in form to make or change one of a business's receipt rules — never ask, ask every time, or ask over an amount.

Make or change one of a business's receipt rules: the ledger it names, whether to never ask, ask every time or ask over an amount, and the reason shown on the request.

Built on the headless ReceiptRuleEditor compound from @get-asset/sdk.

Preview

Loading preview…

Usage

import { AssetReceiptRuleEditor } from "@get-asset/react";
import "@get-asset/react/styles.css";

<AssetReceiptRuleEditor ruleId={ruleId}
  onSaved={() => backToList()}
  onCancel={() => backToList()}
/>

Required scopes

The access token used by AssetProvider must include these scopes for this component to fetch data successfully:

  • business:read
  • business:update
  • ledger:read

API reference

Root props

PropTypeRequiredDefaultDescription
classNamestringNo
ruleIdstringNoThe rule to edit. Omit to make a new one. "default" is the business's default rule, made on save if the business has none yet.
ruleBusinessReceiptRulePublicNoOverride the fetched rule for testing/storybook. Skips the API call.
ledgersLedgerPublic[]NoOverride the ledgers to choose from for testing/storybook. Skips the API call.
previewReceiptRuleEditorPreviewNoOverride the preview and disable its request for testing/storybook.
currencystringNoISO-4217 code amounts are in. Resolved from the business's country when omitted.
formatAmount(value: number) => stringNoAmount formatting in preview rows. Defaults to currency, in US English.
formatDate(value: string) => stringNoDate formatting in preview rows. Defaults to "Jan 31, 2026".
state"loading" | "error"NoForce a specific state for testing/storybook.
saveErrorErrorNoForce the save-error state for testing/storybook.
onSaved(rule: BusinessReceiptRulePublic | null) => voidNoCalled with the saved rule once the write goes through; with null when the default rule was set back to the system's defaults.
onCancel() => voidNoThe host closes the form without saving.

On this page