Transformations allow you to modify webhook properties before delivery—change the HTTP method, target URL, or payload structure. Write JavaScript code that runs on each webhook to customize how events are delivered to your endpoint.Documentation Index
Fetch the complete documentation index at: https://docs.paynext.com/llms.txt
Use this file to discover all available pages before exploring further.
Enable Transformations
Transformations are configured per endpoint:Write a Transformation
Transformations declare ahandler function that receives the webhook object and returns a modified version.
Input properties
| Property | Type | Description |
|---|---|---|
method | string | HTTP method ("POST" or "PUT") |
url | string | Endpoint URL (can be changed) |
payload | object | Webhook payload (can be modified) |
eventType | string | Event type (read-only) |
Output properties
Return the same object with modifications. You can also set:| Property | Type | Description |
|---|---|---|
cancel | boolean | Set true to skip delivery (defaults to false) |
headers | object | Custom headers to include in the request |
Examples
Redirect to custom URL
Route webhooks to a URL specified in the payload:Add custom headers
Include authentication or tracking headers:Filter events
Cancel delivery for specific conditions:Transform payload structure
Reshape the payload to match your system’s expected format:Change HTTP method
Some systems expect PUT instead of POST:Testing Transformations
Before saving, test your transformation against sample payloads:- Click Test in the transformation editor
- Select an event type or enter a custom payload
- Review the transformed output
- Verify the URL, method, headers, and payload are correct