Register a webhook
Register your webhook to receive transaction notifications.
You can register your webhook on your merchant dashboard or via the api endpoint
POST
https://api.tryduplo.com/v1/merchants/businesses/webhook
Authorization
string | set value to Bearer SECRET_KEY |
webhook_url
string required | Your webhook url, we would post transaction notifications to this url. |
callback_url
string | Your callback url, this is optional. |
verify_hash
string required | Your encrypted key, we would send this along with our request and you would use this key to verify that the request to your webhook url is from Duplo. |
business_id
string required | Merchant business ID |
cURL
Node
PHP
curl --location --request POST 'https://api.tryduplo.com/v1/merchants/businesses/webhook' \
--header 'Authorization: Bearer SECRET_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
"webhook_url": "https://webhook.site/a1b47ab8-997a-4c2a-83ab-2614e7f",
"verify_hash": "6F4B941015BC08D44FUAMCAJ.948249SJHE",
"business_id": "8edfcc-1e1c-4ad1-9ed8-e870d654",
}'
1
var axios = require('axios');
2
var data = JSON.stringify({
3
"webhook_url": "https://webhook.site/a1b47ab8-997a-4c2a-83ab-2614e7f",
4
"verify_hash": "6F4B941015BC08D44FUAMCAJ.948249SJHE",
5
"business_id": "8edfcc-1e1c-4ad1-9ed8-e870d654",
6
});
7
8
var config = {
9
method: 'post',
10
url: 'https://api.tryduplo.com/v1/merchants/businesses/webhook',
11
headers: {
12
'Authorization: Bearer SECRET_KEY',
13
'Content-Type': 'application/json'
14
},
15
data : data
16
};
17
18
axios(config)
19
.then(function (response) {
20
console.log(JSON.stringify(response.data));
21
})
22
.catch(function (error) {
23
console.log(error);
24
});
1
<?php
2
3
$curl = curl_init();
4
5
curl_setopt_array($curl, array(
6
CURLOPT_URL => 'https://app-api.tryduplo.com/v1/merchants/businesses/webhook',
7
CURLOPT_RETURNTRANSFER => true,
8
CURLOPT_ENCODING => '',
9
CURLOPT_MAXREDIRS => 10,
10
CURLOPT_TIMEOUT => 0,
11
CURLOPT_FOLLOWLOCATION => true,
12
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
13
CURLOPT_CUSTOMREQUEST => 'POST',
14
CURLOPT_POSTFIELDS =>'{
15
"webhook_url": "https://webhook.site/a1b47ab8-997a-4c2a-83ab-2614e7f",
16
"verify_hash": "6F4B941015BC08D44FUAMCAJ.948249SJHE",
17
"business_id": "8edfcc-1e1c-4ad1-9ed8-e870d654",
18
}',
19
CURLOPT_HTTPHEADER => array(
20
'Authorization: Bearer SECRET_KEY',
21
'Content-Type: application/json'
22
),
23
));
24
25
$response = curl_exec($curl);
26
27
curl_close($curl);
28
echo $response;
29
{
"data": {
"id": "7ec2ad3a-8d26-4f7f-9396-1cbb495546cd",
"webhook_url": "https://webhook.site/7ab8-997a-4c2a-83ab-2614e7f",
"Callback_url": "https://webhook.site/7ab8-997a-4c2a-83ab-2614e7f",
"verify_hash": "6F4B941015BC08D44FUAMCAJ.948249SJHE",
"services": [
"virtual-account"
],
"created_at": "2021-08-03T12:35:34.184Z",
"update_at": "2021-08-03T12:35:34.188Z",
"business_id": "8edfcc-1e1c-4ad1-9ed8-e870d654"
},
"errors": {},
"message": "Request successful"
}
Last modified 1yr ago