Menu

Send orders to another system

This guide sends every order to another system, such as an accounting tool, an ERP or a warehouse, and keeps it updated as orders are paid, shipped or cancelled.

You need a key with read_orders, and a webhook endpoint with the order events.

1. Listen for orders

Add a webhook endpoint for order.created, order.paid, order.fulfilled, order.cancelled and order.refunded, or for order.updated if every change matters to you.

When one arrives, verify it, then save the order by its id:

app.post('/webhooks/nepzio', express.raw({ type: 'application/json' }), async (req, res) => {
  if (!verify(process.env.NEPZIO_WEBHOOK_SECRET, req.headers, req.body.toString())) {
    return res.status(400).end();
  }
  const event = JSON.parse(req.body);
  if (await alreadyHandled(event.id)) return res.status(200).end();

  await queue.add('save-order', event.data.object); // do the slow work later
  await markHandled(event.id);
  res.status(200).end();
});

2. Save orders by id

Treat each order as the latest copy and save it over what you have (an upsert by id).

  • Lines are snapshots taken when the order was placed: names, SKUs and prices don't change if the product changes later.
  • source says where the order came from: storefront, pos, admin, conversation, daraz or amazon.
  • payment_status and status are separate: a cash-on-delivery order can be shipped before it is paid.
  • Shoppers' details: customer.email and customer.phone can be null (in-shop sales, chat orders).

3. Catch anything missed

Your server may be down, or a webhook may be delayed. Once an hour, fetch what changed since your last sync started:

curl "https://api.nepzio.com/v1/orders?updated_at_min=2026-11-10T07:00:00Z&limit=250" \
  -H "Authorization: Bearer $NEPZIO_API_KEY"

Follow next_cursor to the end, and save each order the same way. See Pagination and syncing.

4. First import

To bring in past orders, page through GET /v1/orders?limit=250 (newest first) to the end, or only since a date with created_at_min.