Overview
Events are notifications that KingsPay sends to your server whenever something notable happens in your account, such as a charge being paid or a payout completing. Instead of polling the API for status changes, you register a webhook destination and KingsPay pushes events to it in real time.
For instructions on creating and managing webhook destinations from the Dashboard, see the Webhook Destinations section in the Documentation.
How it works
- You register a publicly accessible HTTPS endpoint as a webhook destination in the Dashboard.
- When an event occurs, KingsPay sends an HTTP
POSTrequest to your endpoint with a JSON payload describing the event. - Your server verifies the request signature to confirm it came from KingsPay, processes the event, and returns a
2xxresponse.
Key concepts
Handling Events
Verify signatures, respond correctly, and handle retries.
Event Structure
Understand the shape of an event payload.
Reliability and retries
KingsPay considers an event delivered when your endpoint returns a 2xx HTTP status code. If your endpoint returns any other status or times out, KingsPay retries delivery up to four times. See Retry Mechanism for the schedule.
The same event can arrive more than once, and events carry no event ID. Make your handler safe to run twice: look up the object by data.id and check the status you already stored before taking any action.
Available events
Events are grouped by resource:
- Charge Events:
payment_charge.created,payment_charge.confirming,payment_charge.partially_paid,payment_charge.succeeded,payment_charge.failed - Payout Events:
payout.created,payout.pending,payout.processing,payout.suspected,payout.succeeded,payout.failed,payout.rejected,payout.returned,payout.updated - Transfers:
transfer.created,transfer.succeeded - Application Fees:
application_fee.created,application_fee.updated - Balance transactions:
balance_transaction.created - API keys:
account_api_key.created,account_api_key.updated,account_api_key.deleted