19. Webhook Api - Viincenttt/MollieApi GitHub Wiki

This API is used to create, list, update and delete next-gen webhooks.

Creating a webhook

var request = new WebhookRequest {
	Name = "my-webhook",
	Url = "https://github.com/Viincenttt/MollieApi/",
	EventTypes = [WebhookEventTypes.PaymentLinkPaid, WebhookEventTypes.SalesInvoiceCreated],
	Testmode = true
};

using IWebhookClient client = new WebhookClient("{yourKey}");
WebhookResponse response = await client.CreateWebhookAsync(customerRequest);

Retrieve webhook list

Mollie allows you to set offset and count properties so you can paginate the list. The offset and count parameters are optional.

using IWebhookClient client = new WebhookClient("{yourKey}");
ListResponse<WebhookResponse> response = await client.GetWebhookListAsync();

Retrieve a webhook by id

using IWebhookClient client = new WebhookClient("{yourKey}");
await client.GetWebhookAsync("{your-webhook-id}");

Update a webhook

var updateRequest = new WebhookRequest {
	Name = "my-webhook-updated",
	Url = "https://github.com/Viincenttt/MollieApi/-updated",
	EventTypes = [WebhookEventTypes.PaymentLinkPaid, WebhookEventTypes.SalesInvoiceCreated],
	Testmode = true
};
using IWebhookClient client = new WebhookClient("{yourKey}");
WebhookResponse updated = await client.UpdateWebhookAsync(created.Id, updateRequest);

Delete a webhook

using IWebhookClient client = new WebhookClient("{yourKey}");
await client.DeleteWebhookAsync("{webhook-id-to-delete}", testmode: true);

Test a webhook

using IWebhookClient client = new WebhookClient("{yourKey}");
client.TestWebhookAsync(created.Id, testmode: true)