
Originally Posted by
gbrennae
Thanks for posting the code.
I think I see your problem... Your $status and $transid are both getting the same $_POST['returncode'] value.
.................................................. ...............
If all fails, pm me your two files and I'll dig deeper for you. Again, I can only speculate without all the details.
Hi gbrennae,
I had just check with my payment provider....
They told me only ['returncode'] for "E2" is Unsuccessful, else all returning code is Successful.
So, I wrote it in this way...
Code:
<?php
# Required File Includes
include("../../../dbconnect.php");
include("../../../includes/functions.php");
include("../../../includes/gatewayfunctions.php");
include("../../../includes/invoicefunctions.php");
$gatewaymodule = "webcash"; # Enter your gateway module name here replacing template
$GATEWAY = getGatewayVariables($gatewaymodule);
if (!$GATEWAY["type"]) die("Module Not Activated"); # Checks gateway module is active before accepting callback
# Get Returned Variables - Adjust for Post Variable Names from your Gateway's Documentation
$status = $_POST["returncode"];
$invoiceid = $_POST["ord_mercref"];
$transid = $_POST["returncode"];
$amount = $_POST["ord_totalamt"];
$invoiceid = checkCbInvoiceID($invoiceid,$GATEWAY["name"]); # Checks invoice ID is a valid invoice number or ends processing
checkCbTransID($transid); # Checks transaction number isn't already in the database and ends processing if it does
if ($status=="E2") {
# Unsuccessful
logTransaction($GATEWAY["name"],$_POST,"Unsuccessful"); # Save to Gateway Log: name, data array, status
} else {
# Successful
addInvoicePayment($invoiceid,$transid,$amount,$gatewaymodule); # Apply Payment to Invoice: invoiceid, transactionid, amount paid, modulename
logTransaction($GATEWAY["name"],$_POST,"Successful"); # Save to Gateway Log: name, data array, status}
}
?>
But I ended up with Error 310 (net::ERR_TOO_MANY_REDIRECTS)