PHP code example of yorts / xendit

1. Go to this page and download the library: Download yorts/xendit library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

yorts / xendit example snippets



  orts\Xendit\XenditPayout;
  $client = new XenditPayout('{YOUR_API_KEY}');

  $params = [
    'reference_id' => 'your reference id',
    'channel_code' => 'channel code you want',
    'channel_properties' => [
        'account_holder_name' => 'your holder name',
        'account_number' => 'your account number',
    ],
    'amount' => (float)$request->amount,
    'currency' => 'your currency',
    'description' => 'Description you want',
    "receipt_notification": {          //receipt_notification is optional
          "email_to": [
              "[email protected]"
          ],
          "email_cc": [
              "[email protected]"
          ]
    },
    "metadata": {                      //meta data is optional
         "lotto_outlet": 'your outlet' 
      }
    ];

    dd($client->createPayout($params));

    $reference_id = 'sample-payout-123';
    // will return all payout based on your reference id
    dd($client->getPayoutReferenceId($reference_id));

    $id = 'disb-48ee0751-abb3-4df5-85c7-24bcd3fabdec';
    // will return all payout based on xendit transaction id
    dd($client->getPayoutId($id));