System Design Atlas

Subscription billing, usage and service entitlements

07 / 10Worked example

Critical flow

How do you resolve a payment collection that may have succeeded despite a lost response?

Trace the failure through the architecture: the payment service collects payment for R-161, but its response is lost. Billing operations queries Z-161. This unknown outcome does not restrict the entitlement as a definite rejection would; a late confirmation completes the same payment order. Durable acceptance, actual effect and response are considered separately.

Starting point Finalise invoices immutably and track payments separately.

Assumptions for the example case

Original fictional example design: one monthly contract in EUR, positive integer usage units, a fixed tariff version per period, one invoice and one payment order, and separate correction records. Figures and quality targets are illustrative test assumptions. Tax law, multiple currencies, prorated tariff changes and debt collection are outside the scope.

Failure point in the sequence

Payment collection, lost response and durable reconciliation

Z-161 remains open and the entitlement stays active until evidence reconciles the same payment order.

Payment worker
Payment service
Payment ingestion
Billing store
Entitlement service
  1. 01 Payment worker → Payment serviceZ-161 · 1,200 cents
  2. 02 Payment service · Local processingPayment collected
  3. 03 Payment worker · Local processingResponse missing
  4. 04 Payment worker → Payment serviceQuery Z-161 status
  5. 05 Payment service → Payment ingestionbezahlt · Z-161 · 1,200 cents
  6. 06 Payment ingestion → Billing storeVerify source; commit inbox entry
  7. 07 Billing store → Entitlement serviceEvidenced outcome
  8. 08 Entitlement service · Local processingEntitlement active

Result: An unknown outcome leaves the entitlement active; late confirmation completes the same payment order.

The payment order remains unchanged. The inbox makes its late confirmation traceable for the entitlement and invoice.

The money may already have been collected. Query the same Z-161. A timeout creates neither a new collection nor a definite rejection.

Effect, response and recovery

Specific error
The payment service collects payment for R-161, but its response is lost. Billing operations queries Z-161. This unknown outcome does not restrict the entitlement as a definite rejection would; a late confirmation completes the same payment order.
Before and after commit
Commit durably completes the local change. Before commit, the old state remains valid; afterwards, an identical retry returns the stored outcome. Reconcile the external effect using its existing reference.
Retry behaviour
Send N-161 with 100 units twice: the result is 100 units. Reusing its identifier with 101 units produces a conflict. Sending Z-161 twice with identical content uses the same 1,200-cent payment collection; changing the amount is forbidden.

Resolve an uncertain charge

Resolve an uncertain charge

Query the same Z-161.

Money may already have been collected.

A timeout creates neither a new collection nor a definite rejection.

Alternative considered
A new payment order on every timeout can charge the customer twice.
Trade-off
Investigation can leave the entitlement decision pending for longer.
Reassess
Reconciliation with the provider becomes unreliable.

Terms in this step

Resolve an uncertain charge
A timeout creates neither a new collection nor a definite rejection.

Try it yourself

Z-161 was executed, but its response is lost. Predict the next message and its effect on the entitlement.

A hint for your attempt

Use the specific entities and conditions from this step. The two solution parts distinguish the decision from its evidenced outcome.

Compare with a possible solution
First part of the solution
Billing operations queries the same Z-161 using R-161, 1,200 cents and EUR.
Second part of the solution
Payment remains open until evidence arrives. There is no new collection and no definite rejection that would automatically restrict the entitlement.

Apply to your project

Which corresponding assumption in your project would you check first when provider reconciliation becomes unreliable?

Step 8 examines how to locate the finalisation backlog.