Kryptronic Software Support Forum

You are viewing this forum as a guest. Login to an existing account, or create a new account, to reply to topics and to create new topics.

#1 11-30-2004 12:14:07

rockersquirrel
Member
Registered: 10-02-2004
Posts: 124

Apostophre In Name, Error On Paypal

when passing customer data to paypal, if the user has put an apostophe in their name, you get an error on paypals website:


Error Detected

--------------------------------------------------------------------------------

You have entered unsupported characters such as Only German, French and US-English characters are currently supported. Please use alternatives (for example, i instead of and try again.

Do we have any way of stripping these out before sending?

Offline

 

#2 12-05-2004 01:35:56

rockersquirrel
Member
Registered: 10-02-2004
Posts: 124

Re: Apostophre In Name, Error On Paypal

bump

Offline

 

#3 12-05-2004 03:24:20

thekiko
Member
Registered: 07-11-2002
Posts: 126

Re: Apostophre In Name, Error On Paypal

I have had two different customers run into difficulties with this.  One had a last name of "O'Malley" and the other happens to live on a street named "Sean's Ave."  So it is not just the Name field, but any field that is passed to Paypal.

Now the interesting thing is that the forms on the actual Paypal site do not mind the apostrophe character so "stripping" the apostrophe will not solve the problem but trying to figure out how (or why) the apostrophe character sent from CCP is confusing Paypal.


TheKiko

Offline

 

#4 12-05-2004 20:05:01

rockersquirrel
Member
Registered: 10-02-2004
Posts: 124

Re: Apostophre In Name, Error On Paypal

Anyone?

Offline

 

#5 12-07-2004 13:30:47

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19798
Website

Re: Apostophre In Name, Error On Paypal

The character on the keyboard is a single quote:  '
The character being sent to PayPal is an apostrophe: ’ (ALT+0146 on keyboard)

CCP transforms all form data submitted to the program by replacing single quotes with apostrophes to ensure SQL syntax errors are avoided.

That was background.  Now for the PayPal fix.  Basically what we need to do is loop through all the tracking_* variables before the PayPal form is submitted and strip out all apostrophes.  This would be done in checkout.

To do this, edit the file ./cgi-bin/library/modules/ste_chkout.pl.  Look in the routine 'ste_chkout_fin' for:

Code:


$tracking_addressone = "$fd_tracking_addressone";

&display_print($tracking_paymethod);

} ######### End of if statement.

Right above that, add:

Code:


$tracking_firstname =~ s/\’//gs;
$tracking_lastname =~ s/\’//gs;
$tracking_addressone =~ s/\’//gs;
$tracking_addresstwo =~ s/\’//gs;
$tracking_city =~ s/\’//gs;
$tracking_stateabbus =~ s/\’//gs;
$tracking_country =~ s/\’//gs;
$tracking_zip =~ s/\’//gs;
$tracking_email =~ s/\’//gs;



Nick Hendler

Offline

 

#6 12-07-2004 19:15:02

rockersquirrel
Member
Registered: 10-02-2004
Posts: 124

Re: Apostophre In Name, Error On Paypal

I tried it and it is still not working.

This is what I entered:

Code:

### added code for apostrophe fix

$tracking_firstname =~ s/\’//gs;
$tracking_lastname =~ s/\’//gs;
$tracking_addressone =~ s/\’//gs;
$tracking_addresstwo =~ s/\’//gs;
$tracking_city =~ s/\’//gs;
$tracking_stateabbus =~ s/\’//gs;
$tracking_country =~ s/\’//gs;
$tracking_zip =~ s/\’//gs;
$tracking_email =~ s/\’//gs;

### end added code for apostrophe fix

$tracking_addressone = "$fd_tracking_addressone";

&display_print($tracking_paymethod);

} ######### End of if statement.

Offline

 

#7 12-07-2004 19:19:07

rockersquirrel
Member
Registered: 10-02-2004
Posts: 124

Re: Apostophre In Name, Error On Paypal

Ah, I think I know why. I had to change what the paypal form was sending over, because the address wasn't appearing on the populated fields

In my paypal form, I changed it so it passed the shiplastname as follows:

Code:

<INPUT TYPE="HIDDEN" NAME="first_name" VALUE="(CGIVAR)trackitem_shipfirstname(/CGIVAR)">

<INPUT TYPE="HIDDEN" NAME="last_name" VALUE="(CGIVAR)trackitem_shiplastname(/CGIVAR)">

So, should I change the code that you put above as the fix to be?:

[CODE]$trackitem_shipfirstname =~ s/\’//gs;
(etc...)
[CODE]

Offline

 

#8 12-07-2004 19:23:59

rockersquirrel
Member
Registered: 10-02-2004
Posts: 124

Re: Apostophre In Name, Error On Paypal

I tried that also...didn't work.

Offline

 

#9 12-08-2004 09:49:40

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19798
Website

Re: Apostophre In Name, Error On Paypal

In my code, I'm modifying billing fields (tracking_*) - in your form content section, you're referencing shipping fields (trackitem_ship*).  Change those fields and it should work.


Nick Hendler

Offline

 

#10 12-08-2004 18:21:58

thedon122
Member
Registered: 01-21-2004
Posts: 155

Re: Apostophre In Name, Error On Paypal

I add this mot but it did not work - or so i thought!!

put the code in where nick says

and also put it between

Code:

if ($store_use_secchkout eq "Y") {

&display_print('ste_chkout_sslsetupsc');

put nicks code here!!!!

Code:

&display_print($tracking_paymethod);

} else {

&display_print('ste_chkout_sslsetup');

This is if you use secure checkout feature in ccp (which i do) so i add the code as above to work when using secure checkout.  Also i put the code where nick said so that it will work when not using secure checkout.

I am right Nick?  will this cause any problems - or am i taking rubbish?

its working for me at the mo.

Thanks for the mod Nick

all the best
Charlie 

Offline

 

#11 12-08-2004 19:54:41

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19798
Website

Re: Apostophre In Name, Error On Paypal

Putting it in both spots will handle SSL & Non-SSL checkouts.  Sorry - PayPal was mentioned, so I posted for Non-SSL as PayPal handles the SSL side of things using that method.


Nick Hendler

Offline

 

#12 12-08-2004 19:31:45

thedon122
Member
Registered: 01-21-2004
Posts: 155

Re: Apostophre In Name, Error On Paypal

hi

have i got paypal setup wrong then?

in paypal setup on ccp i have selected

payment method type= (gateway) secure server
and
use secure server =yes

or should it be

payment method type= (gateway) payment form
and
use secure server = no



whats the difference?

Cheers
Charlie

Offline

 

#13 12-08-2004 20:01:19

thekiko
Member
Registered: 07-11-2002
Posts: 126

Re: Apostophre In Name, Error On Paypal

Hey Charlie,

Either setting will work fine with Paypal.  The secure server option is for the CCP portion of the checkout process (before your customers are sent to Paypal).  Most customers prefer going "secure" whenever they have to input any information so it is recommended that both CCP site is secure as well as Paypal.


TheKiko

Offline

 

#14 12-08-2004 21:24:50

thedon122
Member
Registered: 01-21-2004
Posts: 155

Re: Apostophre In Name, Error On Paypal

hi thekiko,

thanks for that- on that info, i will keep the setting i have as they work and gives the customer more security.

cheers

Charlie smile

Offline

 

#15 12-10-2004 10:13:54

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19798
Website

Re: Apostophre In Name, Error On Paypal



Either setting will work fine with Paypal. The secure server option is for the CCP portion of the checkout process (before your customers are sent to Paypal). Most customers prefer going "secure" whenever they have to input any information so it is recommended that both CCP site is secure as well as Paypal.

Absolutely correct.  The default is 'payment form' and 'no' because most users do not use a secure server when accepting PayPal.


Nick Hendler

Offline

 

Board footer