public class WebhooksHelper extends Object
| Constructor and Description |
|---|
WebhooksHelper() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
isValidWebhookEventSignature(String requestBody,
String signatureHeader,
String signatureKey,
String notificationUrl)
Verifies and validates an event notification.
|
public static boolean isValidWebhookEventSignature(String requestBody, String signatureHeader, String signatureKey, String notificationUrl)
requestBody - The JSON body of the request.signatureHeader - The value for the x-square-hmacsha256-signature header.signatureKey - The signature key from the Square Developer portal for the webhook subscription.notificationUrl - The notification endpoint URL as defined in the Square Developer portal for the webhook subscription.true if the signature is valid, indicating that the event can be trusted as it came from Square.false if the signature validation fails, indicating that the event did not come from Square, so it may be malicious and should be discarded.Copyright © 2024. All rights reserved.