Posted: July 30, 2024 at 6:07 pm
Are there any updates on the issue concerning token expiration for Square payments? We thought this might have been fixed, but it just happened a day or two ago and it resulted in over $2000 of lost payments before it was brought to our attention. 🙁 |
|
Can you run this code on the site: https://gist.github.com/Pebblo/e87c230fa2b351ff8a330925f02ef636 And post the result here in a private reply? The quick way I do it is using Debug Bar and Debug Bar Console. We swapped out all of the possible calls within the Square plugin to use the latest API versions etc and didn’t run into issues since but I can review the code from the above and see from there. |
|
This reply has been marked as private. | |
The issue we had with Square is they didn’t return a refresh token for oAuth so we couldn’t refresh the token when it expired after 30 days. Your data contains a refresh_token and refreshed recently. How long ago did this this last happen? Edit – I’m aware you said one or two days ago above, but I’m looking to see if you have anything more specific so I can check into it. |
|
I looked for the first complaint we received via email and it was from the 27th. We immediately went to the payment method page, saw that it failed the health check and disconnected / reconnected to square. I’m guessing you would need this code run after the health check fail and before a reconnect to be useful, right? |
|
Not really, the snippet pulls in Square’s metadata and the issue we had with Square is that Square tokens are valid for 30 days and the above had 25 days remaining which puts it right on the 27th so it all fits, but it doesn’t explain why. The token should try to refresh once the So if you run that snippet again today, it should show the refresh_token back at 30, the time depends on your server’s time but if by tomorrow that value is at 23 then the token isn’t refreshing even with a refresh_token. So let’s start with running that snippet again today, can you paste the return here again, please? |
|
This reply has been marked as private. | |
Ok, can you run that code one more time today, please? Also, can you check for the cron task on the site? To do that you can use: https://wordpress.org/plugins/wp-crontrol/ Then go to Tools -> Cron Events. Search for Is it listed and if so, what does it say in the next run column and does it show:
` within the Action column? |
|
This reply has been marked as private. | |
That will likely prevent the token from refreshing. I have a new version of the Square add-on with some additional checks for that cron to make sure its running, it’s also reworked the refresh call to basically double and triple check it runs. I can send that over if you’d like to try it? Failing that I’ll push the update live on Monday. I don’t push updates out for payment method’s right before the weekend just incase anyone runs into issues as I want to make sure support is available. In terms of getting the cron on the site active again, deactivating and reactivating the Square add-on (or updating it) should re-add the cron as it stands. |
|
This reply has been marked as private. | |
Email sent 🙂 |
|
After installing that update, the cron job is now there and set to run twice a day. I ran it manually and the token now has a new expiration date of September 7th. I’m hoping this issue is now resolved. Thanks!! |
|
Run the snippet above in 7+ days time, if the days remaining goes below 24 days it means the Auth token isn’t being refreshed. If that happens, let me know. |
|
I just checked again and the expiration date is now September 13th. Hoping this is finally resolved now. Thanks! |
|
Awesome. Please keep us updated if there’s problem. have a wonderful day. |
|
This reply has been marked as private. | |
Hmmm, interesting! So the notice was added for that reason, it gives an indication that something was up with refresh request. However, based on your Sqaure meta data, your access token was still valid and Square would likely have continued to work for at least another 27 days… possibly refreshing within that time and removing the token. (You know more in-depth how the payment method and Square connection works than most of our users would, so the idea being that the notice is thrown and the user checks in to see why, usually with us, were we investigate from there but you’ve reconnected to fix) Doesn’t look like those failures are logged, I’ll check in with our devs as to why as they could be useful. |
|
Yeah… the connection might have still been working, but there were two other customers actively checking out at the time so I didn’t want to risk it. I just ran your code and quickly reset it. 🙂 The payments page was also displaying the failed health check error. When this happens again, I’ll quickly try registering to see if square shows up properly on the payments page. |
|
Sorry, I wasn’t picking holes at your reconnecting here, I get it. I just meant that generally if people see that notice they would contact us before reconnecting and we could try to see what failed…. you already know you ‘need’ to reconnect before issues come up… but… with that access token still being valid things ‘should’ have still been ok for the remaining of the access token lifetime.
In the admin? If so that’s expected. Once that notice is set it’s shown everywhere so the admin should see it and get it fixed before the token expires.
The health check runs on WP_CRON automatically twice daily… what I’m suspecting happened currently is the requested failed for some reason and that triggered the notice. It wouldn’t be a refresh failure as its not due and you refresh_token is valid, so ‘somehting’ happened on the request which triggered the notice…. but it may be something we can set to ignore. All of that is based on assuming the connection was actually still valid even with the notice shown and will change if we find that wasn’t the case but right now I’m thinking its most likely a false positive on the notice. |
|
The support post ‘Square Payments Token Expiration Update?’ is closed to new replies.
Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.