mardi 2 février 2016

How to fix PHP Call Undefined error message in custom payment wordpress plugin?

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: error message

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://ift.tt/1PzjUhK";
$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: bca sakuku payment option

And its weird because these plugin working like charm in localhost not in dev.galerigadget.com

How I can fix it?

Cheers



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire