Trying to convert my Hosted Payment page over to the Preload method. Using Curl to send the request in PHP on the Development URL, .
the response I get is
Source: - POST-esplusqa.moneris.com.
I was expecting an Error code or XML to parse. Any idea what the problem is?
I found mpgClasses on GitHub, but is this used for Preload? Do you have any PHP code utilizing Curl for the Preload request? The API on the developer's site show how to do the HTTP Post once you have the ticket, but I can't find any examples to make the Curl Request in PHP. I looked at similar questions, but you always send the example code, but never post it! I am in the USA. Please help, been struggling for a week to locate an example or find out what is wrong.
In reply to sheron:
In reply to RR_Moneris:
In reply to ATU1:
In reply to Coho:
Hi! Hope you can help me, Output: Raw Response : hpp1533957646V2hT8qLdQsDne90A7 mhp18221232046p09 1 Data received : Ticket : hpp1533957646V2hT8qLdQsDne90A7Order ID : mhp18221232046p09Response Code : 1OK: Data successfully loaded - when click to proceed to secure page button is clicked, output is: "Unable to proceed with transaction. Your card has not been charged. Please try again." -code below copied form sheron- <?php //Setup data to send to Moneris$ps_store_id = "Our store id";$hpp_key = "our hpp key";$charge_total = "amount"; $url ="esqa.moneris.com/.../index.php"; //QA Url$dataToSend = "ps_store_id=$store_id&hpp_key=$hpp_key&charge_total=$charge_total&hpp_preload="; //send transaction to Moneris via an HTTPS Post using php Curl$ch = curl_init();curl_setopt($ch, CURLOPT_URL, $url);curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);curl_setopt($ch, CURLOPT_HEADER, 0);curl_setopt($ch, CURLOPT_POST, 1);curl_setopt($ch, CURLOPT_POSTFIELDS, $dataToSend);curl_setopt($ch, CURLOPT_TIMEOUT, $gArray['CLIENT_TIMEOUT']);curl_setopt($ch, CURLOPT_USERAGENT, $gArray['API_VERSION']);curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); $response = curl_exec($ch); curl_close($ch); //verify that a response was received from Monerisecho "Raw Response : " . $response . "<br/>"; if(!$response){$response="Error preloading page";}else{// parse the XML response$xmlString = new SimpleXMLElement($response); $ticket = $xmlString -> ticket;$order_id = $xmlString -> order_id;$response_code = $xmlString -> response_code; echo "Data received : <BR/>";echo "Ticket : " . $ticket . "<br/>";echo "Order ID : " . $order_id . "<br/>";echo "Response Code : " . $response_code . "<br/>"; if($response_code <50){echo "OK: Data successfully loaded <BR/> <br/>";echo'<FORM METHOD="POST" ACTION="esqa.moneris.com/.../index.php">';echo'<INPUT TYPE="HIDDEN" NAME="hpp_id" VALUE="'.$store_id.'">';echo'<INPUT TYPE="hidden" NAME="hpp_preload" >';echo'<INPUT TYPE="hidden" NAME="ticket" VALUE="'.$ticket.'">';echo'<INPUT TYPE="SUBMIT" NAME="SUBMIT" VALUE="Click to proceed to Secure Page">';echo'</FORM>';}else{echo "Error: Data was not successfully loaded <br>";} } ?> --------------------- Error Log File: [12-Aug-2018 15:57:23 UTC] PHP Notice: Undefined variable: store_id in /home/luvcnd2013/public_html/payment/preload.php on line 9[12-Aug-2018 15:57:23 UTC] PHP Notice: Undefined variable: gArray in /home/luvcnd2013/public_html/payment/preload.php on line 18[12-Aug-2018 15:57:23 UTC] PHP Notice: Undefined variable: gArray in /home/luvcnd2013/public_html/payment/preload.php on line 19[12-Aug-2018 15:57:24 UTC] PHP Notice: Undefined variable: store_id in /home/luvcnd2013/public_html/payment/preload.php on line 51
In reply to flashroiem:
client is send to a customer information page with the following texfields below: First Name: Last Name: Address: City: Province: Postal: Email: Phone:
then after filling up required fields, when client click to pay button, it will be redirected to preload.php