diff --git a/app/controllers/checkouts_controller.rb b/app/controllers/checkouts_controller.rb index fbb0dd0..1ad7454 100644 --- a/app/controllers/checkouts_controller.rb +++ b/app/controllers/checkouts_controller.rb @@ -51,6 +51,7 @@ def handle_shopper_redirect def adyen_webhooks notifications = params["notificationItems"] response = Checkout.adyen_webhooks(notifications) - render json: response + # Return 202 with empty body + render status: 202, body: '' end end diff --git a/app/models/checkout.rb b/app/models/checkout.rb index 79b1e06..2b14048 100644 --- a/app/models/checkout.rb +++ b/app/models/checkout.rb @@ -58,9 +58,10 @@ def adyen_webhooks(notifications) if validator.valid_notification_hmac?(notification, hmacKey) puts notification["eventCode"] puts notification["merchantReference"] - "[accepted]" + # Send a 202 response with an empty body + "Ok" else - # In case of invalid hmac, do not send [accepted] response + # In case of invalid hmac raise "Invalid HMAC Signature" end end