The order lifecycle

Learn about the order lifecycle.

An Order has a defined lifecycle, each stage of which is represented by the state attribute. Additionally, when the state changes, an Event is created that represents that change. For example, when the state changes from accepted to fulfilled an order.fulfilled Event is created.

Order states and events

The following table lists the enumerated state values and their associated events in the approximate order they might occur in the lifecycle:

(1) When the Order...

(2) the state transitions to...

(3) and an ... event is emitted.

charge isn't yet capturable and could still be pending fraud review



charge is capturable, but the order requires further fraud review, and, as a result, is still not ready to fulfill



charge is capturable, has passed fraud reviewor the Denied Parties List (DPL), and is ready to fulfill



fails because it is blocked by fraud review or the DPL



is fully cancelled



is completely fulfilled or partially fulfilled and the remaining items are cancelled



is fulfilled and the charge is fully captured or partially fulfilled with a partially captured charge and the remaining items are cancelled or

the order charge is complete



is fully returned or partially returned and its remaining items are cancelled or partially/fully refunded



The state values for a successful Order (i.e. the happy path) are pending_payment > in_review > accepted > fulfilled > complete . As the Order moves from one state to another, the event is recorded with a timestamp in the stateTransitions hash table.

The following diagram shows the possible state values and the actions and events associated with each throughout the Order lifecycle:

Click to enlarge

Fraud review

An order must also pass through a fraud review. When exactly that review occurs in the order lifecycle depends on the payment method used by the customer. The different stages of the review are represented by the fraudState attribute, whose enumerated values are blocked, in_review, and passed. These various states also trigger their own corresponding Event.