Webhooks

Use webhooks to be notified about events that happen in a Gluwa account.

You can receive a webhook notification from Gluwa whenever a transaction associated to your account is processed (i.e. is confirmed on the blockchain).

To integrate Gluwa webhook to your service you need to:

  1. Create a webhook endpoint and on your server

  2. Register your webhook endpoint

  3. Verify your address

Step 1: Create a Webhook Endpoint

Webhook data is sent as JSON in the POST request body. The full transaction details are included and can be used directly, after parsing the JSON into an Event object.

Example Webhook Notification
{
“EventType”: “TransactionConfirmed”,
“Type”: “Webhook”,
“ResourceID”: {ID of the resource. In this case, this will be transaction hash},
“ConfirmedDateTime”: {DateTime of when the transaction was confirmed},
“MerchantOrderID”: {Merchant OrderID if you specified MerchantOrderID field when generating QR code}
}

Checking the veracity of a request using X-REQUEST-SIGNATURE

X-REQUEST-SIGNATUREis generated by hashing the JSON string of the request body with the webhook secret using HMACSha256, and afterwards encoding the result using Base64URLSafe.

Te generate your X-REQUEST-SIGNATURE:

  1. get your webhook secret from the Gluwa Dashboard Webhooks page

  2. get the request body you received

  3. run the following formula:

Generating X-REQUEST-SIGNATURE for a Webhook
Base64UrlSafeEncode(HMACSha256({request body in JSON string}, {webhook secret}))

Compare the resulting value with the X-REQUEST-SIGNATURE header from the webhook. If identical, you can now successfully verified the signature.

Create an endpoint that would accept the webhook requests and process them according to your business logic.

Step 2: Register your webhook endpoint

The webhook will be sent to URLs that are registered through Gluwa Dashboard. Visit the page below to learn how to register your webhook endpoint.

Step 3: Verify your wallet address

You will receive webhook only for the addresses you have verified. Visit the page below to learn how to verify your wallet address.