---
id: WF-ACC-TRX-003
title: Issue or void a credit or debit memo
trigger: >-
  Staff or coordinated financial commands create billing adjustments, and staff
  may later cancel an adjustment.
product_area: accounting
module: transactions
revision: 1
status: draft
design_intent: proposed
implementation_evidence: observed
inference: []
source_sha:
  services-accounting: f47cb263875bbc0c5640fba7dae6785ec32695f8
  react-console: baf6dae382d6f41dce976c7f848667ccc37e076f
implements:
  - CAP-ACC-TRX-003
  - CAP-ACC-TRX-008
moves:
  - STATE-ACC-TRX-002
  - STATE-ACC-TRX-001
  - STATE-ACC-TRX-006
crosses:
  - SVC-ACC-TRX-transactions
hops:
  - 'n': 1
    actor_or_service: Memo commands
    action: >-
      Validate a real issued invoice and its selected lines, then choose
      eligible accounting date and batch.
    anchor: >-
      services-accounting:modules/transactions/services/change-memos/memo-commands.ts:createCreditMemo
    seam: sync
    on_failure: Reject the command and undo its transaction.
    left_inconsistent: The complete transaction is undone.
    observer: The API response reports the outcome and applicable refusal code.
    provenance: observed
    source: >-
      services-accounting:modules/transactions/services/change-memos/memo-commands.ts:createCreditMemo;
      services-accounting:modules/transactions/tests/integration/services/change-memos/credit-memos.integration.spec.js#it
      refuses no batch in a unit without batch assignment settings 409
      batch_required
  - 'n': 2
    actor_or_service: Freeing paid money
    action: >-
      Release only the receipt allocations needed to cover a reduction beyond
      outstanding debt, starting with the newest allocation entries.
    anchor: >-
      services-accounting:modules/transactions/services/payments/free-paid-money.ts:freePaidMoneyForMemo
    seam: sync
    on_failure: Undo the adjustment transaction together with the release.
    left_inconsistent: The complete transaction is undone.
    observer: The API response reports the outcome and applicable refusal code.
    provenance: observed
    source: >-
      services-accounting:modules/transactions/services/payments/free-paid-money.ts:freePaidMoneyForMemo
  - 'n': 3
    actor_or_service: Memo ledger trigger
    action: >-
      Insert the adjustment lines together so ordered database maintenance
      checks ownership and bounds while tax is adjusted.
    anchor: >-
      services-accounting:modules/transactions/services/change-memos/memo-commands.ts:createCreditMemo
    seam: sync
    on_failure: >-
      The financial bound rejects an excessive credit and rolls back its
      effects.
    left_inconsistent: The complete transaction is undone.
    observer: The API response reports the outcome and applicable refusal code.
    provenance: observed
    source: >-
      services-accounting:modules/transactions/services/change-memos/memo-commands.ts:createCreditMemo;
      services-accounting:modules/transactions/tests/integration/services/change-memos/credit-memos.integration.spec.js#it
      writes nothing: no memo, no ledger line, no fact, no event
  - 'n': 4
    actor_or_service: Memo commands
    action: >-
      Assign the adjustment number and record financial facts and history; added
      charges use debit-bearing invoice lines.
    anchor: >-
      services-accounting:modules/transactions/services/change-memos/memo-commands.ts:createDebitMemo
    seam: sync
    on_failure: Undo all work in the transaction.
    left_inconsistent: The complete transaction is undone.
    observer: The API response reports the outcome and applicable refusal code.
    provenance: observed
    source: >-
      services-accounting:modules/transactions/services/change-memos/memo-commands.ts:createDebitMemo;
      services-accounting:modules/transactions/tests/integration/services/change-memos/debit-memos.integration.spec.js#it
      raises the header’s balance by the memo, its totals its own
  - 'n': 5
    actor_or_service: Memo void
    action: >-
      Cancel an eligible memo by dated opposite lines, requiring a reason and
      sufficient remaining value for debit cancellation.
    anchor: >-
      services-accounting:modules/transactions/services/change-memos/memo-commands.ts:voidCreditMemo
    seam: sync
    on_failure: Reject the command and undo its transaction.
    left_inconsistent: The complete transaction is undone.
    observer: The API response reports the outcome and applicable refusal code.
    provenance: observed
    source: >-
      services-accounting:modules/transactions/services/change-memos/memo-commands.ts:voidCreditMemo;
      services-accounting:modules/transactions/tests/integration/services/change-memos/debit-memos.integration.spec.js#it
      is refused 400 over_application
idempotency: >-
  Direct commands use their request keys; coordinated cancellation and return
  steps derive their keys from the parent operation.
concurrency: 'Ordered invoice, line and receipt locks serialize adjustments with collection.'
branches:
  - >-
    Cancelling a credit memo restores debt without restoring the receipt
    allocations that the memo freed.
waits: []
evidence:
  - >-
    services-accounting at f47cb263: services/change-memos/memo-commands.ts;
    services/payments/free-paid-money.ts;
    docs/architecture/accounting-2.0/02-decisions.md A-5, M1-5, T-6.
controls: [TC-IAM-001, TC-IAM-002, TC-IAM-004, TC-IAM-005, TC-AZ-001, TC-AZ-002, TC-AZ-003, TC-AZ-004, TC-AZ-006, TC-TEN-001, TC-TEN-002, TC-TEN-003, TC-DAT-001, TC-DAT-002, TC-DAT-003, TC-LOG-002, TC-LOG-003, TC-LOG-004, TC-LOG-005, TC-PI-001, TC-PI-002, TC-PI-003, TC-PI-005, TC-PRV-001, TC-PRV-002]
---
# Issue or void a credit or debit memo

## What It Does

Memo issue applies a separately numbered adjustment to existing billing. Paid receipt money released by a reduction remains on its source receipt.

## The Flow

```mermaid
flowchart TD
  h0["Memo commands"]
  h1["Freeing paid money"]
  h0 --> h1
  h2["Memo ledger trigger"]
  h1 --> h2
  h3["Memo commands"]
  h2 --> h3
  h4["Memo void"]
  h3 --> h4
```

The numbered hops identify the participating services, synchronization boundary and evidence. Branch conditions in the frontmatter explain where preparation, completion and recovery diverge.

## When Something Fails

Each hop records its rollback, retry or compensation boundary and the result visible to callers or operators. External outcomes can remain unresolved after local preparation commits; the listed recovery behavior defines what remains pending.

## Open Design Questions

The unresolved matters are recorded in the module findings; this workflow does not establish additional product approval.
