Learn how the API delivers event notifications
webhook-id
: An ID that uniquely identifies each message.
webhook-timestamp
: A Unix timestamp indicating when the event was signed. This timestamp is included in the signature to guard against replay attacks. See Verifying Events for more details.
webhook-signature
: A list of signatures (HMAC-SHA256) created using a secret signing key and will be used to validate the authenticity of an event. Typically, the signature list consists of only one element, but it can contain any number of signatures. It is formatted as a space delimited list of signatures and their corresponding version identifiers. See Verifying Events for more details.
For example:
webhook-timestamp
request header, which provides the Unix timestamp of when the event was signed. Use this timestamp to prevent replay attacks:
webhook-timestamp
is within a valid time window (we recommend up to 3 minutes).webhook-signature
, included as part of the webhook. We sign all webhooks originating from us using the secret signing key. Follow these steps to ensure the event was sent by us:
webhook-id
request header, webhook-timestamp
request header, and a string representation of the request body into a single string, separated by periods.HMAC
SHA256
signature. Then, encode this value using a base64
encoding.webhook-signature
header. If the generated signature matches the provided signature, you can proceed with processing the event.webhook-id
request header in a persistent data store and ensuring that an event has not been processed before. Additionally every webhook event sent has a unique event-id
in the message body that can be used to prevent duplicate processing.
id
: An ID that uniquely identifies each event.type
: The type of event that triggered the webhook, for example, payment_session.created
or payment_session.updated
eventsdata
: The actual payload, which can be a different object depending on the event type. For example, for payment_session.*
events, the payload will always be the payment_session
object.Code Snippet - Receive the webhook event
Code Snippet - Verify the origin and authenticity of the event
Full Sample Code