Skip to main content

Order lifecycle

Every order carries a status, and that status decides which actions Walley accepts. Read this page once and the state rules on each endpoint will make sense.

Where orders come from​

An order can reach the Management API from more than one place. Whichever route created it, the statuses and actions below work the same way.

Each of these raises a walley:order:created webhook.

The main path​

An order starts uncaptured. You capture items as you ship them, and the order moves toward Activated. If you never capture, it expires on the date in expiresAt.

Capturing is what triggers payout. Once an order is fully captured, the amount is marked for payout to your bank account and the order joins the reconciliation report.

Order statuses​

The status field on the order tells you where it is.

StatusWhat it means
NotActivatedThe order exists and nothing is captured yet. It expires at expiresAt.
PartActivatedSome items are captured and some are not.
ActivatedEvery item is captured. The amount is marked for payout.
ReturnedThe order has been fully refunded.
ExpiredThe order passed expiresAt without being captured. You can still cancel it.
OnHoldWalley has not yet made a decision on the order. Wait for the walley:order:authorized webhook.
ClosedThe order is settled and no longer open for changes. Capture and reauthorize both reject it.

Item statuses​

Each entry in items carries its own status, so a PartActivated order holds a mix of them.

StatusWhat it means
NotActivatedNot captured yet.
ActivatedCaptured. captureId and capturedAt are set.
ReturnedRefunded. refundedAt is set.
CanceledCanceled before capture. It will not be delivered, and it is never settled or paid out. On a direct payment method, the customer is refunded for it.
ExpiredThe order expired before this item was captured.

What each status allows​

Before you call an endpoint, check the order status against this table.

ActionAllowed onNotes
Get orderAny statusReading is always safe.
Capture orderNotActivated, PartActivatedRejected on Closed and Expired.
Reauthorize orderNotActivated, PartActivatedRaising the amount works on credit payment methods only, not on prepaid.
Refund orderActivated, PartActivatedYou can only refund what has been captured.
Cancel orderNotActivated, PartActivated, ExpiredCancels every uncaptured item. This cannot be undone.

Calling an endpoint against the wrong status returns 422 with an error code that names the problem. See Errors.

Two things worth knowing​

Capture and cancel are one-way. A capture settles the items you shipped and a cancel releases the ones you did not. Neither has an undo. To give money back after a capture, refund the order.

An order that has not been captured will expire. Check expiresAt on the order and capture before that date. An expired order can no longer be captured, only canceled.

Next steps​

  • Asynchronous operations explains why a status change is not visible the moment you get a response
  • Errors covers the responses you get when a status blocks an action