Jump to content

Callback set for paymentsuccess=true invoice, but not redirecting to cart.php?a=complete


sonuyos

Recommended Posts

 

Hello,

So i have a gateway, which does not have traditional successurl, instead it got successurl and failurl as the callback, which is weird, but i think just laziness on developers part.

 

Now i want to integrate paymentsuccess=true so that it can be redirected from invoice to cart.php?a=complete, but it just doesnt redirect for new orders, the page calls back to invoice, but doesnt redirect complete page.

This is the original code of the callback file

if($response['status']=='success') {
    	# Successful
    
	    addInvoicePayment($invoiceid, $transid, "", $fees, $gatewaymodule); # Apply Payment to Invoice: invoiceid, transactionid, amount paid, fees, modulename
    	update_query("tblinvoices",array("notes"=>"PayUmoney"),array("id"=>$invoiceid));
		logTransaction($GATEWAY["name"],$response,"Successful"); # Save to Gateway Log: name, data array, status

	} else {
		# Unsuccessful
	    logTransaction($GATEWAY["name"],$response,"Unsuccessful"); # Save to Gateway Log: name, data array, status

	}
}

I edited it to the following.

if($response['status']=='success') {
    	# Successful
    
	    addInvoicePayment($invoiceid, $transid, "", $fees, $gatewaymodule); # Apply Payment to Invoice: invoiceid, transactionid, amount paid, fees, modulename
    	update_query("tblinvoices",array("notes"=>"PayUmoney"),array("id"=>$invoiceid));
		logTransaction($GATEWAY["name"],$response,"Successful"); # Save to Gateway Log: name, data array, status
	    $filename = $GATEWAY['systemurl'].'/viewinvoice.php?id='.$invoiceid.'&paymentsuccess=true';    // path of your viewinvoice.php

	} else {
		# Unsuccessful
	    logTransaction($GATEWAY["name"],$response,"Unsuccessful"); # Save to Gateway Log: name, data array, status
        $filename = $GATEWAY['systemurl'].'/viewinvoice.php?id='.$invoiceid.'&paymentfailed=true';    // path of your viewinvoice.php

	}
}
HEADER("location:$filename");

Added these lines

	    $filename = $GATEWAY['systemurl'].'/viewinvoice.php?id='.$invoiceid.'&paymentsuccess=true';    // path of your viewinvoice.php
	    $filename = $GATEWAY['systemurl'].'/viewinvoice.php?id='.$invoiceid.'&paymentfailed=true';    // path of your viewinvoice.php

What am i doing wrong?? what should be the correct code?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated