Scenario simulators
On staging, orders only move past pending when the factory processes them. A
scenario simulator moves one of your test orders on demand, so you can build
and test your webhook handlers without waiting.
A simulation is not a fake payload. The order changes exactly as it would for the real event: its status, shipments and tracking update, and your subscriptions get the same webhooks, signed as usual.
Run a scenario
Section titled “Run a scenario”Needs the simulators:run scope. Pass the id of an order your organisation
placed.
curl -X POST https://api.staging.elasticstage.com/store/v1/simulators/order_shipped \ -H "Authorization: Bearer $ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "order_id": "ord_3a9f21" }'{ "scenario": "order_shipped", "order_id": "ord_3a9f21", "status": "shipped" }Scenarios
Section titled “Scenarios”| Scenario | Runs on | Webhooks sent |
|---|---|---|
order_processing |
pending |
order.processing |
order_shipped |
pending, processing |
order.processing (if pending), then order.shipped with tracking |
order_cancelled |
pending, processing |
order.cancelled |
A shipped simulation uses Royal Mail with a generated tracking number, so
GET /v1/orders/{id} shows a real-looking shipment.
Errors
Section titled “Errors”| Status | code |
When |
|---|---|---|
403 |
FORBIDDEN |
Production, or the token lacks simulators:run. |
404 |
NOT_FOUND |
The order doesn’t exist or belongs to another organisation. |
409 |
CONFLICT |
The order’s status rules the scenario out. |