Paisr uses webhooks to notify your application of events that occur in your profile. Webhooks enable you to receive real-time updates without having to poll the API.
How they work
Whenever an event occurs, like a payment being made or a customer being created, Paisr creates and event payload and sends it as an HTTP POST request to your specified endpoint(s).
Each event payload includes:
- The id of the resource that triggered the webhook
- The event type (e.g.
invoice.paid,customer.created)
{
"id": "inv_123456",
"event": "invoice.paid"
}Managing Webhooks
You can create, and manage webhooks from the Developer section in your Dashboard or by using the Webhooks API. You can subscribe to events that you are interested in and receive notifications when they occur.
Authenticating Webhooks
To verify that a webhook was sent by Paisr, each request includes the following headers:
- X-PCB-Signature: A signature of the request payload, used to verify the authenticity of the request.
- X-PCB-Timestamp: The timestamp of the request, used to verify the request was not tampered with.
Learn more about verifying webhooks.
Retries & Reliability
If your server fails to respond with a 2XX status code, Paisr will retry the request up to 10 times with exponential backoff.
You can track delivery metrics and retry failed requests from the Dashboard or by using
the Webhooks API.
Best Practices
When using webhooks, it's important to ensure that you follow best practices to avoid issues:
- Always verify the authenticity of the webhook request using the X-PCB-Signature and X-PCB-Timestamp headers.
- Avoid blocking or long-running operations in your webhook handler and return a
2XXstatus code as quickly as possible. - Frequently monitor and debug your webhook handler to ensure it's working as expected.
- Log webhook receipts and errors to help with debugging and monitoring.