I’m using the Commerce API to implement a crypto payments gateway for a client of mine (see http://dataland.art). We will be selling a timed ticket experience and the Commerce API has been awesome to add cryptocurrencies as a way for our customers to use crypto as an alternative method of payment.
I followed this tutorial: Adding a 'Pay with Crypto' Payment Button | Coinbase Cloud and found it very straightforward. However, when I tested the full payout structure. It wasn’t clear to me what redirect_url
actually did. As stated in the documentation, crypto is a push transaction so it can take some time for a charge to complete.
When I tested my own charge, it hung on this page even though on BlockScan the transaction had a “Completed” status.
Perhaps this was just a fluke of my use. I’d like to know the intended user flow. Based on this post (Looking for field descriptions in API reference guide) I saw that redirect_url
when passed takes the user’s browser to that url after the transaction has completed. If so, does Commerce API add a query parameter of what the charge id is?
Otherwise, what’s the best way to track the user’s order on complete? I think I could:
- Use
redirect_url
if the query parameter is added. - Store the charge id when I create the charge and before I go to the hosted payment page.
- Or use webhooks to keep track of all transactions (and their states) in a central place on my end.
Is there a recommended way to proceed?
Thanks for a great product! Excited to complete wiring this up and publish this.