Jump to content

Welcome to Geeks to Go - Register now for FREE

Need help with your computer or device? Want to learn new tech skills? You're in the right place!
Geeks to Go is a friendly community of tech experts who can solve any problem you have. Just create a free account and post your question. Our volunteers will reply quickly and guide you through the steps. Don't let tech troubles stop you. Join Geeks to Go now and get the support you need!

How it Works Create Account
Photo

Setting up a payment provider


  • Please log in to reply

#1
Crustyoldbloke

Crustyoldbloke

    Old Malware Surgeon with a shaky scalpel

  • Retired Staff
  • 15,131 posts
I am trying to get a website, ecommerce payment provider working efficiently within a template designed for customising (does that make sense so far?)

There are two files, "customppsend.php" and "customppreturn.php"

The problem exists, I believe, in the latter as the customer completes checkout OK, and pays for goods with the payment provider, but for some reason, they are returned to the store at the "Thanks.php" page, which then gives an error message and does NOT empty the cart.

This is the content of the customppreturn.php file:
<?php// This is an example of how you would go about setting up a custom payment // provider for the ACME Plus template range. More information can be found// at [url=http://www.ACMEXYZ.com[/url]// Here we have used the 2Checkout.com system as an example of how a common payment// processor works. You can edit this file to match the details of your particular payment system// Payment systems will normally pass back 3 different pieces of information. One will be the order// id that we sent with the transaction. The second will be the authorization code and sometimes a// variable will be passed back indicating the success of the transaction. You can use these to// check that the order did indeed come from the payment system you are implementing$theorderid=unstripslashes(trim(@$_POST['cart_order_id']));$theauthcode=unstripslashes(trim(@$_POST['order_number']));$thesuccess=unstripslashes(trim(@$_POST['credit_card_processed']));if($theorderid != '' && $theauthcode != '' && $thesuccess=='Y'){	// You should not normally need to change the code below	$sSQL="UPDATE cart SET cartCompleted=1 WHERE cartOrderID='" . mysql_escape_string($theorderid) . "'";	mysql_query($sSQL) or print(mysql_error());	$sSQL="UPDATE orders SET ordStatus=3,ordAuthNumber='" . mysql_escape_string($theauthcode) . "' WHERE ordPayProvider=14 AND ordID=" . mysql_escape_string($theorderid);	mysql_query($sSQL) or print(mysql_error());	order_success($theorderid,$emailAddr,$sendEmail);}else{	// Make sure you leave this condition here. It calls a failure routine if no match is found for any payment system.	order_failed();}?>

Can anyone see anything wrong with the code in the file? or possibly shed some light on why the problem may exist.

Thanks

Edited by Crustyoldbloke, 25 May 2010 - 09:03 AM.

  • 0

Advertisements


#2
Father0fNine

Father0fNine

    Member

  • Member
  • PipPip
  • 29 posts
The problem is likely in the
order_success($theorderid,$emailAddr,$sendEmail)
function. Nothing in the code snippet you provided produces any sort of HTML. It might also be helpful to have the information from the page that calls this PHP script.
  • 0

#3
Crustyoldbloke

Crustyoldbloke

    Old Malware Surgeon with a shaky scalpel

  • Topic Starter
  • Retired Staff
  • 15,131 posts
Hi FatherOfNine

Yes, that is exactly what I was thinking up until this morning when a developer found the problem to be just 3 letters, they were BER with the prefix num.

This was the problem line:
$theauthcode=unstripslashes(trim(@$_POST['order_number']));

and this is the new version which works very well so far:
$theauthcode=unstripslashes(trim(@$_POST['order_num']));

I must admit I was getting close to the problem, but not seeing it from the payment provider's end, I wasn't aware that they provided an order number different to the order ID (also an order number) generated by my site, but it makes perfect sense now, because why would you want the same piece of information twice?

Thanks for reading.
  • 0






Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP