Using Disbursements

Use the Create Disbursements API to send funds from your account balance to your designated recipient bank or e-wallet account.

We have prefilled the below request with a sample API key. You should use your secret key which can be generated on your Dashboard.

<?php
     require 'vendor/autoload.php';
     $options['secret_api_key'] = 'xnd_development_O46JfOtygef9kMNsK+ZPGT+ZZ9b3ooF4w3Dn+R1k+2fT/7GlCAN3jg==';
     $xenditPHPClient = new XenditClient\XenditPHPClient($options);
     $external_id = 'demo_1475459775872';
     $amount = 17000;
     $bank_code = 'BCA';
     $account_holder_name = 'Bob Jones';
     $account_number = '1231241231';
     $response = $xenditPHPClient->createDisbursement($external_id, $amount, $bank_code, $account_holder_name, $account_number);        print_r($response);
?>

Once your call hits our servers, we return a response. Assuming the inputs are all valid, we will return a disbursement with a “PENDING” status. This means that we are processing the disbursement. If you get errors, please refer to our Errors section to understand why.

{
   "id":"57f1ca56bb1a631a65eee65e",
   "updated":"2016-10-03T03:02:46.239Z",
   "created":"2016-10-03T03:02:46.239Z",
   "user_id":"57b4e5181473eeb61c11f9b9",
   "external_id":"demo_1475459775872",
   "amount":17000,
   "bank_code":"BCA",
   "account_holder_name":"Bob Jones",
   "disbursement_description":"Reimbursement for shoes",
   "status":"PENDING"
}

The disbursement status can be tracked using a callback. When the disbursement has been successfully completed or failed, you’ll receive a callback.

{
"status":"COMPLETED",
"user_id":"57b4e5181473eeb61c11f9b9",
"external_id":"demo_1475459775872",
"amount":17000,
"bank_code":"BCA",
"account_holder_name":"acc holder name",
"disbursement_description":"Bob Jones",
"created":"2016-10-03T03:02:46.239Z",
"updated":"2016-10-03T03:02:47.239Z",
"is_instant":true,
"id":"57f1ca56bb1a631a65eee65e"
}

If the disbursement fails for any reason, the bank will refund the money and we will refund this to your account. If the disbursement cannot be completed, the status of the disbursement will be “FAILED”. The “failure_code” property indicates why.

Last Updated on 2023-05-24