> For the complete documentation index, see [llms.txt](https://guide.pay.gov.sg/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://guide.pay.gov.sg/webhooks/set-up/events.md).

# Events

## Overview

PaySG generates event data that you can use to inform you of activity on your payment service. When an event occurs, PaySG generates a new [Event object](#event-object). For example, when a payer pays on PaySG, you receive `payment.succeeded` event.

By registering webhook endpoints in your payment service, you enable PaySG to automatically send [Event objects](#event-object) as part of **POST** requests to the registered webhook endpoint hosted by your application.&#x20;

#### Event Object

The Event object we send to your webhook endpoint provides a snapshot of the object that changed.

Currently, we only support the `payment.succeeded` event type.

#### Example event payload

{% code overflow="wrap" %}

```json
{
  "id": "evt_752ced1f-00ce-4905-8c46-367371dd78e6",
  "data": {
    "object": {
      "id": "wLAnFWQLYyYNKBimc2ZkA",
      "due_date": null,
      "metadata": {},
      "payout_id": null,
      "created_at": "2023-07-17T17:15:12.200+08:00",
      "creator_id": "user_655d26a2-ddfc-4718-a008-bd181c1522e8",
      "payer_name": "John Doe",
      "updated_at": "2023-10-02T16:17:08.167+08:00",
      "payer_email": "abc@gmail.com",
      "payment_url": "http://pay.gov.sg/payments/payment01",
      "description": "Payment for XXX",
      "reference_id": "INV001",
      "latest_status": "paid",
      "payer_address": "36 Robinson Road, Singapore 068877",
      "refund_status": "not_refunded",
      "amount_in_cents": 12.34,
      "payment_status": "paid",
      "payer_identifier": "S1234567A",
      "paid_out_timestamp": null,
      "payment_service_id": "payment_service_fd724c82-786b-43ba-b7d7-1eecab0388e1",
      "email_delivery_status": "sent",
      "payment_sent_timestamp": "2023-07-31T10:01:48.761+08:00",
      "stripe_payment_intentId": "pi_3NUnWOLRKRlnGcim1Nzy18Z0",
      "payment_cancelled_timestamp": null,
      "payment_succeeded_timestamp": "2023-10-02T16:17:08.164+08:00",
      "payment_fully_refunded_timestamp": null
    }
  },
  "type": "payment.succeeded",
  "object": "event",
  "created_at": "2023-10-02T16:17:08.210+08:00",
  "payment_service_id": "payment_service_fd724c82-786b-43ba-b7d7-1eecab0388e1"
}
```

{% endcode %}

#### Why event object gets generated

This table describes different scenarios that trigger generating events.

<table><thead><tr><th width="370">Source</th><th>Trigger</th></tr></thead><tbody><tr><td>PaySG platform</td><td>When a user action (i.e. pays) in the PaySG platform results in an API call</td></tr></tbody></table>

## Event delivery behaviours

This section provides documentation on the different behaviors that you can expect when PaySG sends events to your webhook endpoint. Specifically, it covers event retry deliveries and event ordering.

#### Retry behaviour

PaySG attempts to deliver an event to your webhook endpoint for up to 3 days with an exponential back off.&#x20;

If your endpoint has been deleted when PaySG attempts a retry, future retries of that event will be prevented.

#### Event ordering

PaySG doesn’t guarantee delivery of events in the order in which they’re generated.

Your endpoint should not expect delivery of events in order, and needs to handle out-of-order delivery accordingly.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://guide.pay.gov.sg/webhooks/set-up/events.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
