Setting up your Webhooks

In this document, we will guide you through setting up a webhook in Stax Payments. Webhooks are essential for receiving real-time notifications about events in your Stax Payments account, such as transaction updates or customer actions. Following the steps outlined below, you can configure a webhook that meets your business needs.

Step 1: Locate the Webhooks Section

  1. Click Settings on the left menu.
  2. Click on Webhooks to access the webhook management interface.

Step 3: Create a New Webhook

  1. You will be prompted to enter the following details:
    1. Webhook URL: This is the endpoint on your server that will receive the webhook notifications. Ensure that this URL is publicly accessible.
    2. Event Types: Select the events for which you want to receive notifications (e.g., payment completed, refund issued, etc.).
    3. Secret Key: To verify the authenticity of the webhook requests, you can generate a secret key in your URL that you can modify to add additional security. To change the URL, you can use the UI or a PUT endpoint.


Step 4: Test Your Webhook

After saving your webhook configuration, it’s important to test it to ensure it works correctly.

  1. You can test using your sandbox account.
  2. To test responses, use a site like webhook.site to see and verify response information.

Step 5: Handle Incoming Webhook Requests

  1. Implement the logic on your server to handle incoming webhook requests.
  2. Parse the incoming data and perform the necessary actions based on the event type received.
  3. If you set a secret key, validate the signature of the incoming requests to ensure they are from Stax Payments.

Post Body Details

Stax Webhooks POST details vary by event but will return the associated object related to the event.

For example, the create\_transaction webhook will POST the transaction object when a transaction is created.

The request header will include a stax-event-name value, which correlates to the event\_name that was set on the webhook.

Using the same example from above, the following will return in the header: stax-event-name: create_transaction.All endpoints accept and return JSON.

Step 6: Monitor and Maintain Your Webhook

  1. Regularly check the status of your webhook to ensure it is functioning correctly.
  2. Update your webhook settings if there are any changes to your server or if you need to modify the events you are subscribed to.

By following these steps, you will successfully set up a webhook in Stax Payments, which allows you to automate processes and respond to events in real time. If you encounter any issues, refer to the Stax Payments documentation or contact the support team for assistance.