1. Go to this page and download the library: Download khidirdotid/xendit-laravel 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/ */
public function xenditIpn(Request $request)
{
try {
$response = \Xendit::getInvoiceById($request->invoice_id);
if (in_array(strtolower($response['status']), ['paid', 'settled'])) {
// TODO: Set payment status in merchant's database to 'success'
}
} catch (\Throwable $th) {
throw $th;
}
}