Changelog
Version 2
- Removed
account.registered
Callback forOWNED
Accounts
Version 1
- First version of Accounts API
v1
Account Callback
Endpoint: Account Updated Webhook
POST https://yourcompany.com/xenplatform_webhook_url
The Account Updated webhook can be used to let your system know when your Accounts have been successfully registered and live payments enabled.
You will receive webhooks from the Create Account API at 2 points during the Account onboarding process.
For OWNED
accounts
account.registered
- When an Account has been registered Note: It is optional to handle this Webhook when creatingOWNED
Accounts using this endpoint. Transactions may be created forOWNED
immediately after we return the response.
For MANAGED
accounts
account.registered
- When an Account has been registeredaccount.activated
- When live payments has been enabled for your Account (i.e. activated)
You need to provide an URL to receive webhook. Please specify your URL in Webhook Settings in Xendit Dashboard.
The payment notification will be sent as POST request to the URL you set. Xendit attach x-callback-token
header that you can validate against Verification Token in Webhook Settings to verify message authenticity.
Please response back with status 200 immediately. Xendit marks webhook event as failed if there is no response within 30s. When events failed, automatic retry will kick-off for the next 24h. Alternatively, you can resend any event in Webhook tab at anytime. You can also receive notification via email every 6h to check your webhook health.
Learn more about Webhook.
Webhook Payload
Example Account Updated Webhook Request
{
"master_acc_business_id": "5olefb170a2b18519b1b4801",
"event_type": "account.registered",
"created": "2021-01-01T10:00:00Z",
"data": {
"user_id": "5cafeb170a2b18519b1b8761",
"account_info": {
"payments_enabled": true
}
}
}
curl https://yourcompany.com/xenplatform_webhook_url -X POST \
-u xnd_development_O46JfOtygef9kMNsK+ZPGT+ZZ9b3ooF4w3Dn+R1k+2fT/7GlCAN3jg==: \
-d master_acc_business_id="5olefb170a2b18519b1b4801" \
-d created="2019-01-01T10:51:44.484Z" \
-d event_type="account.registered" \
-d data[user_id]="57fb4e076fb3fa296b7f5a17" \
-d data[account_info][payments_enabled]=false \
<?php
$url = 'https://yourcompany.com/xenplatform_webhook_url';
$apiKey = 'xnd_development_O46JfOtygef9kMNsK+ZPGT+ZZ9b3ooF4w3Dn+R1k+2fT/7GlCAN3jg==:';
$headers = [];
$headers[] = 'Content-Type: application/json';
$data = [
'master_acc_business_id' => '5olefb170a2b18519b1b4801'
'created' => '2019-01-01T10:51:44.484Z',
'event_type' => 'account.registered',
'data' => [
'user_id' => '57fb4e076fb3fa296b7f5a17',
'account_info' => [
'payments_enabled' => false
]
]
];
$curl = curl_init();
$payload = json_encode($data);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
curl_setopt($curl, CURLOPT_USERPWD, $apiKey.":");
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $payload);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($curl);
echo $result;
Header Parameter | Type | Description |
---|---|---|
x-callback-tokenrequired |
string |
Your Xendit unique webhook token to verify the origin of the webhook |
webhook-idrequired |
string |
A unique identifier of every webhook to help you to handle double webhooks by implementing idempotency. When you receive the same webhook-id twice, treat the subsequent request as duplicate and reject the webhook accordingly to prevent double webhooks |
Body Parameter | Type | Description | ||||
---|---|---|---|---|---|---|
master_acc_business_id required |
string |
The business ID of your Platform account | ||||
event_type required |
string |
The type of event webhook that was sent Available values:
|
||||
created required |
string |
Indicates when the webhook was sent | ||||
data required |
object |
Contains metadata for the event type
|
Account Info Metadata Object Parameters
Parameter | Type | Description |
---|---|---|
payments_enabled required |
boolean |
Boolean value indicating whether payments has been enabled for the sub-account |