You can create webhooks in Extend Commerce Backend. The webhook will make a call based on the events (triggers) that you define on the webhook. |
You find Webhooks under the gear wheel in the top right corner in Extend Commerce Backend. To edit Webhooks, click on the pen on the webhook you want to edit. To create a new Webhook, click on the blue button 'Create Webhook'. In this view you can then create or edit the Webhook.
|
The content in Notifications array will be different depending on the Action: PurchasePartiallyDelivered: { , } ProductCreated: { "Id": "13f078bcbe2243dc997655ed2cdbbdf7", "Attempt": 1, "Properties": { "NotificationId": "90c6340b-1f5c-49e0-9cee-45df5dd145c2" }, "Notifications": [ { "Action": "ProductCreated", "Details": { "ProductNumber": "Financial Invoice" } } ] } |
To make sure the webhook is sent by Extend Commerce it is signed. It is optional to use the signature for verification. Body is signed using SHA256 with clientsecret. The signed value is added in header 'ms-signature' ClientSecret: Body: the full request body SignatureFromHeader: request header 'ms-signature' Sample pseudo code: byte[] secret = Encoding.UTF8.GetBytes(ClientSecret); using (var hasher = new HMACSHA256(secret)) { byte[] data = Body.ToByteArray(); actualHash = hasher.ComputeHash(data); } byte[] expectedHash = FromHex(SignatureFromHeader).ToByteArray() if(IsSecretEqual(expectedHash, actualHash)) { //process web hook } Sample ClientSecret = secret123 Body = {'test':'test2'} BodyAsHex = 7B2774657374273A277465737432277D ms-signature = sha256=25FB6994568A75CD233E04BA1C653AF1BF476041CC543AF04F82CAAC482C201A |
|
På denna sida: |
---|