Creates an instance of BaseService.
The SDK configuration options
Options for request retry behavior
Creates a new webhook subscription in the Coinbase Commerce platform
The webhook creation parameters
A promise that resolves to the merchant data including the new webhook subscription
const { data: merchantData } = await commerce.webhooks.createWebhook({
url: 'https://example.com/webhooks/coinbase'
});
// Access the webhook subscriptions
const webhooks = merchantData.data.settings.webhook_subscriptions;
console.log(webhooks[webhooks.length - 1].id); // ID of the newly created webhook
Retrieves all webhook subscriptions for the merchant
A promise that resolves to the merchant data including all webhook subscriptions
const { data: merchantData } = await commerce.webhooks.getWebhooks();
// Access all webhook subscriptions
const webhooks = merchantData.data.settings.webhook_subscriptions;
webhooks.forEach(webhook => {
console.log(`Webhook ${webhook.id} pointing to ${webhook.url}`);
});
// Access other merchant settings
console.log(`Webhook shared secret: ${merchantData.data.settings.webhook_shared_secret}`);
Updates an existing webhook subscription in the Coinbase Commerce platform
The unique identifier of the webhook subscription to update
The webhook update parameters
A promise that resolves to the merchant data including the updated webhook subscription
const { data: merchantData } = await commerce.webhooks.updateWebhook(
'webhook-id-123',
{
url: 'https://example.com/webhooks/coinbase/new'
}
);
// Access the updated webhook subscription
const updatedWebhook = merchantData.data.settings.webhook_subscriptions
.find(webhook => webhook.id === 'webhook-id-123');
Service for managing Webhooks within the SDK Provides functionality for creating and configuring webhooks