Square API Payment Requests From My Website Sometimes Remain Stuck in a Pending State

Hello Square Developer Community,

I am currently facing one specific problem with the Square integration on my website where a payment initiated by a customer can remain stuck in a pending state on the website even though the payment request has already been submitted successfully. The checkout flow itself works normally in most cases: the customer enters the required information, submits the payment, and my website sends the payment request through the Square integration. The problem occurs afterward, when my website is waiting for the final payment status. Occasionally, the website continues displaying a pending or processing state instead of updating the order to show that the payment has completed. The customer may already have received confirmation from the payment flow, but my website does not consistently transition to the completed state without another request or page refresh. I am trying to troubleshoot this as one specific payment-status synchronization problem rather than multiple unrelated checkout issues.

I have verified that the payment request is being created using the expected Square API workflow and that successful transactions receive the appropriate identifiers from Square. When the integration works correctly, my application receives the response, stores the relevant payment information, and updates the order status so that the customer can continue normally. The problem only occurs with some transactions, which makes it difficult to identify a single configuration error. In affected cases, I can usually identify the payment attempt and its associated information, but the website continues waiting for a final state even though the payment may already have progressed on the Square side. I have checked the application logs around the time of the affected requests and am comparing them with transactions that complete normally. I want to determine whether the problem is occurring while my application is retrieving the latest payment status or while it is processing the response and updating the corresponding order.

I have also been inspecting the browser and server-side logs so I can follow the payment lifecycle from the initial request through the final status update. The frontend does not consistently show an obvious JavaScript error when the problem occurs, and the website itself remains available. I have started recording timestamps and non-sensitive transaction identifiers so that I can compare the timing of successful and affected payment attempts. In successful cases, the application receives the expected information and changes the order state promptly. In affected cases, the initial payment operation appears to have started correctly, but my application does not reliably reach the point where it marks the order as completed. Because I do not want to assume that the payment is actually incomplete simply because my website says “pending,” I am trying to understand the recommended Square API approach for determining the authoritative payment status after the initial payment request has been submitted.

The issue is particularly concerning because simply retrying the payment-status operation can potentially produce a different result from the first attempt, while the original payment may already have been processed. I therefore do not want to automatically create another payment request whenever my application fails to receive the expected final status. Instead, I want the website to safely retrieve the existing payment and determine its current state before making any additional action. I have considered whether a temporary network delay, request timeout, asynchronous processing, or an interrupted response could cause the website to miss a status update even though Square has continued processing the payment. I have not yet confirmed which of these might be involved, so I am collecting request timing and response information from both successful and affected transactions to establish exactly where the state synchronization stops.

I have also tested the workflow repeatedly using test transactions and have found that most attempts complete normally, while an occasional transaction can remain displayed as pending by the website. Refreshing the relevant page can sometimes cause the application to retrieve the latest state and display the correct result, which suggests that the underlying payment state may already be available but my initial workflow is not consistently receiving or processing it. I have started reviewing the code responsible for storing the payment identifier and checking the payment status so that I can confirm the application is always querying the same transaction rather than relying on a temporary frontend state. I am also interested in understanding whether Square provides recommended webhook or polling patterns for keeping an application’s order state synchronized with the actual payment state, particularly when the original request does not immediately provide everything my application needs to mark the order as complete.

I would appreciate guidance from the Square Developer Community on how to properly troubleshoot this specific situation where a payment initiated through my website can remain stuck in a pending state even though the payment may already have reached a final state within Square. In particular, I would like to know the recommended way to verify the authoritative status of an existing payment, what request and response information I should log when an update is missed, and whether there is a preferred Square mechanism for reliably synchronizing my website’s order status with payment status changes. I would also appreciate advice on how to safely handle temporary API/network failures without accidentally creating duplicate payment attempts. My goal is to make the payment-status workflow reliable so that each transaction is accurately reflected on my website without requiring customers to refresh the page or my application to make potentially unsafe duplicate payment requests. Sorry for long post!

Hey there! Happy to help troubleshoot. Could you share the following to help me track this down?

  • What’s your app ID?
  • Do you have an idempotency_key for the payments that are failing?
    • If not, can you share a timestamp?

Thanks for getting back to me. I can provide the app ID and the relevant timestamps for the affected payment attempts. For security, I’ll avoid posting any access tokens, secrets, card information, or other sensitive payment details publicly in the thread.

I’m also checking the logs to confirm whether an idempotency_key was generated for each of the payments that remained stuck in the pending state. For the affected transactions where I can identify the key, I’ll include it along with the corresponding timestamp so you can correlate the request on your side.

I’ll gather those details from a few affected transactions and provide them in the format you requested. Hopefully that will help narrow down whether the issue is occurring during the initial payment request, the status retrieval, or the subsequent update on my application.

Sounds great. I will send you a DM on this platform now so you can reply with the additional details when ready.

  • Which payment method(s) are affected (card, ACH, Cash App Pay, etc.)?

  • For an affected transaction, what status is returned in the original CreatePayment response ? and what does GetPayment return afterward for the same payment_id?

  • Are you currently subscribed to the payment.updated webhook, and if so, do you receive an event for the affected payment?

Having answers for above might help narrow down what’s happening. also are you using square payments sdk?