cancel
Showing results for 
Search instead for 
Did you mean: 

Who Me Too'd this topic

Using Paypal Smart Buttons for checkout sometimes fails with Debit/ Credit Cards Form

tutor-for-life
New Community Member

After following the integration guide for JS and the paypal-react-js library, I've added the react Paypal buttons to my website. The order is created and captured both on my website. End result looks like the normal Paypal buttons.

tutorforlife_0-1713965740512.png

Now what I've noticed after testing this in different settings and not in production is that the yellow Paypal buttons always load the PopUp correctly and let the user checkout. However, about 20% of the time, customers have reported that the black "Debiut or Credit Card" Button fails to show anything but a spinning loader.

tutorforlife_1-1713965868560.png

Now the interesting things is that this can be triggered by clicking the black CC button, loading the form correctly, clicking the small "X" to close the CC form, then clicking the black CC button again. The Form will fail to load with the following console error:

`Failed to load resource: the server responded with a status of 400 () https://www.sandbox.paypal.com/smart/card-fields?sessionID=uid_33e29de752_mtm6mtk6mty&buttonSessionI...

So I figure this is an issue in how the Paypal SDK handles cookies and sessions. Looking in the localStorage, I see the following value `__paypal_storage__` which contains a json like this:
{"id":"uid_80e2de125e_mtm6ndi6mje","__session__":{"guid":"uid_8f2743e801_mtm6ndi6ndk","created":1713966169717,"state":{}}}

I found that by clearing this local session token, I can SOMETIMES fix this issue and clicking the black button again brings up the CC form correctly. However, this doesn't work every time. So the question is, why are the smart buttons being fickle?? checking the Dev Paypal console, I can see that my createOrder calls are successful.

Login to Me Too
Who Me Too'd this topic