Deliver waiting orders from your own system
For goods made at the moment of sale, the order waits until your program adds the stock it needs and asks Shoplio to deliver it.
On this page
When this fits
Use it for goods your own system makes when someone buys, such as a licence created on your server. A paid order waits for you in one of two statuses.
| Status | How it happens | What delivers it |
|---|---|---|
preordered | Pre-orders are on and a signed-in buyer paid while the product had no stock | Adding stock. Waiting pre-orders are delivered oldest first |
out_of_stock | The buyer paid, but the stock ran out before delivery | Your call to deliver the order |
A product with no stock and pre-orders off cannot be bought. Goods made on demand therefore need pre-orders on, as Add products and variants describes.
The steps
- Poll List orders with
status=preorderedand withstatus=out_of_stock. The list is newest first, so read every page and start from the oldest order. - Make one item per unit of the order's
quantityin your own system. - Call Deliver an order with the order id.
- Read the order again. Once it is
delivered, the buyer has the goods.
A stock line is not tied to one order. Waiting pre-orders take new stock oldest first, and stock that is left over is open to any buyer. Work through waiting orders oldest first and push only what they need.
What the buyer sees while waiting
- A
preorderedorder tells the buyer it is paid and will be delivered on restock. At the product's deadline it is credited to their store balance instead. - An
out_of_stockorder tells the buyer the product ran out after they paid. With Instant Refund to Balance on, they can take store balance instead of waiting. - With Full Auto-Refund on, an
out_of_stockorder of a buyer with a store account is credited to their balance without waiting. Deliver then refuses it.
Doing it twice is safe
- A delivered order answers 200 with
already_deliveredset to true. Nothing more is delivered. in_progressmeans another attempt holds the order. Read the order again shortly.- With too little stock the call answers 409 with
insufficient_stock, and the order stays as it was.
A program that retries after a timeout therefore never delivers an order twice. The other refusals are listed under Deliver an order.