Webhook is used for sending deposit notifications to your desired URL. You can setup the URL upon wallet creation and it will send a deposit notification request to your endpoint using your key
and secret
The request includes 2 headers:
key: Same client key
secret: Same client secret
Once your server receives the request on your endpoint you need to check the request key
and secret
to check the validity of the request and make sure that this request is coming from Vault. (In more advanced scenarios HMAC-signature structure can be configured)
You can use webhook test on REST API interactive explorer on https://api.vault.bitholla.com/docs to test the sample request sent to your server.
Webhook request expects 200 status response from your server.
Check the fields in is_confirmed
and is_suspicious
in the data you receive on your server. The webhook notifications are always sent when the deposit is confirmed. Often you receive the first webhook notification with status is_confirmed: false
which is used to notify about an incoming deposit. In these cases do not assume the deposit is confirmed and wait for the second notification before you process it.
{"message": "Signed request is sent successfully"}
This structure is not used for normal wallets and is only applied for extra security upon client request. In the advance model, webhook deposit notification signs your request using your provided key
and secret
.
You are required to calculate the signature on your side and match it with the api-signature
provided along with the api-nonce
in the request header.
This is a sample code for signature you can refer to:
const secret = <your api-secret>;const verb = 'POST';const url = <your wallet webhook url>;const data = <notification object data>;const nonce = Date.now();const stringData = JSON.stringify(data);const signature = crypto.createHmac('sha256', secret).update(verb + url + nonce + stringData).digest('hex');console.log(signature)