public class Webhook
extends java.lang.Object
Class containing a collection of functions for validating and parsing GoCardless webhooks
| Modifier and Type | Method and Description |
|---|---|
static boolean |
isValidSignature(java.lang.String requestBody,
java.lang.String signatureHeader,
java.lang.String webhookEndpointSecret)
Validates that a webhook was genuinely sent by GoCardless by computing its signature using the body and your webhook endpoint secret, and comparing that with the signature included in the
Webhook-Signature header. |
static java.util.List<Event> |
parse(java.lang.String requestBody,
java.lang.String signatureHeader,
java.lang.String webhookEndpointSecret)
Validates that a webhook was genuinely sent by GoCardless using
isValidSignature, and then parses it into an array of com.gocardless.resources.Event objects representing each event included in the webhook. |
public static java.util.List<Event> parse(java.lang.String requestBody, java.lang.String signatureHeader, java.lang.String webhookEndpointSecret)
Validates that a webhook was genuinely sent by GoCardless using isValidSignature, and then parses it into an array of com.gocardless.resources.Event objects representing each event included in the webhook.
requestBody - the request bodysignatureHeader - the signature included in the request, found in the Webhook-Signature headerwebhookEndpointSecret - the webhook endpoint secret for your webhook endpoint, as configured in your GoCardless DashboardInvalidSignatureException - if the signature header specified does not match the signature computed using the request body and webhook endpoint secretpublic static boolean isValidSignature(java.lang.String requestBody,
java.lang.String signatureHeader,
java.lang.String webhookEndpointSecret)
Validates that a webhook was genuinely sent by GoCardless by computing its signature using the body and your webhook endpoint secret, and comparing that with the signature included in the Webhook-Signature header.
requestBody - the request bodysignatureHeader - the signature included in the request, found in the Webhook-Signature headerwebhookEndpointSecret - the webhook endpoint secret for your webhook endpoint, as configured in your GoCardless Dashboard