Paysafe’s instant, real-time notifications are Webhooks that inform you of all the status updates. A Webhook is an HTTP callback which is triggered when an event takes place. You can specify the destination URL in the form of an HTTP request when creating a Webhook. Notifications are delivered to this URL on your server based on event occurrences.
To receive notifications from Paysafe for status updates, create user-defined HTTP callbacks for those events. These callbacks push notifications to your destination whenever an event occurs. You are responsible for ensuring its continued availability.
Why use Webhooks?
You can use Webhooks whenever you want to know and act upon event occurrences such. You can configure your Webhook subscription for events such as `payment failed, Payment cancelled, and so on, and notify yourself for these events. For a detailed list of supported Webhook events, refer to the section “List of supported webhook events and topics”.
Webhook Request Details
When you configure your Webhooks subscription, events are created and sent asynchronously as they occur. Paysafe notification messages are POST requests that carry a JSON-encoded payload along with the HTTP headers. You need to use both – the header and the JSON string – to consume a webhook. These payloads have minimum details about the triggered event. Paysafe returns links to the corresponding API resource. You can use this to find detailed information on a resource that has changed the state. To configure Webhooks, open a service request in the Business Portal.
HTTP headers are useful when consuming a Webhook request. Among many HTTP headers, Paysafe also includes a Webhook signature header that you can use to verify the Webhook.
The webhook notification contains a signature header calculated using the following algorithm:
digest = HMAC_SHA256 (hmacKey, UTF 8 string containing the JSON webhook request body)
signature = base 64 (digest)
The code receiving the webhook needs to repeat this algorithm and compare the value generated with the value received in the header.
A Webhook payload contains information about the event that occurred. It has _links to the corresponding resource that triggered the event. The payload also includes attributes such as timestamp, the topic of the event and the id of the resource.
Example Webhook Payload
This is an example of a typical webhooks payload you would receive from Paysafe.
See Webhooks Events to view a list of events in the API that can trigger webhooks.
Paysafe strongly recommends Webhooks for Payment Methods that require a “redirect” flow, such as Skrill, Paysafecard, Paysafecash, Paypal, Interac, VIP Preferred, Play+(Sightline).