Combine the public API with webhooks
Get a notice when something changes (orders, products, stock, customers) and read the details with the API, without polling every minute.
The idea
Webhooks notify; the API fetches the data. Instead of asking every minute whether there are new orders, subscribe to the events and, when one arrives, ask for the details with your API key.
Subscribe to the events
- Go to Online shop › Online shop settings › Webhooks.
- Create a subscription with your
https://address and choose the events:order.created,order.paid,order.cancelled,product.updated,inventory.changedandcustomer.created. - Keep the signing secret: it is shown once.
When an event arrives
- Check the signature: the
X-Bizq-Signatureheader carriesv1=and the HMAC-SHA256 of the secret overX-Bizq-Timestamp, a dot and the body. Reject anything that does not match or is old. - Answer right away with a 2xx. Otherwise BizQ retries for 24 hours.
- Read the details with the API: for example
GET /api/v1/public/v1/orders/IDafterorder.created, orGET /api/v1/public/v1/stock?productId=IDafterinventory.changed.
Tips
- The same event may arrive twice: use
X-Bizq-Delivery-Idso you do not process it twice. - As a safety net, run a periodic sync with
updatedSince(for example, every night) in case a notice was lost. - To create orders from your website use
POST /orderswithIdempotency-Key: a retry never creates a double order.