CillianByrne Posted November 25, 2011 Posted November 25, 2011 Hi there, I have a realex payment gateway set up on my site http://www.ecogoreyonline.com I am currently in testing mode. I have my normal "checkout_success.php" file which I use for COD orders and colections I have made another one called "checkout_success_realex.php" and I gave this URL to realex to whitelist for me This is the code in the realex success page: <html> <head> <title>Realex Payments realauth redirect sample php code</title> <? /* Pay and Shop Limited (Realex Payments) - Licence Agreement. © Copyright and zero Warranty Notice. Merchants and their internet, call centre, and wireless application developers (either in-house or externally appointed partners and commercial organisations) may access Realex Payments technical references, application programming interfaces (APIs) and other sample code and software ("Programs") either free of charge from www.realexpayments.com or by emailing [email protected]. Realex Payments provides the programs "as is" without any warranty of any kind, either expressed or implied, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose. The entire risk as to the quality and performance of the programs is with the merchant and/or the application development company involved. Should the programs prove defective, the merchant and/or the application development company assumes the cost of all necessary servicing, repair or correction. Copyright remains with Realex Payments, and as such any copyright notices in the code are not to be removed. The software is provided as sample code to assist internet, wireless and call center application development companies integrate with the payandshop.com service. Any Programs licensed by Realex Payments to merchants or developers are licensed on a non-exclusive basis solely for the purpose of availing of the Realex Payments service in accordance with the written instructions of an authorised representative ofRealex Payments. Any other use is strictly prohibited. -------------------------------------------------------------------- */ /* Note:The below code is used to grab the fields Realex Payments POSTs back to this script after a card has been authorised. Realex Payments need to know the full URL of this script in order to POST the data back to this script. Please inform Realex Payments of this URL if they do not have it already. Look at the Realex Documentation to view all hidden fields Realex POSTs back for a card transaction. */ $timestamp = $_POST['TIMESTAMP']; $result = $_POST['RESULT']; $orderid = $_POST['ORDER_ID']; $message = $_POST['MESSAGE']; $authcode = $_POST['AUTHCODE']; $pasref = $_POST['PASREF']; $realexmd5 = $_POST['MD5HASH']; // ------------------------------------------------------------- // Replace these with the values you receive from Realex Payments.If you have not yet received these values please contact us. $merchantid = "xxxxxxx"; $secret = "xxxxxxx"; //--------------------------------------------------------------- //Below is the code for creating the digital signature using the md5 algorithm. //This digital siganture should correspond to the //one Realex Payments POSTs back to this script and can therefore be used to verify the message Realex sends back. $tmp = "$timestamp.$merchantid.$orderid.$result.$message.$pasref.$authcode"; $md5hash = md5($tmp); $tmp = "$md5hash.$secret"; $md5hash = md5($tmp); //Check to see if hashes match or not if ($md5hash != $realexmd5) { echo "hashes don't match - response not authenticated!"; } /* -------------------------------------------------------------- send yourself an email or send the customer an email or update a database or whatever you want to do here. The next part is important to understand. The result field sent back to this response script will indicate whether the card transaction was successful or not. The result 00 indicates it was while anything else indicates it failed. Refer to the Realex Payments documentation to get a full list to response codes. IMPORTANT: Whatever this response script prints is grabbed by Realex Payments and placed in the template again. It is placed wherever the comment "<!--E-PAGE TABLE HERE-->" is in the template you provide. This is the case so that from a customer's perspective, they are not suddenly removed from a secure site to an unsecure site. This means that although we call this response script the customer is still on Realex PAyemnt's site and therefore it is recommended that a HTML link is printed in order to redirect the customrer back to the merchants site. */ ?> <body bgcolor="#FFFFFF"> <font face=verdana,helvetica,arial size=2> <? if ($result == "00") { ?> Thank you <br/><br/> To continue browsing please <a href="http://yourdomain.com"><b><u>click here</u></b></a> <br/><br/> <? } else { ?> <br/><br/> There was an error processing your subscription. To try again please <a href="http://yourdomain.com"><b><u>click here</u></b></a><br><BR> Please contact our customer care department at <a href="mailto:[email protected]"><b><u>[email protected]</u></b></a> or if you would prefer to subscribe by phone, call on 01 2839428349 NOTE: This link should bring the customer back to a place where an new orderid is created so that they can try to use another card. It is important that a new orderid is created because if the same orderid is sent in a second time Realex Payments will reject it as a duplicate order even if the first transaction was declined. <? } ?> </font> </body> </html> When I put through an order , realex authenticate it ok but OScommerce does not receive the order, it does not show up in the admin section and i do not get any emails. could someone please tell me what code I need to put into this file to send the order to oscommerce? and where do i need to put it? thanks cillian
♥Monika in Germany Posted November 28, 2011 Posted November 28, 2011 hi there, did you create this payment module yourself? a payment module needs to either redirect to the store's checkout_process.php file to insert data into your database, or have it's own database processing section in the payment modules file. :-) Monika addicted to writing code ... can't get enough of databases either, LOL! my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum Interactive Media Award July 2007 ~ category E-Commerce my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.