Top-level webhook utilities.
Parses and validates incoming Adyen webhook payloads and dispatches them to your configured handler module.
Quick start
- Add
AdyenClient.Webhooks.Plugto your router (requires:plugdep). - Or call
AdyenClient.Webhooks.process/3manually in your controller.
Event codes reference
Standard events: AUTHORISATION, CAPTURE, CANCEL, REFUND, REFUND_FAILED, CANCEL_OR_REFUND, CAPTURE_FAILED, REFUNDED_REVERSED, EXPIRE, VOID_PENDING_REFUND, ORDER_OPENED, ORDER_CLOSED, REPORT_AVAILABLE, TECHNICAL_CANCEL.
Dispute events: NOTIFICATION_OF_CHARGEBACK, CHARGEBACK, CHARGEBACK_REVERSED, SECOND_CHARGEBACK, NOTIFICATION_OF_FRAUD, REQUEST_FOR_INFORMATION, INFORMATION_SUPPLIED, PREARBITRATION_OPEN, PREARBITRATION_LOST, PREARBITRATION_WON, PREARBITRATION_DECLINED, PREARBITRATION_ACCEPTED, PREARBITRATION_ISSUER_WITHDRAWN, SCHEME_ARBITRATION, DISPUTE_DEFENSE_PERIOD_ENDED, ISSUER_COMMENTS, ISSUER_RESPONSE_TIMEFRAME_EXPIRED.
Additional: AUTORESCUE, CANCEL_AUTORESCUE, MANUAL_REVIEW_ACCEPT, MANUAL_REVIEW_REJECT, OFFER_CLOSED, POSTPONED_REFUND, RECURRING_CONTRACT, ACH_NOTIFICATION_OF_CHANGE, DIRECT_DEBIT_NOTICE_OF_CHANGE_NOTIFICATION.
Summary
Functions
Parse the raw JSON body into a map.
Parse, validate, and dispatch a raw webhook payload.
Validate HMAC for all notification items in a parsed payload.
Functions
@spec parse(String.t()) :: {:ok, map()} | {:error, AdyenClient.Error.t()}
Parse the raw JSON body into a map.
@spec process(String.t(), String.t(), module()) :: :ok | {:error, AdyenClient.Error.t()}
Parse, validate, and dispatch a raw webhook payload.
raw_body must be the unmodified request body string.
hmac_key is the HMAC key configured in Adyen for this webhook endpoint.
handler is the module implementing AdyenClient.Webhooks.Handler.
Returns :ok on success or {:error, AdyenClient.Error.t()} on HMAC failure.
@spec validate_all(map(), String.t()) :: :ok | {:error, AdyenClient.Error.t()}
Validate HMAC for all notification items in a parsed payload.