You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Authenticate and validate incoming webhook request:
// Setup NotificationReceiver with dependency injection or create an instance as follows$notificationReceiver = new \Adyen\Webhook\Receiver\NotificationReceiver(new \Adyen\Webhook\Receiver\HmacSignature);
// Authorize notificationif (!$notificationReceiver->isAuthenticated(
$request['notificationItems'][0]['NotificationRequestItem'],
YOUR_MERCHANT_ACCOUNT,
YOUR_NOTIFICATION_USERNAME,
YOUR_NOTIFICATION_PASSWORD
)) {
thrownewAuthenticationException();
}
// Process each notification itemforeach ($request['notificationItems'] as$notificationItem) {
// validate the notificationif ($notificationReceiver->validateHmac($notificationItem, YOUR_HMAC_KEY)) {
// save notification to your database$this->databaseService->saveNotification($notificationItem);
}
}
returnnewJsonResponse('[accepted]');
NB: set $currentPaymentState to one of the values in \Adyen\Webhook\PaymentStates
Documentation
Visit our documentation page to learn more about handling notifications.
Contributing
We encourage you to contribute to this repository, so everyone can benefit from new features, bug fixes, and any other improvements.
Have a look at our contributing guidelines to find out how to raise a pull request.