What are Webhooks?
Webhooks allow your application to receive real-time notifications when events occur in HOST Pay. Instead of polling the API, HOST Pay will send HTTP POST requests to your specified endpoint whenever a transaction or account event takes place.Common Use Cases
Payment Confirmation
Get notified the moment deposits are successfully processed
Transfer Updates
Track wallet-to-wallet transfers in real time
Payout Status
Monitor withdrawal processing and failures
Balance Changes
React to wallet balance and fee events as they happen
Webhook Events
HOST Pay sends webhooks for the following events. You can subscribe to individual events or use wildcards (e.g.,payment.*) to receive all events in a group.
Payment Events
| Event | Description |
|---|---|
payment.created | A payment transaction has been initiated |
payment.processing | The payment is being processed by the provider |
payment.succeeded | The payment was successfully completed |
payment.failed | The payment could not be completed |
Transfer Events
| Event | Description |
|---|---|
transfer.created | A wallet-to-wallet transfer has been initiated |
transfer.succeeded | The transfer completed successfully |
transfer.failed | The transfer could not be completed |
Payout Events
| Event | Description |
|---|---|
payout.created | A payout request has been created |
payout.succeeded | The payout was successfully settled |
payout.failed | The payout could not be processed |
Wallet Events
| Event | Description |
|---|---|
wallet.balance.updated | A wallet’s balance has changed |
wallet.fee.applied | A fee has been deducted from a wallet |
Transaction Lifecycle Events
| Event | Description |
|---|---|
transaction.created | A new transaction record has been created |
transaction.updated | A transaction’s status or data has changed |
transaction.reconciled | A transaction has been reconciled |
System & Admin Events
| Event | Description |
|---|---|
webhook.secret.rotated | Your webhook signing secret was rotated |
webhook.subscription.enabled | A webhook subscription was activated |
webhook.subscription.disabled | A webhook subscription was deactivated |
account.updated | Your application account was updated |
test.ping | A test event to verify your endpoint |
Webhook Payload
Every webhook delivers a JSON body with this structure:status field inside data reflects the outcome extracted from the event type (e.g., succeeded, failed, created). The metadata object carries any additional context attached to the event.
The event type itself (
payment.succeeded, payout.failed, etc.) is identified by the X-Webhook-Version and event delivery headers, not an event field in the body.Request Headers
Every webhook delivery includes these headers:| Header | Description |
|---|---|
X-HostPay-Signature | HMAC-SHA256 signature of the payload (format: v1=<hex>) |
X-Webhook-Timestamp | Unix timestamp (seconds) when the webhook was sent |
X-Webhook-Version | API version string (e.g., 2025-01) |
X-Webhook-Source | Always HostPay |
X-HostPay-Delivery-Id | Unique delivery ID for idempotency tracking |
Idempotency-Key | Same as X-HostPay-Delivery-Id |
Setting Up Webhooks
Create Endpoint
Set up an HTTPS endpoint to receive POST requests (e.g.,
https://yourapp.com/webhooks/hostpay)Configure in Dashboard
Add your webhook URL and select the events you want to subscribe to in the
HOST Pay dashboard
Store Your Secret
Save the webhook secret displayed during setup — you’ll need it to verify
signatures
Security
How Signatures Work
HOST Pay signs every outgoing webhook using HMAC-SHA256. The signing input is:timestampis the Unix epoch value from theX-Webhook-Timestampheader (as a string).compact_json_bodyis the raw request body serialized with no extra whitespace.
X-HostPay-Signature header with a v1= prefix (e.g., v1=abc123...).
Verification Steps
- Extract the raw timestamp from
X-Webhook-Timestamp. - Read the raw request body before parsing it as JSON.
- Construct the signed string:
timestamp + "." + raw_body. - Compute
HMAC-SHA256(secret, signed_string)and hex-encode it. - Compare your result to the value after the
v1=prefix using a constant-time comparison. - Optional but recommended: Reject requests where the timestamp is more than 5 minutes old to prevent replay attacks.
Handling Webhooks
Best Practices
Respond Quickly — Process Async
Respond Quickly — Process Async
Return a
200 OK as soon as you receive the webhook, then process it in the background. HOST Pay considers any non-2xx response a failure and will retry.Handle Duplicates (Idempotency)
Handle Duplicates (Idempotency)
The same event may be delivered more than once. Use the
X-HostPay-Delivery-Id header or data.id to detect duplicates and skip re-processing.Validate Timestamps
Validate Timestamps
Check that
X-Webhook-Timestamp is within 5 minutes of your server time to prevent replay attacks. Reject requests that are too old.Use HTTPS Only
Use HTTPS Only
Your endpoint must be served over HTTPS. HTTP endpoints will not receive webhooks.
Monitor Failures
Monitor Failures
Track failed deliveries in your logs and set up alerts. After all retry attempts are exhausted, no further automatic retries will occur.
Test in Test Mode First
Test in Test Mode First
Use Test Mode and the
test.ping event to validate your endpoint before processing live events.Retry Policy
If your endpoint returns a non-2xx status code or times out, HOST Pay retries the delivery automatically:- Up to 10 retry attempts after the initial delivery failure
- Exponential backoff: the delay between attempts doubles each time, starting at 60 seconds and capping at 30 minutes
- After all attempts are exhausted, the delivery is marked failed and no further retries occur
Subscribing to Events
You can subscribe to specific events or use wildcard patterns:| Pattern | Events Received |
|---|---|
payment.* | All payment events |
payout.* | All payout events |
transfer.* | All transfer events |
wallet.* | All wallet state change events |
transaction.* | All transaction lifecycle events |
* | Every event emitted by the platform |
Testing Webhooks
Test Mode
All transactions made in Test Mode trigger real webhook deliveries to your
subscribed endpoint
test.ping Event
Use the
test.ping event from the dashboard to verify your endpoint is
reachable and responding correctlyNext Steps
Currency & Conversions
Understand how multi-currency amounts appear in webhook payloads
Deposits Guide
Learn about deposit events and flows
Payouts Guide
Understand payout events and flows