---
id: WF-COM-ORD-007
title: Pay by deposit and installments
trigger: 'Deposit-policy plan selection, deposit acceptance and later invoiced payments drive the arrangement.'
product_area: commerce
module: orders
revision: 1
status: draft
design_intent: proposed
implementation_evidence: observed
inference: []
source_sha:
  services-commerce: c8b66a98e2490617aec38ba5c8165dd9bd0a8f9b
implements:
  - CAP-COM-ORD-009
  - CAP-COM-ORD-007
  - CAP-COM-ORD-014
moves:
  - STATE-COM-ORD-004
  - STATE-COM-ORD-006
crosses:
  - SVC-COM-ORD-checkout
  - SVC-COM-ORD-orders
  - SVC-ACC-TRX-transactions
idempotency: >-
  Schedule creation, invoice linkage and payment use stable order or attempt keys. Repeated schedule creation
  finds the same result, and schedule reductions retain cancellation-derived keys.
concurrency: >-
  Acceptance does not wait for schedule creation. Acceptance follow-up, financial sweeps and schedule reads
  can converge on the same keyed schedule request.
hops:
  - 'n': 1
    actor_or_service: Checkout
    action: >-
      Validate and store a deposit policy's offered plan, then obtain its deposit, installment and allocation
      quotation.
    anchor: 'services-commerce:modules/checkout/services/checkout/checkout-installments.ts'
    seam: sync
    on_failure: Unoffered or non-deposit choices are refused; an unanswered quote is unavailable.
    left_inconsistent: No installment arrangement has been created.
    observer: Observed through the requesting buyer or staff member.
    provenance: test
    source: 'services-commerce:modules/orders/tests/e2e/installments.e2e.spec.js'
  - 'n': 2
    actor_or_service: Placement
    action: Requote the intended placed lines and preserve the result on the sale.
    anchor: 'services-commerce:modules/orders/services/placement/place-order.ts:installmentsOfPlacement'
    seam: sync
    on_failure: Refused or unavailable quotation stops placement.
    left_inconsistent: No sale commits with the failed quotation.
    observer: Observed through the requesting buyer or staff member.
    provenance: observed
    source: 'services-commerce:modules/orders/services/placement/place-order.ts:installmentsOfPlacement'
  - 'n': 3
    actor_or_service: Billing and payment
    action: >-
      Bill deposit allocations and request payment with method vaulting for card or bank legs; accept when the
      deposit is covered.
    anchor: 'services-commerce:modules/orders/services/tender/tender-order.ts:tenderOrder'
    seam: sync
    on_failure: Decline permits another attempt and uncertain payment retains its original key.
    left_inconsistent: Lost payment answers can leave the deposit outcome unresolved.
    observer: Observed through the requesting buyer or staff member.
    provenance: test
    source: 'services-commerce:modules/orders/tests/e2e/installments.e2e.spec.js'
  - 'n': 4
    actor_or_service: Accounting
    action: 'After acceptance, request the line-based schedule under the stable order key and store its reference.'
    anchor: 'services-commerce:modules/orders/services/installments/installment-schedule.ts:ensureInstallmentSchedule'
    seam: sync
    on_failure: Refused or unanswered creation records deferral for a later mirror pass or schedule read.
    left_inconsistent: Acceptance stands without a confirmed schedule.
    observer: Observed through sale history (schedule created or deferred).
    provenance: observed
    source: 'services-commerce:modules/orders/services/installments/installment-schedule.ts:ensureInstallmentSchedule'
  - 'n': 5
    actor_or_service: Schedule read and mirror sweep
    action: >-
      Synchronize schedule and installment invoices into the money projection, attempting missing schedule
      creation on eligible reads.
    anchor: 'services-commerce:modules/orders/services/installments/installment-schedule.ts:syncInstallmentSchedule'
    seam: schedule
    on_failure: Failure is logged for another pass.
    left_inconsistent: The order's projection can omit current schedule facts.
    observer: Observed through the sale detail screen; recovery-pass log.
    provenance: observed
    source: >-
      services-commerce:modules/orders/services/installments/installment-schedule.ts:readOrderInstallmentSchedule
  - 'n': 6
    actor_or_service: Installment payment
    action: Pay an invoiced unpaid installment using Accounting's vaulted method and report the resulting status.
    anchor: 'services-commerce:modules/orders/services/installments/installment-tender.ts'
    seam: sync
    on_failure: >-
      Unknown, premature or already-paid installments are refused; unanswered payments retain open recovery
      work.
    left_inconsistent: Accounting may not yet have received the installment outcome.
    observer: Observed through the requesting buyer or staff member; sale history.
    provenance: observed
    source: 'services-commerce:modules/orders/services/installments/installment-tender.ts'
  - 'n': 7
    actor_or_service: Cancellation follow-up
    action: >-
      Following cancellation, reduce unpaid scheduled quantities or cancel the remaining schedule for a fully
      cancelled sale.
    anchor: 'services-commerce:modules/orders/services/installments/installment-cancellation.ts'
    seam: sync
    on_failure: Reduction refusal or deferral is logged and added to history without failing cancellation.
    left_inconsistent: Future charges can remain unreduced without an operational exception.
    observer: Observed through sale history only.
    provenance: observed
    source: 'services-commerce:modules/orders/services/installments/installment-cancellation.ts'
branches:
  - >-
    The current arrangement uses Accounting; the planning proposal would assign installment orchestration to
    Billing.
waits:
  - Accounting billing must create the installment invoices.
evidence:
  - >-
    services-commerce at c8b66a98: modules/orders/services/installments/*.ts;
    modules/checkout/services/checkout/checkout-installments.ts;
    modules/orders/services/placement/place-order.ts; tests/e2e/installments.e2e.spec.js.
controls: [TC-IAM-006, TC-AZ-001, TC-AZ-002, TC-AZ-003, TC-AZ-004, TC-AZ-005, TC-AZ-006, TC-TEN-001, TC-TEN-002, TC-TEN-003, TC-TEN-004, TC-CRY-001, TC-DAT-001, TC-DAT-002, TC-DAT-003, TC-LOG-001, TC-LOG-002, TC-LOG-003, TC-LOG-004, TC-LOG-005, TC-AVL-004, TC-MON-001, TC-MON-002, TC-MON-004, TC-PI-001, TC-PI-002, TC-PI-003, TC-PI-004, TC-PI-005, TC-PRV-001, TC-PRV-002]
---

# Pay by deposit and installments

## What It Does

An offered plan quotes deposit and future charges on the cart and is quoted again for placement. Deposit payment accepts the sale; the Accounting schedule then supplies later invoices and payment tracking.

## The Flow

```mermaid
sequenceDiagram
  participant B as Buyer
  participant K as Checkout and placement
  participant O as Orders
  participant X as Accounting
  B->>K: choose plan, preview quote
  K->>X: quote
  B->>K: place
  K->>X: quote again, frozen
  B->>O: pay deposit
  O->>X: payment (vault method)
  O->>O: accept order
  O->>X: create schedule (order key)
  O->>X: read schedule, link installment invoices (sweep)
  B->>O: pay installment
  O->>X: payment against the vaulted method, then the outcome
```

## When Something Fails

Schedule creation can be deferred without reversing acceptance and is retried by a schedule read or mirror pass. Cancellation reduction failures only reach history and logs, so future charges can remain too high. The vaulted-method charge depends on unfinished Accounting support.

## Open Design Questions

Future schedule ownership is proposed for Billing. Reads that create schedules or invoice links need a decision about permission and recovery boundaries.
