Customers cannot complete payment because tokenize() stalls in some environments

Yesterday I was improving my shopping cart on my website then when I did some basic testing, I notice your web SDK tokenize() method takes a while to complete. I’m calling it as

result=await info.tokenize();

The problem is that many times the function takes a while to return. As of last test, it took over 5 minutes to return a result which IMO is a terrible checkout experience.

For my test, I used the card payment method (where people type in their financial info without going to a 3rd-party site).

I also deliberately left the fields blank and made the submission in hopes I’d get a response fast from tokenize(), but I don’t.

I never received such an issue if I used my sandbox keys instead of the production keys.

Here is the code I used for debugging:

console.log(info);result=await info.tokenize();consoe.log(result);

And here is what the console returns:

This is what the value of info is as of 13:53:14.528 (1:53 and 14 seconds in):

This is what the value of info is as of 13:59:37.406 (1:59 and 37 seconds in):

No other code executed on the website during this time.

Is there a way to make the waiting time for this function shorter? (like maybe 20 seconds at most)?

:wave: I’m Square Dev AI, here to help answer your question!
Based on the information you’ve provided, the following documentation will help answer your question:

Additional Documentation

Sandbox Payments
Download, Configure, and Run the Client Sample
In-App Payments SDK Quickstart

If this documentation helped you find a solution, please check the box indicating that this reply solves the problem.
Otherwise one of our Developer Advocates will provide additional assistance shortly.

Where did you get this:
Screenshot 2024-12-09 at 09.28.19
That isn’t the correct library to point to. You’ll want to use https://web.squarecdn.com/v1/square.js. :slightly_smiling_face:

I used web developer tools.
For the screenshot I showed you, I mentioned in my previous post that I used console.log on the object before applying the tokenize method to it.

Also, that URL that you highlighted along with other files (including css stylesheets) is available as a list in the network tab of firefox web developer tools after 'https://web.squarecdn.com/v1/square.js` is loaded.

I did notice that since I first posted this issue that you guys must have fixed something at your end because the waiting time has returned to seconds instead of 6 minutes.

I should mention I ran all tests on a strong internet connection in the city.

Hmm, I’m not aware of any changes that were made. Glad to hear that it’s working as expected. :slightly_smiling_face:

Thanks for sharing. It helps me a lot.

Hi,

I’m experiencing a dramatic delay in the time it takes to process the tokenize function as well.

This all started about 24 hours ago, and there haven’t been any code changes from our end. Indeed we saw a few Square payments go through yesterday morning, so we know things were working then.

Has anything changed at the Square end to cause this sort of delay?

Things other than Web Payments are working, such as OAuth and Locations. It’s just this massive degradation in the response time for the tokenize function.

1 Like

Only thing i can suggest is to run a timer but today I discovered that this should only be done on the card object because if its done through any other object and the customer has the second payment window for the duration of the timeout, then the transaction wont complete.

Thanks.
Mike.

We are getting numerous reports from customers trying to enter payment details into the Web Payments widget that their details are never processed.

There appears to be a bug in the tokenize function that allows an internal routine to loop forever and never return. At a minimum, there needs to be a timeout so that an error can be reported back to the user in a reasonable amount of time.

1 Like

The delay is forever at your end?

When I last measured the longest delay at my end, it was 6 minutes which is still painfully slow.

I bet that it responds faster at certain times of day, particularly off-peak hours, but still, this is bad and square devs need to look into it or they will have a hard time making their commission from everyone that relies on square online.

I waited for over 90 minutes until I gave up!

I can’t see any customers lasting that long. I can see my merchants are going to be asking some serious questions about how long they can last with Square and keep losing sales.

Are you able to replicate this? Payments should take just a few seconds. :slightly_smiling_face:

There were times where I used the card payment on the web sdk production version and I deliberately submitted blank fields. When clicking the pay button, the tokenize method is called and sometimes takes forever.

For the majority of my tests I use Seamonkey 2.53.19 and on some occasions I use Firefox 131 and yes firefox is memory hungry.

I wonder if one’s location may have something to do with it. I’m in Ontario Canada.

At this moment there is no issue with the card object at my end, but I’ll run more tests sometime later to see what happens.