> For the complete documentation index, see [llms.txt](https://docs.digitalriver.com/digital-river-api/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.digitalriver.com/digital-river-api/order-management/events-and-webhooks-1/events-1.md).

# Events

When something noteworthy happens in your account, we create an [event](https://docs.digitalriver.com/digital-river-api-reference/2021-12-13/events). More specifically, an event is created when the state of another API resource changes. Your integration can use these events to listen for and handle important updates in your account.

In the Digital River APIs, there are numerous [event types](#event-types) that you can subscribe to. There are, however, certain [key event types](/digital-river-api/order-management/events-and-webhooks-1/events-1/event-types.md) that we recommend every integration monitors.

Nearly all cases, an [event's data](#event-data) contains the resource whose state changed.

You can also subscribe to expanded events, which contain more data.

To subscribe to an event, you must set up [webhooks](/digital-river-api/order-management/events-and-webhooks-1/webhooks.md) that send designated events directly to an endpoint on your server. The [Digital River Dashboard](/digital-river-api/administration/dashboard.md) contains a complete list of our supported event types. To access this list, [create a webhook](/digital-river-api/administration/dashboard/developers/webhooks/creating-a-webhook.md) or [view the details of an existing webhook](/digital-river-api/administration/dashboard/developers/webhooks.md).

You can also use the [Events API](https://docs.digitalriver.com/digital-river-api-reference/2021-12-13/events) to [return a list of events](https://docs.digitalriver.com/digital-river-api-reference/2021-12-13/events#events) or [retrieve an individual event](https://docs.digitalriver.com/digital-river-api-reference/2021-12-13/events#events-id).‌

## Event types

[Events ](https://docs.digitalriver.com/digital-river-api-reference/2020-12-17/events)use the following naming convention: `resource.event`.

The event's `type` usually reflects the current state of that resource. For example, when an [order's ](https://docs.digitalriver.com/digital-river-api-reference/2021-12-13/orders)[`state`](https://docs.digitalriver.com/digital-river-api-reference/2021-12-13/orders/order-basics#order-states-and-events) moves to `accepted`, we create an [event](https://docs.digitalriver.com/digital-river-api-reference/2021-12-13/events) whose `type` is [`order.accepted`](/digital-river-api/order-management/creating-and-updating-an-order.md#listening-for-the-order-accepted-event) and when an [invoice ](https://docs.digitalriver.com/digital-river-api-reference/2021-12-13/invoices)becomes [`uncollectible`](https://docs.digitalriver.com/digital-river-api-reference/2021-12-13/invoices/invoice-basics#invoice-states), we create an [event ](https://docs.digitalriver.com/digital-river-api-reference/2021-12-13/events)whose `type` is `invoice.uncollectible`.

{% code title="Event" %}

```json
{
    "id": "86976837-18b5-473c-9a2e-7e774a827670",
    "type": "order.accepted",
    "data": {
        "object": {
            "id": "247468780336",
            ...
            "state": "accepted",
            ...
        }
    },
    ...
}
```

{% endcode %}

There are, however, certain exceptions. For example, an event with a `type` of [`subscription.extended`](https://docs.digitalriver.com/digital-river-api/order-management/events-and-webhooks-1/pages/okHqAQ9d1PaLPLjq6nZF#subscription.extended) indicates that the [subscription's ](https://docs.digitalriver.com/digital-river-api-reference/2021-12-13/subscriptions)[`state`](https://docs.digitalriver.com/digital-river-api-reference/2021-12-13/subscriptions/subscription-basics#subscription-lifecycle) remains `active`. And even though [checkouts ](https://docs.digitalriver.com/digital-river-api-reference/2021-12-13/checkouts)don't contain a state attribute, you can listen for `checkout.created`, `checkout.updated`, and `checkout.deleted` events.

{% hint style="info" %}
When an event occurs on a sub-resource, such as those with a `type` of `order.charge.cancelled`, the parent resource's state update event is not activated.
{% endhint %}

Some API requests trigger multiple events. For example, when a [subscription ](https://docs.digitalriver.com/digital-river-api-reference/2021-12-13/subscriptions)is created, two event types, `subscription.created` and `checkout.created`, are emitted.

## Event data

An [event's ](https://docs.digitalriver.com/digital-river-api-reference/2021-12-13/events)`data.object` typically contains the resource that changed.

Here are a couple of examples: (1) the `data.object` of an [event ](https://docs.digitalriver.com/digital-river-api-reference/2021-12-13/events)with a [`type`](#event-types) of [`order.blocked`](/digital-river-api/order-management/creating-and-updating-an-order.md#the-fraud-review-failure-event) is an [order ](https://docs.digitalriver.com/digital-river-api-reference/2021-12-13/orders)whose [`state` ](https://docs.digitalriver.com/digital-river-api-reference/2021-12-13/orders/order-basics#order-states-and-events)is `blocked` and (2) the `data.object` of an event with a [`type`](#event-types) of `order.charge.capture.complete` is a [charge ](https://docs.digitalriver.com/digital-river-api-reference/2021-12-13/charges)that contains a [capture ](https://docs.digitalriver.com/digital-river-api-reference/2021-12-13/charges/charge-basics#captures)whose `state` is `complete`.

In a few cases, however, this pattern isn't strictly followed. For example, the `data.object` of a [`fulfillment_order.shipped`](/digital-river-api/integration-options/checkouts/handling-digital-river-coordinated-fulfillments/global-fulfillments.md#shipped-events) contains a [shipment ](https://docs.digitalriver.com/digital-river-api-reference/2021-12-13/shipments)resource and the payload of [`subscription.reminder`](/digital-river-api/integration-options/checkouts/subscriptions/digital-river-coordinated-subscriptions.md#sending-a-reminder) is both a [subscription ](https://docs.digitalriver.com/digital-river-api-reference/2021-12-13/subscriptions)and an [invoice](https://docs.digitalriver.com/digital-river-api-reference/2021-12-13/invoices).

An event's `data.previousAttributes` lists the resource's attributes that changed, along with the previous values of these attributes.‌
