“order lost” in X-Cart in return section of payment module
-
21-04-2021 - |
Question
I wrote a payment module for X-Cart.
My return url section is:
require './auth.php';
if (!func_is_active_payment('cc_mellat.php'))
exit;
$rescode=$_POST['ResCode'];
$RefID=$_POST['RefId'];
$saleOrderId=$_POST['saleOrderId'];
$SaleReferenceId=$_POST['SaleReferenceId'];
$tmp = func_query_first("SELECT sessionid,param1 FROM $sql_tbl[cc_pp3_data] WHERE ref='".$saleOrderId."'");
$bill_output['sessid'] = $tmp['sessionid'];
$bill_output['billmes']="RefId:".$RefId." - ResCode: ".$rescode." - SaleReferenceId:".$SaleReferenceId;
// Approved
if ($rescode == 0 && $is_md5) {
$bill_output['code'] = 1;
// Declined
} else {
echo "Error: ".$rescode;
$bill_output['code'] = 2;
}
var_dump($bill_output);
require($xcart_dir.'/payment/payment_ccend.php');
but after payment X-Cart says:
Order declined.
Review your data or contact the store administrator.
Reason: Error: Your order was lost
What is the problem?
Solution
It seems you use undefined variable $is_md5 here:
if ($rescode == 0 && $is_md5) {
OTHER TIPS
See my post here. It fails due to a SQL error because the name of the xcart_cc_pp3_data
field is sessid
not sessionid
.
Switch to the correct field name, and your order will be found. (I had the same order not found
error until I found & fixed the SQL.)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow