LogoLogo
Build appsContact API support
Webhook automations
  • Build apps
  • Site Templates
  • API Reference
  • Changelog
Webhook automations
  • Webhook automations overview
  • Setup webhooks
    • How to process webhooks
    • Set up webhooks for your app
    • Code example for webhook handling
  • Learn Ecwid webhooks
    • List of webhook events
    • Event data in webhooks
  • Customize webhooks
    • Pass additional data through webhooks
  • Webhook flow examples
    • Export new orders
    • Sync product stock

Lightspeed® 2025

On this page
  • Step 1. Connect order webhooks
  • Step 2. Parse webhooks for order ID
  • Step 3. Automate REST API calls
  • Step 4. Parse the REST API response and send the data

Was this helpful?

  1. Webhook flow examples

Export new orders

Last updated 2 months ago

Was this helpful?

Send details about new orders placed in your store to an external service automatically.

Step 1. Connect order webhooks

Request only one order.created event required for this flow.

Step 2. Parse webhooks for order ID

With webhooks set up, when a new order is placed in the store, Ecwid automatically sends a POST request to your server. It contains the order ID and its payment and fulfillment statuses in a body JSON.

For further automation, you need to automate webhook processing. Check out the following articles to get started:

Get the order ID from the webhook body and save it as a variable.

Step 3. Automate REST API calls

  • Store ID

  • Order ID

  • App's secret_token

You can "hardcode" the store ID and secret_token on your server's backend as they are constants (as long as the app is not uninstalled/reinstalled in the store). This leaves only one variable – order ID – that you can get from the webhook body.

Additionally, you can pre-define the data you want to receive by limiting Ecwid API's response with specific fields. If not limited, you'll receive full order details with hundreds of fields, which can slow down your application.

<?php

$storeId = '1003'; // your store ID
$orderId = 'K8XTQ'; // order ID from webhook body
$rfields = urlencode('responseFields=id,total,email,paymentMethod'); // Specify fields for the response, changes ',' to %2C
$sToken = 'secret_J9fKJHgiw5PPNJdcLUvucV6gvtXmScjP'; // your app's secret_token
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://app.ecwid.com/api/v3/$storeId/orders/$orderId?$rfields',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => array(
    'Authorization: Bearer $sToken'
  ),
));

$response = curl_exec($curl);

curl_close($curl);

// $response variable is a JSON with order details

Step 4. Parse the REST API response and send the data

Now you have the details of the new order on your server. Parse the $response variable from the example above and send the details to an external service of your choice.

To start receiving automatic notifications about new orders placed in your store, you need to set up webhooks in your store:

Now you have everything to automate making a REST API call upon receiving a webhook. The call requires 3 variables:

Set up webhooks
Code example for webhook processing
Event data in webhooks
Get order