Passing Payment details to PayPal

This forum is dedicated to discussions about shopping carts/ecommerce.
Forum rules
PLEASE READ THE FORUM RULES BEFORE YOU POST:
viewtopic.php?f=12&t=1901
Post Reply
SteveHale
 
 
Posts: 26
Joined: Sat Dec 01, 2007 4:29 pm
Location: Farnham, Surrey. UK
Contact:

Passing Payment details to PayPal

Post by SteveHale » Mon Dec 27, 2010 4:12 pm

Having built a shopping cart and having it work correct to go through to PayPal how do I automatically get the customer name and address details to be parsed through to PayPal and pre-fill the fields on the PayPal site?

Many web sites do this and also Naval Design's Cart Pro does also.

Also I would like to have the option at PayPal for the user to decide to cancel their payment and return to the web site. Does anyone know how this is done?

CHeers

Steve B

User avatar
Navaldesign
 
 
Posts: 1051
Joined: Sat Mar 01, 2008 8:08 pm
Location: Italy
Contact:

Re: Passing Payment details to PayPal

Post by Navaldesign » Mon Dec 27, 2010 8:38 pm

Add these lines among the others in the PayPal button code:


<input type="hidden" name="cancel_return" value="'http://www.yourdomain.com/cancelpage.php">
<input type="hidden" name="first_name" value="'.$_SESSION['firstname'].'">
<input type="hidden" name="last_name" value="'.$_SESSION['lastname'].'">
<input type="hidden" name="address1" value="'.$_SESSION['address'].'">
<input type="hidden" name="city" value="'.$_SESSION['city'].'">
<input type="hidden" name="state" value="'.$_SESSION['state'].'">
<input type="hidden" name="zip" value="'.$_SESSION['zip'].'">
<input type="hidden" name="email" value="'.$_SESSION['email'].'">

Replace 'http://www.yourdomain.com/cancelpage.php with the actual URL of your cancellation page.
www.dbtechnosystems.com

SteveHale
 
 
Posts: 26
Joined: Sat Dec 01, 2007 4:29 pm
Location: Farnham, Surrey. UK
Contact:

Re: Passing Payment details to PayPal

Post by SteveHale » Tue Dec 28, 2010 2:06 pm

Hi George

I presumed that you meant this code to go into the HTML object on the "thankyou" page, the HTML object with the PayPal button location etc. in the last line?

I put your code after this line:-

<input type="hidden" name="no_note" value="'.$allow_message.'">

And before the line that has the "PayNow" button source.

I then published the page and I get this error after clicking on the Order Now button on the checkout.php page:-

Parse error: syntax error, unexpected T_STRING in /home/a27flsu/public_html/thankyou.php on line 518

Any ideas?

Cheers

SteveB

SteveHale
 
 
Posts: 26
Joined: Sat Dec 01, 2007 4:29 pm
Location: Farnham, Surrey. UK
Contact:

Re: Passing Payment details to PayPal

Post by SteveHale » Tue Dec 28, 2010 2:12 pm

Hi George

Cracked it......

In your code you had one too many ' in this line:-

<input type="hidden" name="cancel_return" value="'http://www.yourdomain.com/cancelpage.php">

Notice how after value= you have "' then the domain name etc. I remove the extra quote : '

The only problem I have now is that if I cancel the transaction in PayPal the code takes me to the cancel.php (www.flsuk.co.uk/cancel.php) page but the cart is not emptied.

Any ideas why this might be?

Cheers

SteveB

User avatar
Navaldesign
 
 
Posts: 1051
Joined: Sat Mar 01, 2008 8:08 pm
Location: Italy
Contact:

Re: Passing Payment details to PayPal

Post by Navaldesign » Tue Dec 28, 2010 10:12 pm

Sorry, my mistake.

Here's the code again:



echo '<input type="hidden" name="first_name" value="'.$_SESSION['firstname'].'">';
echo '<input type="hidden" name="last_name" value="'.$_SESSION['lastname'].'">';
echo '<input type="hidden" name="address1" value="'.$_SESSION['address'].'">';
echo '<input type="hidden" name="city" value="'.$_SESSION['city'].'">';
echo '<input type="hidden" name="state" value="'.$_SESSION['state'].'">';
echo '<input type="hidden" name="zip" value="'.$_SESSION['zip'].'">';
echo '<input type="hidden" name="email" value="'.$_SESSION['email'].'">';
www.dbtechnosystems.com

SteveHale
 
 
Posts: 26
Joined: Sat Dec 01, 2007 4:29 pm
Location: Farnham, Surrey. UK
Contact:

Re: Passing Payment details to PayPal

Post by SteveHale » Wed Dec 29, 2010 12:42 pm

It's OK. Thanks.....

I fixed it.

CHeers

Steve

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest