Handle
Overview
The handle method processes raw webhook payloads from payment processors. It verifies webhook signatures, parses the event data, and returns a normalized response with the event type and associated payment details.
Business Use Case: When Stripe sends a webhook notification that a payment succeeded, you need to verify it's authentic and update your order status. This method handles verification and parsing.
Purpose
Signature verification
Automatically verifies webhook authenticity
Multiple formats
Normalizes Stripe, Adyen into consistent format
Security
Validates secrets before processing
Request Fields
merchantEventId
string
Yes
Your unique event reference
payload
string/object
Yes
Raw webhook body
headers
object
Yes
HTTP headers including signature
webhookSecret
string
Yes
Webhook signing secret
Response Fields
eventType
string
Type: payment.captured, refund.succeeded, etc.
eventResponse
object
Payment/refund/dispute details
sourceVerified
boolean
Whether signature was verified
eventStatus
string
COMPLETE, INCOMPLETE
Example
SDK Setup
Express.js Webhook Handler
Response
Event Types
payment.authorized
Payment authorized, funds held
payment.captured
Payment completed
payment.failed
Payment declined
refund.succeeded
Refund processed
dispute.created
New chargeback received
Next Steps
Payment Service - Process payment events
Refund Service - Process refund events
Dispute Service - Process dispute events
Last updated
Was this helpful?

