API Reference

Events are our way of letting you know when something interesting happens in your account. When an interesting event occurs, we create a new Event object. For example, when checkout is completed, we create a checkout.session.completed event.

Events occur when the state of another API resource changes. The state of that resource at the time of the change is embedded in the event's data field. For example, a checkout.session.completed event will contain a checkout object.

As with other API resources, you can use endpoints to retrieve an individual event or a list of events from the API. We also have a separate webhooks system for sending the Event objects directly to an endpoint on your server. Webhooks are managed in your account settings, and our Using Webhooks guide will help you get set up.

Related guide: Webhooks

Event Object

{
  "id": "evt_1MDpQdJpH8mQ1ZZWYNzu7a30",
  "object": "event",
  "created": 1670764731,
  "data": {
    "object": {
      "id": "cs_a1U7SSk86e6DUcjD9Zg7c26WqxP13PEG0pIt2TvAGPmyK9kDnD4kGR4tri",
      "object": "checkout.session",
      "amount_total": 10.99,
      "cancel_url": "https://example.com/cancel",
      "created": 1671995248,
      "expires_at": 1671995248,
      "payment_link_id": "",
      "status": "completed",
      "success_url": "https://example.com/success",
      "url": "https://fanspay.io/checkout/cs_a1U7SSk86e6DUcjD9Zg7c26WqxP13PEG0pIt2TvAGPmyK9kDnD4kGR4tri",
      "transaction_status": "unconfirmed"
    }
  },
  "type": "checkout.session.completed"
}

Attributes

AttributeTypeDescription
idstringUnique identifier for the object.
objectstringThe string represents the object’s type. Objects of the same type share the same value.
creatednumberTime at which the object was created. Measured in seconds since the Unix epoch.
data.objectObjectThe object containing the API resource relevant to the event. For example, a checkout.session.completed event will have a full checkout session object as the value of the object key.
typestringDescription of the event (e.g., checkout.session.completed)