Zen Cart Logo
Forums / Built-in Shipping and Payment Modules / PayPal module send wrong phone number

PayPal module send wrong phone number

Locked

Views: 5,151

Results 1 to 11 of 11
This thread is locked. New replies are disabled.
1 Sep 2006, 2:12 AM
#1
ptalindstrom avatar

ptalindstrom

New Zenner

Join Date:
Aug 2006
Posts:
13
Plugin Contributions:
0

PayPal module send wrong phone number

Not sure why i can't find a post about this - but i seem to have fixed my own problem so i figured i would document it.

  • e.g. phone number entered for my Zencart user: 123-456-7890

  • zencart'; paypal.php seems to split this into:
    day_phone_a, b, c as 123, 456, and 7890 respectively

  • when info gets passed over to paypal it seems to only pick up day_phone_b or 456 in my example.

  • i think that PayPal API is expecting a variable named H_PhoneNumber - which if i add to paypal.php as the concatenation (and adding "-") of the 3 partial bits - it seems to work correctly

so in other words:

  • in paypal.php i set H_PhoneNumber = day_phone_a + "-" + day_phone_b + "-" + day_phone_c

OR

123-456-7890 in my example

and this seems to pass correctly.

Again not sure why i couldnt find post about this????

cheers,

1 Sep 2006, 5:20 AM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: PayPal module send wrong phone number

I'm not sure where you're getting your information from.

I see no reference to "H_PhoneNumber" in any of PayPal's documentation.

Again not sure why i couldnt find post about this????
Nobody's reported a problem ... probably because they haven't encountered one (or maybe just haven't noticed).

Maybe PayPal has recently changed something without regard for backwards compatibility or consistency with their own documentation. Wouldn't be the first time.

Last time I tested a PayPal transaction (couple days ago), I had no problem with the code as it is written.

1 Sep 2006, 6:01 AM
#3
ptalindstrom avatar

ptalindstrom

New Zenner

Join Date:
Aug 2006
Posts:
13
Plugin Contributions:
0

Re: PayPal module send wrong phone number

yea.. i didnt see it either... but i did a view source of the paypal page with the form on it and the field is named that... on a hunch i figured i would try passing it a variable with the same name...

seems to work fine.

go figure.

29 Sep 2006, 4:03 AM
#4
peliopoulos avatar

peliopoulos

New Zenner

Join Date:
Sep 2006
Posts:
11
Plugin Contributions:
0

Re: PayPal module send wrong phone number

ptalindstrom

I'm having the same problem with my phone numbers and Paypal. Can you post the exact lines of code that you inserted into paypal.php? I tried to do it myself, but I don't really know what I'm doing and it still doesn't work.

Thanks
Peter

29 Sep 2006, 4:34 AM
#5
peliopoulos avatar

peliopoulos

New Zenner

Join Date:
Sep 2006
Posts:
11
Plugin Contributions:
0

Re: PayPal module send wrong phone number

Please ignore the previous post. Here is my solution:

  1. In paypal.php after the following line

$telephone = preg_replace('/\D/', '', $order->customer['telephone']);

insert the following code:

$phonenumber = substr($telephone,0,3)."-".substr($telephone,3,3)."-".substr($telephone,6,4);

  1. In paypal.php after the following line

zen_draw_hidden_field('day_phone_c',substr($telephone,6,4)) .

insert the following code:

zen_draw_hidden_field('H_PhoneNumber', $phonenumber) .

Many thanks to ptalindstrom for pointing me in the right direction.

Peter

21 Oct 2006, 5:37 PM
#6
pixxi avatar

pixxi

Totally Zenned

Join Date:
Jan 2004
Location:
UK
Posts:
1,065
Plugin Contributions:
1

Re: PayPal module send wrong phone number

Yep, this seems to be happening with paypal.co.uk too.

For UK phone numbers, comment out the existing 'substr( ...' lines and just add below:

 zen_draw_hidden_field('H_PhoneNumber', $phonenumber) .

and that will send Paypal the phone number the customer has entered when they created an account.

Although this seems to be a change on Paypal's part rather than a bug in zen, perhaps this thread should be moved to the Bug Forum?

26 Dec 2006, 9:45 PM
#7
pixxi avatar

pixxi

Totally Zenned

Join Date:
Jan 2004
Location:
UK
Posts:
1,065
Plugin Contributions:
1

Re: PayPal module send wrong phone number

Ooops - I wasn't paying attention there ... :smile:

That line should be:

zen_draw_hidden_field('H_PhoneNumber', $telephone) . 
26 Dec 2006, 10:36 PM
#8
pixxi avatar

pixxi

Totally Zenned

Join Date:
Jan 2004
Location:
UK
Posts:
1,065
Plugin Contributions:
1

Re: PayPal module send wrong phone number

Hmmm ... Paypal seems to have changed it again - 'H_PhoneNumber' doesn't seem to be working anymore if you pass it as a variable, although it still shows if you do a 'view source' of the payment page.

Looking at this info here:

https://www.paypal.com/uk/cgi-bin/webscr?cmd=p/gen/pre-populate-your-signup-outside

For the UK, it seems you now have to pass the phone number as:

zen_draw_hidden_field('night_phone_b',$telephone) .
```to get it to work (confirmed).


Info from the link above:

night_phone_a:

The area code for US phone numbers, or the country code for non-US phone numbers. This will prepopulate the buyer's home phone number. (Numeric characters only. Max. length = 3)

night_phone_b:

The three-digit prefix for US phone numbers, or the entire phone number for non-US phone numbers, excluding country code. This will prepopulate the buyer's home phone number. (Numeric characters only. Max. length = 16)

(Which would also seem a bit confusing for US numbers, since it now doesn't list 'night_phone_c' for the last 4 digits, suggesting that the last 7 digits might need to be passed as 'night_phone_b')      :wacko:
27 Dec 2006, 12:19 AM
#9
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: PayPal module send wrong phone number

Is any of this preventing orders from being processed by PayPal, or is this simply an issue where PayPal doesn't store the phone number properly because it's not recognizing all of the phone-number content?

27 Dec 2006, 12:36 AM
#10
pixxi avatar

pixxi

Totally Zenned

Join Date:
Jan 2004
Location:
UK
Posts:
1,065
Plugin Contributions:
1

Re: PayPal module send wrong phone number

Using the standard zen paypal module, the last 4 digits of the phone number (night_phone_c) apparently isn't now being received/processed by Paypal, so the phone number display is truncated on the payment page.

IIRC, the order will still go through - ie. I don't think Paypal checks the number of digits (but I may be wrong).

It just looks to the customer that something isn't quite right when only part of the phone number appears - ie. not exactly inspiring confidence in the website's handling of the customer's data, maybe ... :smile:

27 Dec 2006, 1:07 AM
#11
pixxi avatar

pixxi

Totally Zenned

Join Date:
Jan 2004
Location:
UK
Posts:
1,065
Plugin Contributions:
1

Re: PayPal module send wrong phone number

[addition - edit timed out]

IIRC, when the first post was made, there was a confirmed problem with only night_phone_b being processed at Paypal's end, so only the '... 456 ...' was showing on the Paypal payment page - perhaps 'night_phone_a' still isn't working (I don't know - I haven't tried it since 'H-PhoneNumber' has been working fine as a substitute for the last month or two).

1am here right now, will try it again tomorrow ... :smile: