Webhook Best Practices
Protect your application's webhook endpoint and handle incoming Stax event notifications using these recommendations for developers.
A webhook is an HTTP POST request that notifies your application when an event occurs. To configure your endpoint and test delivery, follow Setting up your Webhooks.
- Authenticate incoming requests: Check a secret token in your configured target URL before processing the request. Do not treat an object ID or the event name as proof of authenticity.
- Handle errors: Catch processing errors and log diagnostic information without recording secret tokens or sensitive payment data. Return a 2xx HTTP status code only after successful receipt; do not acknowledge failed authentication as successful.
- Handle repeated deliveries: Design processing so that receiving the same notification more than once does not repeat the business action. Stax may resend notifications when your endpoint is unreachable; do not assume a retry schedule or delivery guarantee.
These security practices are recommendations to support your compliance efforts, not a guarantee of compliance or a substitute for applicable requirements. Consult your security and compliance teams to identify required controls, and consult your legal team regarding specific legal requirements.
Common Webhook Events in Stax
In the Stax platform, webhooks can be set up for various important events, such as:
- Creating or updating transactions
- Creating invoices or deposits
- Managing customers, disputes, and team members
- Notifications related to merchant onboarding and activation
Use these events to update your application when the corresponding activity occurs in Stax.
Protect your webhook target URL
Include a secret token in the target URL you register with Stax, and reject requests that do not present the expected token. A matching token demonstrates possession of the secret; it does not independently prove who sent the request. Keep the token out of source control and redact it from application, proxy, and access logs.
Generate a secret specifically for this integration rather than reusing a Stax object ID. This guide does not require merchant, customer, or transaction IDs.
Verify your endpoint's behavior
Test delivery with your sandbox account before using the endpoint in production:
- Send a test request with the expected token and confirm your endpoint receives the event payload and returns a 2xx acknowledgment.
- Send a request with a missing or incorrect token and confirm your endpoint rejects it without processing the event.
- Send the same test notification again and confirm your application does not repeat the business action.
- Test a processing failure and confirm your logs contain enough information to diagnose the error without exposing the token or sensitive payment data.
Your endpoint is ready for further integration testing when valid requests receive a 2xx acknowledgment, invalid tokens are rejected, and repeated notifications do not repeat business actions.
Updated 4 days ago
