Web Payments SDK - transaction_id

I’m using the web payments sdk for payments and I have a question about the transaction_id that is returned. Is it possible for the SDK to return two different transaction_ids for the same payment card entry, or would the cardholder have to enter the payment info twice?

I’m looking at a duplicate posting with created_at timestamps 90 seconds apart for the same invoice on my side. The customer insists they did not double-click or enter the payment details twice. Is this possible?

: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

Create a Card on File from a Payment ID
Troubleshoot In-App Payments SDK Problems
Charge Cards on File

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.

The Web Payments SDK generates a unique payment token for each transaction, even if the same card details are entered. This means that two different transaction IDs for the same card entry would indicate that the payment information was submitted twice, either intentionally or unintentionally.

However, it’s important to note that the SDK itself doesn’t directly create transactions. It only generates a secure payment token. The actual transaction is created when your server-side code uses this token to call the Square Payments API.

If you’re seeing duplicate transactions with different IDs, it’s possible that there might be an issue with how your application handles the payment token, or there could be a glitch that caused the payment form to be submitted twice.

It’s also worth noting that the timestamp (created_at) is generated when the transaction is created on Square’s servers, so a 90-second difference between two transactions would suggest that two separate transaction requests were made.

In conclusion, while it’s technically possible for a customer to unintentionally create two transactions without manually entering their details twice (due to a glitch or issue with the application), it’s not a behavior that would be caused by the Web Payments SDK or Payments API themselves.

This answer was reviewed by @Bryan-Square.