> ## Documentation Index
> Fetch the complete documentation index at: https://apidocs.paylias.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# Event Structure

> Understand the event payload and see examples for different events

Currently Paylias supports webhook notifications for events that occur during the lifecycle of a payment. Additional events for other flows outside the scope of a payment will be added in due course. Your feedback is invaluable to us. Please feel free to suggest priority event categories you'd like us to focus on for future updates.

## Event definition

When Paylias POSTs a notification to your endpoint, the payload will be a JSON object that contains the following fields

<ResponseField name="token" type="string" required>
  Unique identifier for the event.
</ResponseField>

<ResponseField name="version" type="string" required>
  Currently 1.0.0, the version in use by Paylias Webhook APIs
</ResponseField>

<ResponseField name="event_type" type="string" required>
  Description of the event

  Currently can be one of two values: `EK_Created` or `EK_Updated`
</ResponseField>

<ResponseField name="record_type" type="string" required>
  Record type of the payload

  Currently can be one of the following values:

  `RT_Payments`

  `RT_PaymentSubmissions`

  `RT_PaymentAdmissions`

  `RT_PaymentAdmissionTasks`

  `RT_Error`

  `RT_Transactions`
</ResponseField>

<ResponseField name="endpoint" type="string" required>
  The destination endpoint for the webhook subscription
</ResponseField>

<ResponseField name="data" type="any" required>
  Object containing data associated with the event.

  This field will contain the resource corresponding to the `record_type`
</ResponseField>

<ResponseField name="created_at" type="Timestamp" required>
  UTC Unix timestamp in seconds for when this event was created
</ResponseField>

#### Example Event

```json Payment Created Event expandable theme={null}
{
  "token": "cjes76vsemvj3obsnc54",
  "version": "1.0.0",
  "event_type": "EK_Created",
  "resource_type": "RT_Payments",
  "endpoint": "https://www.postb.in/1743269295619-3870068176183",
  "data": {
    "payment_id": "cjes76vsemvj3obsnc54",
    "organization_id": "org_ct239n420or249k5bo90",
    "partner_id": "part_ct23b6420or249k5boag",
    "reference": "INV0001",
    "initiated_at": 1744270523,
    "expires_at": 1744274123,
    "amount": {
      "currency": "USD",
      "total": "10000"
    },
    "debtor_party": {
      "payment_address": "john@stripe-platinum",
      "first_name": "John",
      "last_name": "Collison",
      "email": "johnc@stripe.com",
      "phone": "+16462442945",
      "type": "Payee_Individual",
      "billing": {
        "country": "US"
      }
    },
    "beneficiary_party": {
      "payment_address": "ziyad@safepay-platinum",
      "first_name": "Ziyad",
      "last_name": "Parekh",
      "email": "ziyad.parekh@gmail.com",
      "phone": "+923008277879",
      "type": "Payee_Individual",
      "billing": {
        "country": "US"
      }
    },
    "device": {},
    "location": {}
  },
  "created_at": {
    "seconds": 1744270524,
    "nanos": 58146000
  }
}
```

## Notification definition

When you use the [List events](/api-reference/webhooks/list-events) endpoint, or view delivered events through the dashboard, the structure is slightly different. This endpoint gives additional details surrounding the event. The notification object has the following fields

<ResponseField name="token" type="string" required>
  Unique identifier for the notification
</ResponseField>

<ResponseField name="notification_id" type="string" required>
  Notification ID foreign key reference
</ResponseField>

<ResponseField name="webhook_id" type="string" required>
  ID to link it back to the original webhook subscription
</ResponseField>

<ResponseField name="event_kind" type="EventKind" required>
  Description of the event

  Currently can be one of two values:

  `1` corresponds to `EK_Created`

  `2` corresponds to `EK_Updated`
</ResponseField>

<ResponseField name="record_type" type="RecordType" required>
  Record type of the payload

  Currently can be one of the following values:

  `1` corresponds to`RT_Error`

  `2` corresponds to`RT_Payments`

  `3` corresponds to`RT_PaymentSubmissions`

  `4` corresponds to`RT_PaymentAdmissions`

  `5` corresponds to`RT_PaymentAdmissionTasks`

  `6` corresponds to`RT_Transactions`
</ResponseField>

<ResponseField name="payload" type="string" required>
  The raw bytes for the payload for the message

  This field contains a base64 encoded string of the JSON `event` defined above.
</ResponseField>

<ResponseField name="endpoint_url" type="string" required>
  The recipient endpoint URL
</ResponseField>

<ResponseField name="signature" type="string" required>
  HMAC signature for verifying the payload
</ResponseField>

<ResponseField name="status" type="DeliveryStatus" required>
  The status of the notification
</ResponseField>

<ResponseField name="delivery_attempts" type="number" required>
  The number of delivery attempts made so far for this notification
</ResponseField>

<ResponseField name="created_at" type="Timestamp" required>
  The timestamp of when the webhook notification was created
</ResponseField>

<ResponseField name="updated_at" type="Timestamp" required>
  The timestamp of when the webhook notification was last updated
</ResponseField>

#### Example Webhook Notification

```json Webhook Notification theme={null}
{
  "token": "wh_cvrn9f420or7jl6nihg0",
  "notification_id": "notif_cvrn9es20or7jl6nihfg",
  "webhook_id": "whk_cvk2qqs20or7iffvl200",
  "event_kind": 1,
  "record_type": 2,
  "payload": "eyJ0b2tlbiI6ImNqZXM3NnZzZW12ajNvYnNuYzU0IiwidmVyc2lvbiI6IjEuMC4wIiwiZXZlbnRfdHlwZSI6IkVLX0NyZWF0ZWQiLCJyZXNvdXJjZV90eXBlIjoiUlRfUGF5bWVudHMiLCJlbmRwb2ludCI6Imh0dHBzOi8vd3d3LnBvc3RiLmluLzE3NDMyNjkyOTU2MTktMzg3MDA2ODE3NjE4MyIsImRhdGEiOnsicGF5bWVudF9pZCI6ImNqZXM3NnZzZW12ajNvYnNuYzU0Iiwib3JnYW5pemF0aW9uX2lkIjoib3JnX2N0MjM5bjQyMG9yMjQ5azVibzkwIiwicGFydG5lcl9pZCI6InBhcnRfY3QyM2I2NDIwb3IyNDlrNWJvYWciLCJyZWZlcmVuY2UiOiJJTlYwMDAxIiwiaW5pdGlhdGVkX2F0IjoxNzQ0MjcwNTIzLCJleHBpcmVzX2F0IjoxNzQ0Mjc0MTIzLCJhbW91bnQiOnsiY3VycmVuY3kiOiJVU0QiLCJ0b3RhbCI6IjEwMDAwIn0sImRlYnRvcl9wYXJ0eSI6eyJwYXltZW50X2FkZHJlc3MiOiJqb2huQHN0cmlwZS1wbGF0aW51bSIsImZpcnN0X25hbWUiOiJKb2huIiwibGFzdF9uYW1lIjoiQ29sbGlzb24iLCJlbWFpbCI6ImpvaG5jQHN0cmlwZS5jb20iLCJwaG9uZSI6IisxNjQ2MjQ0Mjk0NSIsInR5cGUiOiJQYXllZV9JbmRpdmlkdWFsIiwiYmlsbGluZyI6eyJjb3VudHJ5IjoiVVMifX0sImJlbmVmaWNpYXJ5X3BhcnR5Ijp7InBheW1lbnRfYWRkcmVzcyI6InppeWFkQHNhZmVwYXktcGxhdGludW0iLCJmaXJzdF9uYW1lIjoiWml5YWQiLCJsYXN0X25hbWUiOiJQYXJla2giLCJlbWFpbCI6InppeWFkLnBhcmVraEBnbWFpbC5jb20iLCJwaG9uZSI6Iis5MjMwMDgyNzc4NzkiLCJ0eXBlIjoiUGF5ZWVfSW5kaXZpZHVhbCIsImJpbGxpbmciOnsiY291bnRyeSI6IlVTIn19LCJkZXZpY2UiOnt9LCJsb2NhdGlvbiI6e319LCJjcmVhdGVkX2F0Ijp7InNlY29uZHMiOjE3NDQyNzA1MjQsIm5hbm9zIjo1ODE0NjAwMH19",
  "endpoint_url": "https://www.postb.in/1743269295619-3870068176183",
  "signature": "c568b3bf6d1621e9d79f8b8db3d83e4c30053fa610f265e3fd61aa4f5e123b1e123e390b26fdc74c3ab15eaef00e56d79f4c1321461f1aa9e9fbe4f9a6d78a61",
  "status": 0,
  "delivery_attempts": 1,
  "created_at": {
      "seconds": 1744270524
  },
  "updated_at": {
      "seconds": 1744270525
  }
},
```
