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 webhooks in the approximate order they might occur in the lifecycle:

(1) When the Order...

(2) the state transitions to...

(3) and a ... webhook is emitted.

charge is not yet capturable (i.e., pending funds) and may be pending fraud

pending_payment

order.pending_payment

charge is capturable and may be pending fraud

in_review

order.review_opened

charge is capturable and has passed fraud or the Denied Parties List (DPL)

accepted

order.review_closed

is blocked by fraud or the DPL

blocked

order.blocked

is cancelled in full or part by the fulfiller

cancelled

order.fulfilled (with cancelled quantity specified)

  • is fulfilled in full or

  • is fulfilled in part and the remaining order items are cancelled

fulfilled

order.fulfilled

  • is fulfilled and the charge is captured in full or

  • is fulfilled in part and the charge is captured in part and the remaining order items are cancelled

  • charge is marked as complete

complete

order.complete

  • is returned in full or

  • is returned in part and the remaining order items are cancelled

returned

order.returned

The state values for a successful Order (i.e. the happy path) are as following: pending_payment > in_review > accepted > fulfilled > complete . As the Order moves from one state to another, a StateTransitions marks the event with a timestamp.

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, review_opened, and passed. These various states also trigger their own corresponding Event.