1. Go to this page and download the library: Download arthurnumen/veritrans-php 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/ */
arthurnumen / veritrans-php example snippets
Veritrans_Config::$serverKey = '<your server key>';
// Development Environment (the default)
Veritrans_Config::$isProduction = false;
// Production Environment
Veritrans_Config::$isProduction = true;
// Set sanitization off (default)
Veritrans_Config::$isSanitized = false;
// Set sanitization on
Veritrans_Config::$isSanitized = true;
$notif = new Veritrans_Notification();
$transaction = $notif->transaction_status;
$fraud = $notif->fraud_status;
error_log("Order ID $notif->order_id: "."transaction status = $transaction, fraud staus = $fraud");
if ($transaction == 'capture') {
if ($fraud == 'challenge') {
// TODO Set payment status in merchant's database to 'challenge'
}
else if ($fraud == 'accept') {
// TODO Set payment status in merchant's database to 'success'
}
}
else if ($transaction == 'cancel') {
if ($fraud == 'challenge') {
// TODO Set payment status in merchant's database to 'failure'
}
else if ($fraud == 'accept') {
// TODO Set payment status in merchant's database to 'failure'
}
}
else if ($transaction == 'deny') {
// TODO Set payment status in merchant's database to 'failure'
}
}