Webhooks
Using SQUAKE Webhooks API to receive notifications about your customers' purchase-related events
What are Webhooks?
Webhooks are HTTP callbacks that notify your application when events happen in SQUAKE's system. Instead of continuously polling our API, webhooks push data to your endpoint when events occur.
Common Use Cases
Payment status notifications
Documents status updates (compensation confirmation/certificates are ready)
Implementation Guide
You can setup different webhooks for different kinds of events:
order
- weโll send you an event when purchase which was made via stripe changes status
confirmation_document_available
- weโll send a document when itโs generated
certificate_document_available
- weโll send a document when itโs generated
Validating incoming webhooks
When SQUAKE sends webhooks to your endpoint, we include a signature in the headers that allows you to verify that the request came from us. Here's how to validate the webhooks:
Headers
Each webhook request includes the following security-related headers:
HTTP_SQUAKE_SIGNATURE
: HMAC-SHA256 signature of the payloadHTTP_SQUAKE_TIMESTAMP
: ISO8601-formatted timestamp of when the webhook was sent
Validation Process
Get the raw request body as a string
Get the signature from the
HTTP_SQUAKE_SIGNATURE
headerCalculate the HMAC-SHA256 using your signing key:
Request Body Format
The webhook payload is wrapped in a data
object:
Kinds of Webhooks
Order webhook
Type: order
Whenever you request a pricing using /pricing
endpoint, itโs possible to pass a payment_method: "stripe"
parameter. If itโs passed then weโll return a paymet_link
in the response:
You can add extra query parameters to this link in order to help you to track a specific purchase later, when you receive a webhook. One of the parameters you can pass is: external_reference
.
If youโll add it to the link:
Then weโll send it back to you in the webhook payload.
Whenever payment is done/cancelled/refunded, weโll send you a webhook, hereโs an example webhook payloads:
Possible payment_status
values:
complete
- payment successfully completedcanceled
- payment is canceledfailed
- payment failed to processsucceeded
- payment is successfulrefunded
- payment is refunded
Confirmation Document Available
Type: confirmation_document_available
Notifies you when a compensation confirmation document is ready for download.
Payload
Certificate Document Available Webhook
Type: certificate_document_available
Notifies you when a certificate document is ready for download.
Payload
Webhook API Reference
Last updated
Was this helpful?