Hi Guys,
This is my first post so please be gentle.
I have searched the forums about this but I have had no look in finding an answer -- so here goes.
I have just installed the PayPal Express Checkout V1.0. on osCommerce v2.2rc2
I have created a sandbox Merchant account with Paypal to get my API username, API password and API signature.
I have gone to my website and put an item into my basket.
I have clicked on the PayPal Buy now button and (after creating a dummy account on my website) I have been taken to the PayPal website.
Now (as a customer not having an existing PayPal account) I enter a name, address (filling in both Address Line 1 and Address Line 2) and credit card information.
I then click the 'continue' button and I get returned to my checkout_confirmation.php page.
On the confirmation page it displays the Delivery Address and the Billing Address, but the information from Address Line 2 is missing. WHERE HAS IT GONE?
I have previously added the contribution (http://www.oscommerce.com/community/contributions,1855 for a second address line (because they're useful !) but I don't think that has any effect on this problem.
I have looked at the file in /osCommerce/ext/modules/payment/paypal/express.php where it handles the response from PayPal where around line 107 it has the following code:
$sendto = array('firstname' => substr($response_array['SHIPTONAME'], 0, strpos($response_array['SHIPTONAME'], ' ')),
'lastname' => substr($response_array['SHIPTONAME'], strpos($response_array['SHIPTONAME'], ' ')+1),
'company' => '',
'street_address' => $response_array['SHIPTOSTREET'],
'suburb' => '',
'postcode' => $response_array['SHIPTOZIP'],
'city' => $response_array['SHIPTOCITY'], etc etc
My thoughts were from looking at the above code is that PayPal is not returning the Second Line of the Address.
Now as I have the 'Second Address Line' Mod I thought I could hack this code a little to confirm that this code is doing what I thought it was, so I added
'street_address_2' => 'hacked second line',
and sure enough, the address shown on the checkout_confirmation page displays the string 'hacked second line' as the second line of the address. Also when I go to the admin pages I can see this 'hacked second line' is displayed in the customers delivery and billing addresses, just as I expected.
So to me it appears that PayPal is just NOT sending the second line of the address back.
SO IT's QUESTION TIME
I assume lots of you are using PayPal and some of you have tested it using a 2nd Address Line. So what were your results?
Did your 2nd Address Line get displayed on the checkout_confirmation page or was it missing?
Also does the 2nd Address Line show up on your admin pages?
I can only hope that I have broken something with my '2nd Address Line mods', but I really suspect this is a PayPal issue.
Does anybody know where I can find details about how PayPal puts the address together and posts it back to my website.
I have already looked around the PayPal developers website but it's a complete mess and extremely hard to find any useful info so a direct link would be very useful (to me and everybody else who's reading this!).
So let the responses flood in, (Thanks Dave)