Webhooks
Commerce service can notify your application about some kind of events that happens inside your company tenant. To notify your application, we use the pattern of REST Webhooks.
To start receiving our webhooks, you must first create a webhook configuration inside your company. Since your company has one webhook configuration enabled, you will start receiving our webhook events.
Webhook Authentication
All of our webhooks are signed to confirm that your application is receiving a true webhook. This signature is sent in the request header named x-w3block-commerce-signature
.
To verify the signature follow the steps:
Compute a HMAC with the SHA-256 hash function of the request payload. Use your webhook configuration signature key in the signature creation.
Compare the signature in the header to the expected signature.
Available Webhooks
Orders
We can notify all of order events like creation and status changes to your application. See some examples above:
{
"data": {
"id": "8e29703b-3706-466a-ba14-cd12749c9dcc",
"gasFee": "0.020621829275431147",
"status": "pending",
"userId": "7cbd6b95-0247-40b3-a9e9-2ea9b6195cb0",
"addressId": null,
"companyId": "010e92ea-d3af-40d9-a19e-a263fdfe6e92",
"createdAt": "2022-10-19T17:51:14.148Z",
"expiresIn": "2022-10-20T03:51:14.677Z",
"updatedAt": "2022-10-19T17:51:14.148Z",
"currencyId": "8c43ece8-99b0-4877-aed3-2170d2deb4bf",
"serviceFee": "0",
"deliverDate": null,
"paymentInfo": {
"publicKey": "pk_test_51LXlkcLjgooBZGqLtsJOxvWAUODRl8PDeg8hFtousHL1pA0iqW73fmXweqYO67XzG0pn50YmnFT0cBTTKzCEYSWa00XRYaEiyf",
"clientSecret": "pi_3LugQALjgooBZGqL1Gi6RFTP_secret_RsR2M9xPwQTKcV3M9aKe51zSl"
},
"paymentMethod": null,
"currencyAmount": "1.2",
"paymentProvider": "stripe",
"providerTransactionId": "pi_3LugQALjgooBZGqL1Gi6RFTP",
"destinationWalletAddress": "0xe28eac8f542d0dd11a706f08d1953dd4c2ff07ab"
},
"event": "order.created",
"timestamp": 1666201874688
}
Last updated