How to set webhook in coinbase commerce api and check charge status

I am experiencing an issue with how to set webhook in coinbase commerce API to receive updates about my accounts’ different situations on my server. also, how can I check the charge status which is created? I know that the charge status is one of the following

  1. New
  2. Pending
  3. Completed
  4. Expired
  5. Unresolved
  6. Resolved
  7. Cancelled
  8. Pending Refund
  9. Refunded
    but I do not know how to check it through api,
    Or is it good to check through the timeline?

Hi @aqeelabbas3972, Welcome to the Forum Community!

Coinbase Commerce sends webhook events whenever a charge is created, confirmed, or fails. To subscribe to Webhooks, please follow below steps:

  1. Navigate to your Settings page within Coinbase Commerce.
  2. Add an endpoint to the Webhook subscriptions section.
  3. Click Add an endpoint to add the URL where you’d like to receive webhooks.

You will be prompted to enter the endpoint URL (https only) where you would like to receive Webhooks. You can choose to be notified of all events or only the subset you care about. For more details refer to the document here: Using Commerce API Webhooks | Coinbase Cloud

To your query on how to check the charge status - Once a charge, or request for payment, is created, Coinbase starts monitoring these unique addresses on the respective networks to detect any inbound payments. Each charge has an associated payment status.

To check the Payment status, You may use the List charges api (GET https://api.commerce.coinbase.com/charges) or
Show a Charge api (GET https://api.commerce.coinbase.com/charges/{charge_code_or_charge_id})

Sample:



“timeline”: [
{
“status”: “NEW”,
“time”: “2023-12-22T16:00:39Z”
},
{
“status”: “EXPIRED”,
“time”: “2023-12-22T17:00:45Z”
}
],

We hope this helps. Please reply for any more questions.

Thank you and have a nice day!

when I goto Settings I automatically redirected to Coinbase Commerce payments page, and I get no option like Webhook subscriptions or Add an endpoint.

Hey @aqeelabbas3972 , within Settings under Notifications, you can find the Webhook subscriptions please use this corrected link Coinbase Commerce

Thank you!