A practical ecommerce integration design separating order, payment, fulfilment and refund states, with reconciliation tests and an exception-cost example.