Change commands and retries
How does the API distinguish an identical repetition from a changed amount?
Scale alone does not ensure consistent retry behaviour. This proposed API binds the role, business object, change payload and expected state to each new intent. An idempotency key identifies the same intent after a response is lost.
Starting point Test overall load and competing debits separately.
Assumptions for the example case
Our own fictitious example draft: transfer in EUR with positive whole cent amounts; a debited customer account and an internal settlement account; external settlement with status query; reversal posting after proven rejection. Figures and quality goals are illustrative test assumptions. Outside are foreign exchange, interest, fees, regulatory approval check and a complete bank ledger.
Retries and new intent
Command contract · Repetition is recognized before new effect
The key preserves the historical result. An altered content with the same key creates a conflict.
Proposed domain API contracts
- POST
/transfersPosting a released EUR transfer locally.
- Input
- Account holder identity, account reference K-41, recipient, amountCent=7000, currency=EUR, matching authorisation evidence, expected account version and idempotency key.
- Result
- 201 with U-41, two balanced journal lines and A-41; insufficient funds or mismatched authorisation generate complete rejection without partial posting.
- Retry behaviour
- An identical operation by the same authorised role on the same object, using the same key and canonical payload, returns the stored original result. A changed payload under that key is rejected. External result identifiers are durably deduplicated after authentication; new intents check the current version again.
- POST
/settlement-resultsAccept an evidenced external outcome.
- Input
- Authenticated settlement source, unique result identifier, A-41, U-41, payee reference, 7000 cents, EUR and final status with proof.
- Result
- Durably accept the inbox record before acknowledging receipt. Matching final success settles the transfer; definitive rejection creates at most one referenced reversal posting set. Mismatched values require investigation.
- Retry behaviour
- An identical operation by the same authorised role on the same object, using the same key and canonical payload, returns the stored original result. A changed payload under that key is rejected. External result identifiers are durably deduplicated after authentication; new intents check the current version again.
- POST
/transfers/{id}/reconcileClarify existing settlement orders.
- Input
- Payment operations, U-41, A-41 and documented reconciliation; no new amount.
- Result
- 202 with matching reference for the same A-41. Unknown result remains open and does not generate a reversal posting.
- Retry behaviour
- An identical operation by the same authorised role on the same object, using the same key and canonical payload, returns the stored original result. A changed payload under that key is rejected. External result identifiers are durably deduplicated after authentication; new intents check the current version again.
- GET
/transfers/{id}Read journal and settlement status.
- Input
- Account holder for own U-41 or eligible customer service.
- Result
- Current condition, amount, accounting documents and open ground for clarification according to role.
- Retry behaviour
- Repeating a read creates no business effect; the returned current state may change between requests.
Recognise the same command
Persist the key with canonical content and the original result.
The response confirming acceptance of U-41 is lost.
Identical repetition receives the same journal document; changed amount is rejected.
- Alternative considered
- A new order at each retry can debit twice.
- Trade-off
- Keys must be retained over the clearing period.
- Reassess
- Storage and external reference validity are changed contractually.
Terms in this step
- Recognise the same command
- Identical repetition receives the same journal document; changed amount is rejected.
Try it yourself
Complete the repeat contract for identical 7,000 cents and modified 7,001 cents under the same key.
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
- Identical role, operation, transfer and payload provide the stored original receipt without another debit.
- Second part of the solution
- 7,001 cents under the same key create a content conflict. A new intention requires a new key and a matching authorisation.
Apply to your project
Which corresponding assumption in your project would you check first? Use as an occasion: storage and external reference validity are changed contractually.