Dragen Posted May 30, 2007 Share Posted May 30, 2007 Hi, I'm trying to create a payment process which uses paypal. Accessing the paypal page and sending correct data to it is easy enough, but is there a way that I can send the data to paypal and do the transaction without displaying the paypal page? Perhaps the user enters their credit card details or their paypal username and password etc and it sends it through to paypal and carry out the transaction without the customer seeing the paypal page? This isn't so that the user doesn't realise that paypal is being used as I will make it clear that paypal is the payment provider, but because I need some flexibility of what I can do for the payment process by sending multiple payments, one after the other to different accounts. I don't want the customer to have to enter their details and click submit four or five times for each transaction. Instead I just want my script to do it for them. I hope that made some sense.. thanks Quote Link to comment https://forums.phpfreaks.com/topic/53560-pay-through-paypal-without-using-the-default-paypal-page/ Share on other sites More sharing options...
chigley Posted May 30, 2007 Share Posted May 30, 2007 cURL. Not very difficult, I've done similar stuff in the past. Quote Link to comment https://forums.phpfreaks.com/topic/53560-pay-through-paypal-without-using-the-default-paypal-page/#findComment-264700 Share on other sites More sharing options...
Dragen Posted May 30, 2007 Author Share Posted May 30, 2007 thanks. curl seemed to be more for retrieving information from another site, not sending it to a site. Quote Link to comment https://forums.phpfreaks.com/topic/53560-pay-through-paypal-without-using-the-default-paypal-page/#findComment-264704 Share on other sites More sharing options...
chigley Posted May 30, 2007 Share Posted May 30, 2007 No cURL has POST features so you can do logins, and send credit card details to the PayPal form fairly easily. Quote Link to comment https://forums.phpfreaks.com/topic/53560-pay-through-paypal-without-using-the-default-paypal-page/#findComment-264707 Share on other sites More sharing options...
Dragen Posted May 30, 2007 Author Share Posted May 30, 2007 ah yes.. I've found it now: CURLOPT_POST would something like this work? <?php // create a new cURL resource $ch = curl_init(); // set URL and other appropriate options curl_setopt($ch, CURLOPT_URL, "https://secure.paypal.com/cgi-bin/webscr"); curl_setopt($ch, CURLOPT_POST, $myvariable1); curl_setopt($ch, CURLOPT_POST, $myvariable2); curl_setopt($ch, CURLOPT_POST, $myvariable3); // grab URL and pass it to the browser curl_exec($ch); // close cURL resource, and free up system resources curl_close($ch); ?> Quote Link to comment https://forums.phpfreaks.com/topic/53560-pay-through-paypal-without-using-the-default-paypal-page/#findComment-264723 Share on other sites More sharing options...
redarrow Posted May 30, 2007 Share Posted May 30, 2007 Hi there mate I worked along side a php programmer that was the one that (he recons) implemented the paypal system for the paypal service for the php code and I got right into it had a bull. we both done statistics if users would use a website on it own using the paypal form on the service providers server or was it best to let users go to paypal and use the default form that paypal provided. we set up a selling website to sell books that xxxxsxx provided and then studed the sales from a service using the form on the site and a payment was sent directly to paypal without any forms or images from paypal. We also used another website with the same books and used the paypal default page. This was only a test run and the site was advertised on xxxx main page. the sales for the website using paypal with no default page was 3 in 10 sales the sales for the website using paypal default page was 9 in 10 we also done a survey on the sites and most users using the website that had no default paypal page thort the site was a scam. Very interesting stuff. Look up ipn php paypal ok. Quote Link to comment https://forums.phpfreaks.com/topic/53560-pay-through-paypal-without-using-the-default-paypal-page/#findComment-264724 Share on other sites More sharing options...
chigley Posted May 30, 2007 Share Posted May 30, 2007 You send all the POST variables in one go: <?php curl_setopt($ch, CURLOPT_POST, "fieldname1=value1&fieldname2=value2"); ?> Quote Link to comment https://forums.phpfreaks.com/topic/53560-pay-through-paypal-without-using-the-default-paypal-page/#findComment-264726 Share on other sites More sharing options...
Dragen Posted May 30, 2007 Author Share Posted May 30, 2007 thanks for that advice redarrow. I just think that forcing the customer to input there details four or five times would put them off a bit. I also need the prices to charge them to be different each time, which I don't think I can do using the default page, without them entering there details, going through the payment process, clicking submit, then doing all over again. Chigley.. wouldn't I only do it all at once if I'm using $_GET? and even then I think from looking at it that get variables should simply be added to the end of the url in CURLOPT_URL. Quote Link to comment https://forums.phpfreaks.com/topic/53560-pay-through-paypal-without-using-the-default-paypal-page/#findComment-264749 Share on other sites More sharing options...
chigley Posted May 30, 2007 Share Posted May 30, 2007 You define POST variables just like you would in a GET based URL with cURL. Quote Link to comment https://forums.phpfreaks.com/topic/53560-pay-through-paypal-without-using-the-default-paypal-page/#findComment-264752 Share on other sites More sharing options...
Dragen Posted May 30, 2007 Author Share Posted May 30, 2007 okay. thanks. Quote Link to comment https://forums.phpfreaks.com/topic/53560-pay-through-paypal-without-using-the-default-paypal-page/#findComment-264754 Share on other sites More sharing options...
Dragen Posted June 5, 2007 Author Share Posted June 5, 2007 Hi, been a while since I've said anything about this because I've been waiting for my sandbox account to activate.. paypal were having problems with it. I've set up a form which sends the bussiness name for the correct merchant so it knows who to pay the money to and also the amount and shipping cost. It includes the currency, payment cancelation page and completion page etc. What I'm wanting to do is have a foreach statement to send the data to paypal. So my customer enters their username and password into the form and then it sends them to paypal. I've written the foreach statement and believe I've the the curl part right. The problem I've got is using curl it tries to open the paypal page. What I'm wanting is for the script to access paypal, behind the scenes as it were, and carrying through the process and foreach process it completes it echoes to the customer: payment for MERCHANT NAME complete. charge: AMOUNT Here's my code: echo 'Your payment is being processed'; foreach($_SESSION['manufacturer'] as $key => $value){ // create a new cURL resource $ch = curl_init(); // set URL and other appropriate options curl_setopt($ch, CURLOPT_URL, "https://www.sandbox.paypal.com/cgi-bin/webscr"); curl_setopt($ch, CURLOPT_POST, 'cmd=_xclick&business=' . $_SESSION['paypalid_user'][$key] . '&item_name=' . STORE_NAME . ' (' . $value . ')&amount=' . $_SESSION['price'][$key] . '&shipping=' . $_SESSION['shipcost'] . 'currency_code=' . $my_currency . '&return=' . tep_href_link(FILENAME_PAYPALMULTIBANK, '', 'SSL') . '&cancel_return=' . tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL')); // grab URL and pass it to the browser curl_exec($ch); // close cURL resource, and free up system resources curl_close($ch); echo 'payment for: ' . $value . ' complete.'; echo 'charge: ' . $my_currency . $_SESSION['price'][$key]; } can anyone tell me if it's possible to do this either behind the scenes so the user just submits the form on my page and the foreach takes places or perhaps opens it in a new window and carries it out, without the customer having to submit multiple times. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/53560-pay-through-paypal-without-using-the-default-paypal-page/#findComment-268442 Share on other sites More sharing options...
Dragen Posted June 5, 2007 Author Share Posted June 5, 2007 anyone? Quote Link to comment https://forums.phpfreaks.com/topic/53560-pay-through-paypal-without-using-the-default-paypal-page/#findComment-268698 Share on other sites More sharing options...
Dragen Posted June 5, 2007 Author Share Posted June 5, 2007 ? Quote Link to comment https://forums.phpfreaks.com/topic/53560-pay-through-paypal-without-using-the-default-paypal-page/#findComment-268801 Share on other sites More sharing options...
Dragen Posted June 6, 2007 Author Share Posted June 6, 2007 can anyone help me with this? I'm trying to get my online store up and running and I just need to sort this bit out.. thanks Quote Link to comment https://forums.phpfreaks.com/topic/53560-pay-through-paypal-without-using-the-default-paypal-page/#findComment-269096 Share on other sites More sharing options...
Dragen Posted June 6, 2007 Author Share Posted June 6, 2007 Hello? Quote Link to comment https://forums.phpfreaks.com/topic/53560-pay-through-paypal-without-using-the-default-paypal-page/#findComment-269553 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.