Create Webhook Endpoint
curl --request POST \
--url https://uat-api.clinkbill.com/api/webhook/endpoints \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--header 'X-Timestamp: <x-timestamp>' \
--data '
{
"url": "https://example.com/api/clink/webhook",
"events": [
"session.complete",
"order.succeeded",
"invoice.paid"
],
"description": "Created through the API",
"enabled": true
}
'HttpResponse<String> response = Unirest.post("https://uat-api.clinkbill.com/api/webhook/endpoints")
.header("X-Timestamp", "<x-timestamp>")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"https://example.com/api/clink/webhook\",\n \"events\": [\n \"session.complete\",\n \"order.succeeded\",\n \"invoice.paid\"\n ],\n \"description\": \"Created through the API\",\n \"enabled\": true\n}")
.asString();import requests
url = "https://uat-api.clinkbill.com/api/webhook/endpoints"
payload = {
"url": "https://example.com/api/clink/webhook",
"events": ["session.complete", "order.succeeded", "invoice.paid"],
"description": "Created through the API",
"enabled": True
}
headers = {
"X-Timestamp": "<x-timestamp>",
"X-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-Timestamp': '<x-timestamp>',
'X-API-KEY': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
url: 'https://example.com/api/clink/webhook',
events: ['session.complete', 'order.succeeded', 'invoice.paid'],
description: 'Created through the API',
enabled: true
})
};
fetch('https://uat-api.clinkbill.com/api/webhook/endpoints', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"code": 200,
"msg": "Success",
"data": {
"id": "whk_xxxxx",
"url": "https://example.com/api/clink/webhook",
"events": [
"session.complete",
"order.succeeded"
],
"enabled": true,
"signingSecret": "whsec_xxxxx",
"maskedSigningSecret": "whsec_...abcd",
"description": "Created through the API",
"createdAt": 1782112780956,
"updatedAt": 1782113780956
}
}{
"code": 123,
"msg": "<string>",
"data": "<unknown>"
}{
"code": 123,
"msg": "<string>",
"data": "<unknown>"
}Webhook Endpoint Management
Create Webhook Endpoint
Create a webhook endpoint for the current merchant. The endpoint URL must use HTTPS and resolve to a public host.
POST
/
webhook
/
endpoints
Create Webhook Endpoint
curl --request POST \
--url https://uat-api.clinkbill.com/api/webhook/endpoints \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--header 'X-Timestamp: <x-timestamp>' \
--data '
{
"url": "https://example.com/api/clink/webhook",
"events": [
"session.complete",
"order.succeeded",
"invoice.paid"
],
"description": "Created through the API",
"enabled": true
}
'HttpResponse<String> response = Unirest.post("https://uat-api.clinkbill.com/api/webhook/endpoints")
.header("X-Timestamp", "<x-timestamp>")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"https://example.com/api/clink/webhook\",\n \"events\": [\n \"session.complete\",\n \"order.succeeded\",\n \"invoice.paid\"\n ],\n \"description\": \"Created through the API\",\n \"enabled\": true\n}")
.asString();import requests
url = "https://uat-api.clinkbill.com/api/webhook/endpoints"
payload = {
"url": "https://example.com/api/clink/webhook",
"events": ["session.complete", "order.succeeded", "invoice.paid"],
"description": "Created through the API",
"enabled": True
}
headers = {
"X-Timestamp": "<x-timestamp>",
"X-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-Timestamp': '<x-timestamp>',
'X-API-KEY': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
url: 'https://example.com/api/clink/webhook',
events: ['session.complete', 'order.succeeded', 'invoice.paid'],
description: 'Created through the API',
enabled: true
})
};
fetch('https://uat-api.clinkbill.com/api/webhook/endpoints', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"code": 200,
"msg": "Success",
"data": {
"id": "whk_xxxxx",
"url": "https://example.com/api/clink/webhook",
"events": [
"session.complete",
"order.succeeded"
],
"enabled": true,
"signingSecret": "whsec_xxxxx",
"maskedSigningSecret": "whsec_...abcd",
"description": "Created through the API",
"createdAt": 1782112780956,
"updatedAt": 1782113780956
}
}{
"code": 123,
"msg": "<string>",
"data": "<unknown>"
}{
"code": 123,
"msg": "<string>",
"data": "<unknown>"
}Authorizations
Your secret API key obtained from the Clink dashboard (Developers section)
Headers
Current timestamp in milliseconds since Unix epoch (required for request signing)
Example:
"1783513683000"
Body
application/json
HTTPS endpoint URL. Localhost, loopback IPs, private IPs, link-local addresses, and multicast addresses are rejected.
Maximum string length:
512Example:
"https://example.com/api/clink/webhook"
Event names to subscribe to. Numeric event codes are not accepted.
Minimum array length:
1Supported webhook event name. Public API requests use event names, not numeric event codes.
Available options:
order.created, order.succeeded, order.failed, refund.created, refund.succeeded, refund.failed, subscription.created, subscription.trialing, subscription.activated, subscription.incomplete_expired, subscription.past_due, subscription.cancelled, invoice.open, invoice.paid, invoice.void, order.next_action, subscription.updated.plan_changed, subscription.updated.plan_change_canceled, subscription.updated.renewed, subscription.updated.cancel_at_period_end_set, subscription.updated.cancel_at_period_end_revoked, session.complete, session.expired, dispute.created, dispute.updated, dispute.won, dispute.lost, dispute.closed, customer.verify, payment_method.added, payment_method.default_change, risk_rule.updated, agent_order.succeeded, agent_order.failed, agent_refund.succeeded, agent_refund.failed, agent_refund.approved, agent_refund.rejected, payment_method.update, purchase_instruction.created, purchase_instruction.activated, purchase_instruction.updated, purchase_instruction.cancelled, vic_device.binding_succeeded Example:
[
"session.complete",
"order.succeeded",
"invoice.paid"
]
Optional endpoint description.
Maximum string length:
512Example:
"Created through the API"
Whether the endpoint is enabled.