A webhook must have a name, an url and a list of event types. You can also create webhooks in the webhooks settings section of the Dashboard.
package hello .world ;
import com .mollie .mollie .Client ;
import com .mollie .mollie .models .components .Security ;
import com .mollie .mollie .models .components .WebhookEventTypes ;
import com .mollie .mollie .models .errors .ErrorResponse ;
import com .mollie .mollie .models .operations .*;
import java .lang .Exception ;
public class Application {
public static void main (String [] args ) throws ErrorResponse , Exception {
Client sdk = Client .builder ()
.security (Security .builder ()
.organizationAccessToken (System .getenv ().getOrDefault ("ORGANIZATION_ACCESS_TOKEN" , "" ))
.build ())
.build ();
CreateWebhookResponse res = sdk .webhooks ().create ()
.idempotencyKey ("123e4567-e89b-12d3-a456-426" )
.requestBody (CreateWebhookRequestBody .builder ()
.name ("Webhook #1" )
.url ("https://mollie.com/" )
.eventTypes (EventTypes .of (WebhookEventTypes .PAYMENT_LINK_PAID ))
.testmode (false )
.build ())
.call ();
if (res .createWebhook ().isPresent ()) {
System .out .println (res .createWebhook ().get ());
}
}
}
Parameter
Type
Required
Description
Example
idempotencyKey
Optional<String>
➖
A unique key to ensure idempotent requests. This key should be a UUID v4 string.
123e4567-e89b-12d3-a456-426
requestBody
Optional<CreateWebhookRequestBody>
➖
N/A
CreateWebhookResponse
Error Type
Status Code
Content Type
models/errors/ErrorResponse
422
application/hal+json
models/errors/APIException
4XX, 5XX
*/*
Returns a paginated list of your webhooks. If no webhook endpoints are available, the resulting array will be empty. This request should never throw an error.
package hello .world ;
import com .mollie .mollie .Client ;
import com .mollie .mollie .models .components .*;
import com .mollie .mollie .models .errors .ErrorResponse ;
import com .mollie .mollie .models .operations .ListWebhooksRequest ;
import com .mollie .mollie .models .operations .ListWebhooksResponse ;
import java .lang .Exception ;
public class Application {
public static void main (String [] args ) throws ErrorResponse , Exception {
Client sdk = Client .builder ()
.testmode (false )
.security (Security .builder ()
.organizationAccessToken (System .getenv ().getOrDefault ("ORGANIZATION_ACCESS_TOKEN" , "" ))
.build ())
.build ();
ListWebhooksRequest req = ListWebhooksRequest .builder ()
.from ("hook_B2EyhTH5N4KWUnoYPcgiH" )
.limit (50L )
.sort (Sorting .DESC )
.eventTypes (WebhookEventTypes .PAYMENT_LINK_PAID )
.idempotencyKey ("123e4567-e89b-12d3-a456-426" )
.build ();
sdk .webhooks ().list ()
.callAsStream ()
.forEach ((ListWebhooksResponse item ) -> {
// handle page
});
}
}
Parameter
Type
Required
Description
request
ListWebhooksRequest
✔️
The request object to use for the request.
ListWebhooksResponse
Error Type
Status Code
Content Type
models/errors/ErrorResponse
400
application/hal+json
models/errors/APIException
4XX, 5XX
*/*
Updates the webhook. You may edit the name, url and the list of subscribed event types.
package hello .world ;
import com .mollie .mollie .Client ;
import com .mollie .mollie .models .components .Security ;
import com .mollie .mollie .models .components .WebhookEventTypes ;
import com .mollie .mollie .models .errors .ErrorResponse ;
import com .mollie .mollie .models .operations .*;
import java .lang .Exception ;
public class Application {
public static void main (String [] args ) throws ErrorResponse , Exception {
Client sdk = Client .builder ()
.security (Security .builder ()
.organizationAccessToken (System .getenv ().getOrDefault ("ORGANIZATION_ACCESS_TOKEN" , "" ))
.build ())
.build ();
UpdateWebhookResponse res = sdk .webhooks ().update ()
.webhookId ("hook_1234567890" )
.idempotencyKey ("123e4567-e89b-12d3-a456-426" )
.requestBody (UpdateWebhookRequestBody .builder ()
.name ("Webhook #1" )
.url ("https://mollie.com/" )
.eventTypes (UpdateWebhookEventTypes .of (WebhookEventTypes .PAYMENT_LINK_PAID ))
.testmode (false )
.build ())
.call ();
if (res .entityWebhook ().isPresent ()) {
System .out .println (res .entityWebhook ().get ());
}
}
}
Parameter
Type
Required
Description
Example
webhookId
String
✔️
Provide the ID of the related webhook.
hook_1234567890
idempotencyKey
Optional<String>
➖
A unique key to ensure idempotent requests. This key should be a UUID v4 string.
123e4567-e89b-12d3-a456-426
requestBody
Optional<UpdateWebhookRequestBody>
➖
N/A
UpdateWebhookResponse
Error Type
Status Code
Content Type
models/errors/ErrorResponse
404, 422
application/hal+json
models/errors/APIException
4XX, 5XX
*/*
Retrieve a single webhook object by its ID.
Example Usage: get-webhook-200
package hello .world ;
import com .mollie .mollie .Client ;
import com .mollie .mollie .models .components .Security ;
import com .mollie .mollie .models .errors .ErrorResponse ;
import com .mollie .mollie .models .operations .GetWebhookResponse ;
import java .lang .Exception ;
public class Application {
public static void main (String [] args ) throws ErrorResponse , Exception {
Client sdk = Client .builder ()
.testmode (false )
.security (Security .builder ()
.organizationAccessToken (System .getenv ().getOrDefault ("ORGANIZATION_ACCESS_TOKEN" , "" ))
.build ())
.build ();
GetWebhookResponse res = sdk .webhooks ().get ()
.webhookId ("hook_1234567890" )
.idempotencyKey ("123e4567-e89b-12d3-a456-426" )
.call ();
if (res .entityWebhook ().isPresent ()) {
System .out .println (res .entityWebhook ().get ());
}
}
}
Example Usage: get-webhook-200-1
package hello .world ;
import com .mollie .mollie .Client ;
import com .mollie .mollie .models .components .Security ;
import com .mollie .mollie .models .errors .ErrorResponse ;
import com .mollie .mollie .models .operations .GetWebhookResponse ;
import java .lang .Exception ;
public class Application {
public static void main (String [] args ) throws ErrorResponse , Exception {
Client sdk = Client .builder ()
.testmode (false )
.security (Security .builder ()
.organizationAccessToken (System .getenv ().getOrDefault ("ORGANIZATION_ACCESS_TOKEN" , "" ))
.build ())
.build ();
GetWebhookResponse res = sdk .webhooks ().get ()
.webhookId ("hook_1234567890" )
.idempotencyKey ("123e4567-e89b-12d3-a456-426" )
.call ();
if (res .entityWebhook ().isPresent ()) {
System .out .println (res .entityWebhook ().get ());
}
}
}
Parameter
Type
Required
Description
Example
webhookId
String
✔️
Provide the ID of the related webhook.
hook_1234567890
testmode
Optional<Boolean>
➖
You can enable test mode by setting the testmode query parameter to true. Test entities cannot be retrieved when the endpoint is set to live mode, and vice versa.
idempotencyKey
Optional<String>
➖
A unique key to ensure idempotent requests. This key should be a UUID v4 string.
123e4567-e89b-12d3-a456-426
GetWebhookResponse
Error Type
Status Code
Content Type
models/errors/ErrorResponse
404, 422
application/hal+json
models/errors/APIException
4XX, 5XX
*/*
Delete a single webhook object by its webhook ID.
package hello .world ;
import com .mollie .mollie .Client ;
import com .mollie .mollie .models .components .Security ;
import com .mollie .mollie .models .errors .ErrorResponse ;
import com .mollie .mollie .models .operations .DeleteWebhookRequestBody ;
import com .mollie .mollie .models .operations .DeleteWebhookResponse ;
import java .lang .Exception ;
public class Application {
public static void main (String [] args ) throws ErrorResponse , Exception {
Client sdk = Client .builder ()
.security (Security .builder ()
.organizationAccessToken (System .getenv ().getOrDefault ("ORGANIZATION_ACCESS_TOKEN" , "" ))
.build ())
.build ();
DeleteWebhookResponse res = sdk .webhooks ().delete ()
.webhookId ("hook_1234567890" )
.idempotencyKey ("123e4567-e89b-12d3-a456-426" )
.requestBody (DeleteWebhookRequestBody .builder ()
.testmode (false )
.build ())
.call ();
// handle response
}
}
Parameter
Type
Required
Description
Example
webhookId
String
✔️
Provide the ID of the related webhook.
hook_1234567890
idempotencyKey
Optional<String>
➖
A unique key to ensure idempotent requests. This key should be a UUID v4 string.
123e4567-e89b-12d3-a456-426
requestBody
Optional<DeleteWebhookRequestBody>
➖
N/A
DeleteWebhookResponse
Error Type
Status Code
Content Type
models/errors/ErrorResponse
404, 422
application/hal+json
models/errors/APIException
4XX, 5XX
*/*
Sends a test event to the webhook to verify the endpoint is working as expected.
package hello .world ;
import com .mollie .mollie .Client ;
import com .mollie .mollie .models .components .Security ;
import com .mollie .mollie .models .errors .ErrorResponse ;
import com .mollie .mollie .models .operations .TestWebhookRequestBody ;
import com .mollie .mollie .models .operations .TestWebhookResponse ;
import java .lang .Exception ;
public class Application {
public static void main (String [] args ) throws ErrorResponse , Exception {
Client sdk = Client .builder ()
.security (Security .builder ()
.organizationAccessToken (System .getenv ().getOrDefault ("ORGANIZATION_ACCESS_TOKEN" , "" ))
.build ())
.build ();
TestWebhookResponse res = sdk .webhooks ().test ()
.webhookId ("hook_1234567890" )
.idempotencyKey ("123e4567-e89b-12d3-a456-426" )
.requestBody (TestWebhookRequestBody .builder ()
.testmode (false )
.build ())
.call ();
// handle response
}
}
Parameter
Type
Required
Description
Example
webhookId
String
✔️
Provide the ID of the related webhook.
hook_1234567890
idempotencyKey
Optional<String>
➖
A unique key to ensure idempotent requests. This key should be a UUID v4 string.
123e4567-e89b-12d3-a456-426
requestBody
Optional<TestWebhookRequestBody>
➖
N/A
TestWebhookResponse
Error Type
Status Code
Content Type
models/errors/ErrorResponse
404, 422
application/hal+json
models/errors/APIException
4XX, 5XX
*/*