I recommend you use the webhooks to trigger a request back to your server. These webhooks can be configured to run on any successful payment, and you can create an endpoint on your server to check whether the payment has been completed and process it accordingly.
The flow could be as shown below:
- Payment created by customer (save payment in your system as pending)
- Coinbase Commerce makes webhook request to your server on payment update.
a. Verify that payment is actually pending
b. Check back with Coinbase Commerce API to make sure payment way completed
c. Mark payment as completed in your system
- Perform task within your system now that payment is completed.
This is an example as to how you could safely check that a payment is completed.