darth_D Posted July 11, 2016 Share Posted July 11, 2016 Hi I am pretty new to PrestaShop and some of its features. I wanted to know if it was possible to POST order data to a URL when the order is validated (Payment method is clicked in one page checkout and user is taken to Paypal page) And also if returned paypal data (purchase information) can be POSTed to the same URL when payment is complete and user is redirected back to shopping site? I found information online about coding hooks but it wasn't very clear on its implementation. Any help given is highly appreciated. Thanks Link to comment Share on other sites More sharing options...
vekia Posted July 11, 2016 Share Posted July 11, 2016 by default it is not possible - you have to apply changes to payment module that you use (in this case paypal) you can send POST with cURL, example below $url = 'http://domain.com/get-post.php';$fields = array( 'lname' => urlencode($_POST['last_name']), 'fname' => urlencode($_POST['first_name']), 'title' => urlencode($_POST['title']), 'company' => urlencode($_POST['institution']), 'age' => urlencode($_POST['age']), 'email' => urlencode($_POST['email']), 'phone' => urlencode($_POST['phone']));//url-ify the data for the POSTforeach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }rtrim($fields_string, '&');//open connection$ch = curl_init();//set the url, number of POST vars, POST datacurl_setopt($ch,CURLOPT_URL, $url);curl_setopt($ch,CURLOPT_POST, count($fields));curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string);//execute post$result = curl_exec($ch);//close connectioncurl_close($ch); Link to comment Share on other sites More sharing options...
darth_D Posted July 11, 2016 Author Share Posted July 11, 2016 Thanks. I am using the paypal USA module. Its validation.php page seems the best option as it posts a curl to the paypal (in this case paypal sandbox) page. Unfortunately it looks like the order information it sends is limited to the product purchased. I was interested in posting both product and delivery information to the URL. Is that possible? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now