Reputation: 695
I'm trying to verify transaction results on the redirect URL after the Square Checkout process using the Square Connect C# SDK, but RetrieveTransaction is returning the following exception:
{
"errors":
[{
"category": "INVALID_REQUEST_ERROR",
"code": "NOT_FOUND",
"detail": "Location `XXXXXXX` does not have a transaction with ID `XXXXXXX`.",
"field":"transaction_id"
}]
}
I have verified that both the location ID and the returned transaction ID are correct. In fact, if I make the exact same call a minute or two later, it successfully returns the correct transaction details. It only fails immediately after the user completes the checkout.
It seems like the transaction hasn't actually been created yet when the user is redirected back to the Redirect URL. Is that correct? Square's PHP example does not mention anything about waiting for the transaction to exist.
Do I need to implement some sort of delay before I try to verify the transaction?
UPDATE: I just tried running a test where I repeatedly called RetrieveTransaction until it was successful. It looks like the transaction doesn't exist until a second or two after the redirect happens. If that's normal, then the documentation severely needs an update.
Is it possible for it to take even longer before the transaction exists?
Upvotes: 1
Views: 498
Reputation: 7166
We also ran into this. Quite a big and fatal problem thus the charge is being made and you get an error. Not convenient at all. We added a sleeper to our function to make it work. Not optimal I would say but it works.
Upvotes: 0
Reputation: 332
You are correct in that you have to wait a few seconds after the user is redirected to retrieve the transaction. We’re constantly working to improve our products and services based on the feedback we receive from customers. I’ll be sure to share this with the appropriate team.
Feel free to let me know if I can assist you further. I’m happy to help.
Upvotes: 1