Introduction

Why use webhooks?

Webhooks are a useful tool when building PaySG integrations, as they allow your e-services to receive events in real-time as they occur in your payment service.

To enable webhook events, you will need to register webhook endpoints. Once registered, PaySG can push real-time event data to your application's webhook endpoint whenever events happen in your PaySG account. PaySG uses HTTPS to send webhook events to your app as a JSON payload that includes an Event object.

Receiving webhook events is particularly useful for listening to asynchronous events. The current version of webhooks supports events for when a payer has paid.

Overview

To begin receiving webhook events in your application, you can create and register a webhook endpoint by following these steps:

  1. Identify the specific events that you want to monitor.

  2. Develop a webhook endpoint function that can receive event data POST requests on your e-service.

  3. Register your endpoint with the PaySG team. For now, this can be done by contacting the team and providing the following fields for them.

    • webhook_url the endpoint of your e-service that PaySG should send webhooks to.

    • description optional field for you to describe the webhook.

    • subscribed_events list of subscribed events from PaySG that your e-service would like to subscribe to.

  4. Ensure that your webhook endpoint is secure to prevent unauthorized access.

Refer to our next section on set up for more information.

Last updated