Skip to main content

Events

Learn more about the Event resource.

An Event resource represents updates in your PayRex account triggered either by API calls or your actions from the Dashboard. When an event occurs, for example, a successfully paid payment is received, PayRex creates a new Event resource with type payment_intent.succeeded.

Events occur when the state or attribute values of different API resources change. An Event resource's data attribute contains the resource's state or snapshot at the time of the change. For example, a payment_intent.succeeded event contains a Payment Intent, and a payment.refunded event contains a Payment resource.

The Event Resource

{
"id": "evt_bxuGtXXC3zNsWbW3W1zQKiLWf67ZC4sa",
"resource": "event",
"type": "payment_intent.succeeded",
"livemode": false,
"pending_webhooks": 1,
"data":{
"resource": {
"id": "pi_SJuGtXXC3XNRWpW3W1zQKiLWf67ZC4sX",
"resource": "payment_intent",
"amount": 10000,
"payment_methods": ["card", "gcash"],
"status": "awaiting_payment_method",
"capture_type": "automatic",
"client_secret": "pi_SJuGtXXC3XNRWpW3W1zQKiLWf67ZC4sX_secret_7KGizzHuLtPtaLwiRMHekBHRUo6yv52r",
"currency": "PHP",
"description" :"",
"livemode": test,
"metadata": null,
"next_action": {
"type": "redirect",
"redirect_url": "https://my-application/redirect"
},
"created_at": 1700407880,
"updated_at": 1700407880
},
"previous_attributes": {
"status": "awaiting_next_action"
}
},
"created_at": 1680064018,
"updated_at": 1680064015
}

Attributes


id string

Unique identifier for the resource. The prefix is evt_.


resource string

Represents the resource's type. The value is event.


type string

The type of the event.


livemode boolean

The value is true if the resource's mode is live or the value is false if the resource mode is test.


pending_webhooks integer

The number of webhooks that haven't been successfully delivered the Event resource.


data hash

Contains the resource associated with the event, and the previous values if the event is a resource update. For example, if the event type is payment_intent.succeeded, this will contain a PaymentIntent resource.

Child attributes

data.resource hash

Contains the resource associated with the event

data.previous_attributes hash

A hash that contains previous values of an attribute if the event is a resource update.


created_at timestamp

The time when the resource was created. Measured in seconds since the Unix epoch.


updated_at timestamp

The time when the resource was updated. Measured in seconds since the Unix epoch.