Webhooks
Neutron uses webhooks to notify your server in real-time when key transaction events occur. Once configured, your webhook endpoint will receive a callback whenever a transaction reaches a terminal state (e.g., completed
, expired
, rejected
, or error
).
๐ฆ Webhook Events
Webhooks are triggered only when a transaction enters a final state. These include:
completed
Transaction was completed successfully
expired
Transaction expired (not confirmed/funded)
rejected
Transaction rejected due to validation errors
error
System error โ manual intervention required
๐ How to Set Up Webhooks
You must register a webhook endpoint using the following API:
๐ง Create a Webhook
POST /api/v2/webhook/
Headers:
Body:
โ๏ธ Update an Existing Webhook
PUT /api/v2/webhook/{webhookId}
Same headers and body format as above.
๐ฌ Get Registered Webhook
GET /api/v2/webhook/
Returns a list of registered webhooks for the account.
โ Delete a Webhook
DELETE /api/v2/webhook/{webhookId}
Removes the registered webhook from the account.
๐ค Webhook Callback Payload
When triggered, Neutron sends a PUT
request to your webhook URL with the following structure:
Headers:
Payload:
๐ Signature Verification
Neutron signs each callback with a X-Neutron-Signature
header. The signature is an HMAC SHA-256 hash of the JSON body, using your webhook secret.
Signature Generation (Node.js Example):
Compare the computed hash to the X-Neutron-Signature
header to verify authenticity.
๐งช Tips for Handling Webhooks
Verify authenticity using the signature
Acknowledge quickly by returning a 2xx response
Avoid timeouts โ process asynchronously if needed
Retry support โ Neutron may retry delivery on failure
Last updated