Step 3: set up order webhooks

Lastly, we're going to subscribe to two of the order-related webhooks.

The first event type to subscribe to is OrderCreated. This event is triggered when an order is created, in both sandbox and production.

SandboxProduction
Copy
Copied
curl -i -X POST 'https://api-sandbox.equalsmoney.com/v2/webhooks' \
-H 'Authorization: ApiKey {apiKey}' \ # Your API key
-H 'Content-Type: application/json' \
-d '{
  "webhookEventTypeName": "OrderCreated",
  "accountId": "{accountId}",
  "url": "{webhookUrl}",
  "enabled": true
}'
Copy
Copied
curl -i -X POST 'https://api.equalsmoney.com/v2/webhooks' \
-H 'Authorization: ApiKey {apiKey}' \ # Your API key
-H 'Content-Type: application/json' \
-d '{
  "webhookEventTypeName": "OrderCreated",
  "accountId": "{accountId}",
  "url": "{webhookUrl}",
  "enabled": true
}'

The second event type to subscribe to is OrderCompleted. This event is triggered when an order is completed in production. You won't receive it in sandbox.

SandboxProduction
Copy
Copied
curl -i -X POST 'https://api-sandbox.equalsmoney.com/v2/webhooks' \
-H 'Authorization: ApiKey {apiKey}' \ # Your API key
-H 'Content-Type: application/json' \
-d '{
  "webhookEventTypeName": "OrderCompleted",
  "accountId": "{accountId}",
  "url": "{webhookUrl}",
  "enabled": true
}'
Copy
Copied
curl -i -X POST 'https://api.equalsmoney.com/v2/webhooks' \
-H 'Authorization: ApiKey {apiKey}' \ # Your API key
-H 'Content-Type: application/json' \
-d '{
  "webhookEventTypeName": "OrderCompleted",
  "accountId": "{accountId}",
  "url": "{webhookUrl}",
  "enabled": true
}'
info

For more information about webhooks and webhook event type structures, see the webhooks guide.

Next