The API of square has a delay before getting the result and the processing time is not guaranteed.
Given the user experience, the only option is to disclose the paid content to the user prior to confirming whether the payment was successful, which means that the user will not know that the payment failed until much later.
Is there any way to get around this?
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
Payment API: Process Online and In-Person Payments
Delayed Capture of a Card Payment
Make your First API Call
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 Square APIs, including the Payments API, are designed to provide responses in real-time. However, network conditions and other factors can sometimes cause delays. If you’re experiencing significant delays, it might be worth investigating potential issues with your network or server setup.
In terms of user experience, it’s generally recommended to wait for the payment confirmation before providing access to paid content. This ensures that you’re only providing access to users who have successfully completed their payment. If the payment fails, you can immediately inform the user and prompt them to try again.
If you’re using the Square Reader SDK or In-App Payments SDK, these SDKs provide real-time feedback on the payment status, which can help improve the user experience. For example, if a payment is authorized but not yet captured, you can inform the user that their payment is being processed and they’ll be notified once it’s complete.
Remember, it’s important to handle all possible payment states (including failures and delays) in your application to ensure a smooth user experience.
This answer was reviewed by @Bryan-Square.