Com.squareup.sdk:point-of-sale-sdk - polling for checkout completion?

I have integrated the Square POS SDK into our test app as described here.

I would like to know, when our app initiates a checkout on the Square Terminal, how does the app get notified when the checkout has completed?

Presumably, the app polls a Square API/endpoint to monitor for checkout completion, but which of Square’s APIs/endpoints does it use? And how often does it poll it?

I would like to know this as we will ultimately be using the Terminal API instead of the POS SDK, so we will need to recreate whatever technique the POS SDK uses for polling.

Thank you.

: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

Build on Android: Point of Sale API
Payment API: Process Online and In-Person Payments
Build on Mobile Web

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 Point of Sale API doesn’t directly notify your app when a checkout has completed. Instead, it uses a callback mechanism. After the transaction is completed on the Square Terminal, the Point of Sale application sends the transaction result back to your app via the callback URL that you specified when initiating the transaction.

In the case of the Terminal API, after you create a Terminal checkout using the CreateTerminalCheckout endpoint, you can use the SearchTerminalCheckouts endpoint to poll for the status of the checkout. You can do this at an interval that suits your application’s needs. The response from SearchTerminalCheckouts will include the status of the checkout, which can be PENDING, IN_PROGRESS, CANCELED, or COMPLETED.

Remember, the Terminal API also provides webhook events that you can use to get real-time notifications about the status of a checkout. This can be a more efficient method than polling.

This answer was reviewed by @Bryan-Square.