---
id: JNY-ACC-TRX-006
title: 'Bill, collect and unwind an order through service calls'
feature: FEAT-ACC-TRX-06
product_area: accounting
module: transactions
revision: 1
status: draft
product_intent: proposed
implementation_evidence: observed
supersedes:
  - ACT-ACC-0800
  - ACT-ACC-0801
  - ACT-ACC-0802
  - ACT-ACC-0807
source_sha:
  react-console: baf6dae382d6f41dce976c7f848667ccc37e076f
  services-accounting: f47cb263875bbc0c5640fba7dae6785ec32695f8
actor: ACT-ACC-021
goal: 'Use attributed repeat-safe service work to bill, tender and later cancel an order with its fee treatment.'
capabilities:
  - CAP-ACC-TRX-020
  - CAP-ACC-TRX-001
  - CAP-ACC-TRX-009
  - CAP-ACC-TRX-014
screens: []
steps:
  - 'n': 1
    surface: accounting_billing_service (createInvoiceDraft with issue)
    action: Commerce invokes its billing function for the placed purchase.
    capability: CAP-ACC-TRX-001
    expected: One issued invoice retains the order context and service actor.
    provenance: test
    source: >-
      react-console:acceptance/accounting/playwright/journeys/cross-application/ACT-ACC-0800.spec.ts#ACT-ACC-0800
  - 'n': 2
    surface: accounting_tender_service (settle)
    action: Commerce invokes tender for the order’s card payment.
    capability: CAP-ACC-TRX-009
    expected: One receipt settles the bill and the order-line position reflects collected value.
    provenance: test
    source: >-
      react-console:acceptance/accounting/playwright/journeys/cross-application/ACT-ACC-0801.spec.ts#ACT-ACC-0801
  - 'n': 3
    surface: accounting_tender_service (settle)
    action: Repeat an interrupted tender using its original command identity.
    capability: CAP-ACC-TRX-020
    expected: The earlier result or a refusal prevents another capture.
    provenance: test
    source: >-
      react-console:acceptance/accounting/playwright/journeys/cross-application/ACT-ACC-0807.spec.ts#ACT-ACC-0807
  - 'n': 4
    surface: accounting_reversals_service (reverseBilling)
    action: Invoke billing cancellation with fee and refund treatment.
    capability: CAP-ACC-TRX-014
    expected: 'The reduction releases money, credit settles the fee and the remainder returns to the card.'
    provenance: test
    source: >-
      react-console:acceptance/accounting/playwright/journeys/cross-application/ACT-ACC-0802.spec.ts#ACT-ACC-0802
alternates:
  - from_step: 2
    condition: Gateway capture completed without a usable response.
    path: Commerce repeats the original uncertain request.
    outcome: Lookup establishes the existing capture and its receipt.
    provenance: test
    source: >-
      services-accounting:modules/transactions/tests/e2e/service-functions-gateway-lost-answer.e2e.spec.js#it
      finds the one capture with the lookup and answers the succeeded payment
failures:
  - from_step: 1
    condition: An unknown service identity invokes the function.
    path: Registry authorization rejects the caller.
    outcome: No bill is created.
    provenance: test
    source: >-
      services-accounting:modules/transactions/tests/e2e/service-functions.e2e.spec.js#it refuses a principal
      the registry does not know (403) and an event that is not a package (400)
rules_in_play:
  - BR-CAP-ACC-TRX-020-01
  - BR-CAP-ACC-TRX-020-02
  - BR-CAP-ACC-TRX-020-03
  - BR-CAP-ACC-TRX-020-07
  - BR-CAP-ACC-TRX-014-04
  - BR-CAP-ACC-TRX-007-06
assertions:
  - id: AS-JNY-ACC-TRX-006-01
    statement: Commerce-created billing retains the registered service actor.
    provenance: test
    source: >-
      services-accounting:modules/transactions/tests/e2e/service-functions.e2e.spec.js#it answers the issued
      invoice, whose rows name the service principal as their actor
  - id: AS-JNY-ACC-TRX-006-02
    statement: Receivable changes capture their corresponding Commerce events transactionally.
    provenance: test
    source: >-
      services-accounting:modules/transactions/tests/integration/services/change-events/receivable-event-capture.integration.spec.js#it
      records one INSERT change event per receivable fact, in the writing transaction, naming the fact’s id
  - id: AS-JNY-ACC-TRX-006-03
    statement: Cancellation records its financial components while exposing refund progress.
    provenance: test
    source: >-
      services-accounting:modules/transactions/tests/integration/services/reversals/reversal-refund-status.integration.spec.js#it
      answers refund_status processing with the refund id and the reversal pending
e2e_policy: optional
e2e_reason: >-
  This service-to-service journey requires API proof; no staff browser interaction establishes stronger
  financial evidence.
proved_by: []
---

# Bill, collect and unwind an order through service calls

## Story

Commerce bills the purchase through its restricted billing function and collects payment through tender. Retry identities keep an interrupted call from charging again. Later cancellation releases billed value, applies the cancellation fee and starts the remainder refund. Order-line financial positions remain available for inspection. Configured event delivery supplies Commerce updates; an absent receiver currently acknowledges with a log rather than delivering a live feed.
