How to add balance to the user's account of a website directly, where payment gets done in the coinbase?

We are building a website where the payment is done by coinbase. Here the logged in users of the website adds credit to their account through payment from coinbase using the btc address. We added the coinbase API with our website, but we are struggling with the step where the user’s account is automatically detected and credit is added to their account while the payment phase is completed in coinbase.

Can anyone describe the process or give us useful documentation link of coinbase API by which we can solve this problem?

Hi @username_allowed! Welcome to the forum. Thank you for taking an interest in trying out Coinbase APIs.

Just to be sure we are aligned with your query. When you say “adds credits to their account”, do you mean their account?


yes. When we get the btc address and pay from coinbase account using that.

Hi @username_allowed. Can you confirm what Coinbase product you are integrating with?

Are you using Sign in With Coinbase to allow users to sign into your application using their Coinbase account, or are you using Commerce to accept payments in cryptocurrency from your customers?

These are distinct products that have different use cases and APIs, so we will need to know which product you are using to advise further. Thank you!

1 Like

I am using commerce to accept payment.

Thank you for confirming, @username_allowed! For your specific use case, you can subscribe to Commerce Webhooks to monitor for events where a charge is created, confirmed or failed. Upon seeing that a charge is confirmed, this can be the trigger you use to then take further action on the customer’s account (eg: add credit to their account).

You can read more about using Webhooks with Coinbase Commerce in our documentation: Using Webhooks


Thanks for the answer man. I have one concern, How can I track the client who paid from their coinbase account and match it with the user of my website? Does the btc address got something?

Hi @username_allowed ,

The webhook payload will include an id for the event. You can cross reference this id with the response from the charges endpoint (see Show a charge) to lookup more information about the charge, including metadata about the customer and when the charge was created.

We hope this helps. Thanks!


Thanks. bro, what do you mean by cross reference? Do we need to manually take the metadata from charges endpoint and merge it with webhook payload manually? or there is any other mechanism available?

Hello @username_allowed. Apologies for the delayed response. Thank you for your patience and understanding while we checked this with our team. To answer your query, you will have to do it manually.

1 Like