Quantcast
Channel: Active questions tagged paypal - Stack Overflow
Viewing all articles
Browse latest Browse all 518

HMTL form to PayPal fails if an attribute has single or double quotes in the field

$
0
0

I occassionally receive:

Error Processing PaymentWe're sorry, we can't complete your payment at this time. Please try again later.

This error occurs when being sent to PayPal, so no user interaction with PayPal has yet occurred.

This error has only started happening in the last few months.

Payers name is Bill O'Reilly.

The form attributes use the php esc_attr() to do the appropriate substitutions and the resultant HTML example is included below.

<input type="hidden" name="charset" value="utf-8"><input type="hidden" name="cmd" value="_hosted-payment">..<input type="hidden" id="last_name" name="billing_last_name" value="O&#039;Reilly">

If the data is altered to remove the apostrophe, the following resulting HTML works correctly:

<input type="hidden" id="last_name" name="billing_last_name" value="OReilly">

Has anything changed recently on how we should escape these characters when submitting a form to PayPal.

Further Information / Research

The only instances where this has been identified as occurring is where the target PayPal account is a PayPal-PRO account. (PayPal Standard works fine).

The endpoint for PayPal-PRO is: https://securepayments.paypal.com/webapps/HostedSoleSolutionApp/webflow/sparta/hostedSoleSolutionProcess

I have also tried using

htmlspecialchars($member->lastname, ENT_COMPAT, 'UTF-8')

instead of

esc_attr($member->lastname)

Which gives a resulting HTML of:

<input type="hidden" id="last_name" name="billing_last_name" value="O'Reilly">

But that results in exactly the same error.

Many thanks.


Viewing all articles
Browse latest Browse all 518

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>