I am making a custom payment wordpress plugin for my local bank. When processing payment I've got error messages such as "Notice Undefined index:....... on line 4" like screenshot below:
index.php script from screenshot above
<?php
ini_set('display_errors',1); error_reporting(E_ALL);
$data = array(
'MerchantID' => $_POST['MerchantID'],
'TransactionID' => $_POST['TransactionID'],
'RequestDate' => $_POST['RequestDate'],
'Amount' => $_POST['Amount'],
'CurrencyCode' =>$_POST['CurrencyCode'],
'Tax' => $_POST['Tax'],
'Signature' => $_POST['Signature'],
'Description' =>$_POST['Description'],
'CallbackURL' => $_POST['CallbackURL'],
'UserSession' => $_POST['UserSession'],
'TransactionNote' => $_POST['TransactionNote']
);
$url_send ="http://simpg.sprintasia.net:8779/bcasakuku/bak/InquiryProc";
$str_data = json_encode($data);
function sendPostData($url, $post){
$ch = curl_init($url);
$curl_header = array('Accept: application/json', 'Content-Type: application/json');
curl_setopt($ch, CURLOPT_HTTPHEADER, $curl_header);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS,$post);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$result = curl_exec($ch);
curl_close($ch); // Seems like good practice
return $result;
}
echo " " . sendPostData($url_send, $str_data);
?>
For detail please try this product and using BCA sakuku as payment option like screenshot below:
And its weird because these plugin working like charm in localhost not in dev.galerigadget.com
How I can fix it?
Cheers
UPDATED FEB 02 2016
Its new script index.php based on another question but still not luck
<?php
ini_set('display_errors',1); error_reporting(E_ALL);
//Checking to fix error
$MerchantID = $_POST['MerchantID'];
if (!isset($MerchantID)) $MerchantID = '';
$TransactionID = $_POST['TransactionID'];
if (!isset($TransactionID)) $TransactionID = '';
$RequestDate = $_POST['RequestDate'];
if (!isset($RequestDate)) $RequestDate = '';
$Amount = $_POST['Amount'];
if (!isset($Amount)) $Amount = '';
$CurrencyCode = $_POST['CurrencyCode'];
if (!isset($CurrencyCode)) $CurrencyCode = '';
$Tax = $_POST['Tax'];
if (!isset($Tax)) $Tax = '';
$Signature = $_POST['Signature'];
if (!isset($Signature)) $Signature = '';
$Description = $_POST['Description'];
if (!isset($Description)) $Description = '';
$CallbackURL = $_POST['CallbackURL'];
if (!isset($CallbackURL)) $CallbackURL = '';
$UserSession = $_POST['UserSession'];
if (!isset($UserSession)) $UserSession = '';
$TransactionNote = $_POST['TransactionNote'];
if (!isset($TransactionNote)) $TransactionNote = '';
$data = array(
'MerchantID' => $MerchantID,
'TransactionID' => $TransactionID,
'RequestDate' => $RequestDate,
'Amount' => $Amount,
'CurrencyCode' => $CurrencyCode,
'Tax' => $Tax,
'Signature' => $Signature,
'Description' => $Description,
'CallbackURL' => $CallbackURL,
'UserSession' => $UserSession,
'TransactionNote' => $TransactionNote,
);
$url_send ="http://simpg.sprintasia.net:8779/bcasakuku/bak/InquiryProc";
$str_data = json_encode($data);
function sendPostData($url, $post){
$ch = curl_init($url);
$curl_header = array('Accept: application/json', 'Content-Type: application/json');
curl_setopt($ch, CURLOPT_HTTPHEADER, $curl_header);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS,$post);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$result = curl_exec($ch);
curl_close($ch); // Seems like good practice
return $result;
}
echo " " . sendPostData($url_send, $str_data);
?>