Webhooks
Overview
Webhooks enable notifications to be made for a variety of events within the CXTN API. To activate webhooks on the account contact us first.
Step 1. Enable Webhooks
Once your request to activate webhooks is verified by us, the next step is to enable Webhooks on the account. To do this:
- Call
POST - Enable Webhooks
.
Step 2. Create a Webhook
To create a webhook:
- Call
POST - Create Webhook Endpoint
- Enter the corresponding
EventType
value. E.g. Payment, Account Transaction. - Enter the
EndpointURL
where notifications are to be received.
Value | EventType | Active/Inactive | Event - Notification |
---|---|---|---|
0 | Trade | Inactive | null |
1 | Payment | Active | Payment Completed - Payment received by beneficiary. |
2 | AccountTransaction | Active | Funds received - Account credit received from sender. |
3 | Wallet | Inactive | null |
4 | Card | Inactive | null |
5 | Quote | Inactive | null |
6 | BulkPayments | Inactive | null |
REQUEST
curl --location 'https://caxapi-integration.azurewebsites.net/api//webhooks/endpoints' \
--header 'Authorization: Bearer <access_token>' \
--header 'Content-Type: application/json' \
--data '{
"WebhookEventType": "Wallets",
"EndpointUrl": "https://webhook.site/9ed441e2-9890-86gb-p989-5678910111213"
}'
RESPONSE
{
"Content": {
"Model": {
"ApiStatusCode": 100,
"ApiStatus": "IsValid",
"ApiStatusDescription": "Valid Operation"
},
"ExpectedResponses": [
"IsValid"
]
},
"AuthorisedClientModel": {
"ClientId": "<clientid>",
"ClientRef": "<clientref>",
"ApiStatusCode": 100,
"ApiStatus": "IsValid",
"ApiStatusDescription": "Valid Operation"
},
"AuthorisedUserModel": {
"UserId": "<userid>",
"AppVersion": "20231117.1",
"TokenStartDate": "2023-11-21T00:00:00",
"TokenEndDate": "2023-12-21T00:00:00",
"LoginTimestamp": "2023-12-01T20:43:29.7267638",
"ApiLoginType": 1,
"ApiStatusCode": 100,
"ApiStatus": "IsValid",
"ApiStatusDescription": "Valid Operation"
}
}
Webhook Settings
Edit Webhook Endpoint
Individual endpoints can be edited to change the URL:
- Call
PUT - Edit Webhook Endpoint
- Specify the
WebhookEventType
.
Toggle Webhook Endpoint Status
Individual webhooks can be set to 'Active', 'Inactive', or 'Paused' via PUT - Update Webhook Endpoint Status
.
Deactivate Webhooks
To deactivate all webhooks call PUT - DeActivate Webhook
.
Get Webhook Endpoints
To get a list of all webhooks, call GET - Retrieve Webhook Endpoints
.
Webhook Samples
The following section is made up of sample notifications received when the corresponding EventType
is enabled.
Funds-In
The following illustrates the notification received when funds are deposited in the account. This type of notification is received when AccountTransaction
Webhook notifications are enabled.
Notification
"{
""eventId"": ""wh_f79f07d55bcd4cb893c41575b7c1b8f6"",
""event"": ""account_credit"",
""data"": ""{\""objectId\"":654254,\""userId\"":\""C00081866\"",\""source\"":
\""deposit\"",\""origin\"":\""Automatic Allocation\"",\""amount\"":1000.00,\""baseCcyCode\"":\"
"GBP\"",\""ccyCode\"":\""GBP\"",\""transactionDateTime\"":\""2023-12-18T16:28:28.3027309\""}
""
}"
Payment Complete
The following illustrates the notification received when a payment is complete.
Notification
"{
""eventId"": ""wh_4d9373d27e4e4c24bbb39c00b6dcd3e7"",
""event"": ""payment_completed"",
""data"": ""{\""objectId\"":162953,\""userId\"":\""C00081866\"",\""amount\"":10.00,\""currency\"":\""GBP\""}""
}"
Trade Settled
The following illustrates the notification received when a trade is complete. This type of notification is received when Payment
Webhook notifications are enabled.
Notification
"{
""eventId"": ""wh_b5bc5ac1b6734f18b9701db5cd153a4e"",
""event"": ""trade_settled"",
""data"": ""{\""objectId\"":282564,\""userId\"":\""C00084146\"",\""sellCurrency\"":\""GBP\"",\""sellAmount\"":218.70,\""buyCurrency\"":\""AED\"",\""buyAmount\"":1000.00,\""balanceDue\"":null,\""fundedAmount\"":null}""
}"
Account Credit
The following illustrates the notification received when a credit reaches the account.
Notification
"{
""eventId"": ""wh_c3f042548b624eb1a0ba9a57be8290f4"",
""event"": ""account_credit"",
""data"": {
""objectId"": 661428,
""userId"": ""AP00085025"",
""source"": ""account_to_account_transfer"",
""origin"": ""Automatic Allocation"",
""amount"": 10,
""baseCcyCode"": ""GBP"",
""ccyCode"": ""GBP"",
""transactionDateTime"": ""2024-02-21T11:58:01.9953917""
}
}"
Account Debit
The following illustrates the notification received when an amount is debited.
Notification
"{
""eventId"": ""wh_61d20530f4d34936a38ac82979d3f5e2"",
""event"": ""account_debit"",
""data"": {
""objectId"": 661427,
""userId"": ""C00081866"",
""source"": ""account_to_account_transfer"",
""origin"": ""Automatic Allocation"",
""amount"": -10,
""baseCcyCode"": ""GBP"",
""ccyCode"": ""GBP"",
""transactionDateTime"": ""2024-02-21T11:58:01.9016343""
}
}"
Pot Credit
The following illustrates the notification received when an amount is credited to a Pot.
Notification
"{
""eventId"": ""wh_3d0e35a456274850b59e59411ad37d48"",
""event"": ""account_credit"",
""data"": {
""objectId"": 661414,
""userId"": ""C00081866"",
""source"": ""account_internal_transfer"",
""origin"": ""Automatic Allocation"",
""amount"": 10,
""baseCcyCode"": ""GBP"",
""ccyCode"": ""CC-GBP"",
""transactionDateTime"": ""2024-02-21T11:43:22.2079875""
}
}"
Pot Debit
The following illustrates the notification received when an amount is debited from a Pot.
Notification
"{
""eventId"": ""wh_71f5a5f7d15544a5a1e70b395e2d7980"",
""event"": ""account_debit"",
""data"": {
""objectId"": 661413,
""userId"": ""C00081866"",
""source"": ""account_internal_transfer"",
""origin"": ""Automatic Allocation"",
""amount"": -10,
""baseCcyCode"": ""GBP"",
""ccyCode"": ""GBP"",
""transactionDateTime"": ""2024-02-21T11:43:21.8642125""
}
}"
Updated 5 months ago