> For the complete documentation index, see [llms.txt](https://eshop.gitbook.io/eshopbox-developers/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://eshop.gitbook.io/eshopbox-developers/advanced/events-webhook/event-payload.md).

# Event

### Event combinations

Use the combination of `resource`, `eventSubType`, and `resource_type` to identify the event and route it to the appropriate handler. Supported `resource` values are `order`, `shipment`, `order_item`, and `return_shipment`.

| Event context                   | `resource`   | `eventSubType`     | `resource_type`       |
| ------------------------------- | ------------ | ------------------ | --------------------- |
| Create Order Event              | `order`      | `created`          | `order.create`        |
| Unhold Order Shipment Event     | `shipment`   | `unhold`           | `shipment.update`     |
| Unfulfillable Order Event       | `order`      | `unfulfillable`    | `order.unfulfillable` |
| Order Cancelled Event           | `order`      | Not included       | `order.cancel`        |
| Order Item Cancelled Event      | `order_item` | `updated`          | `orderitem.cancel`    |
| Shipment Created Event          | `shipment`   | `created`          | `shipment.update`     |
| Shipment Accepted Event         | `shipment`   | `accepted`         | `shipment.update`     |
| Shipment Packed Event           | `shipment`   | `packed`           | `shipment.update`     |
| Shipment Out for Delivery Event | `shipment`   | `out_for_delivery` | `shipment.update`     |
| Shipment Failed Delivery Event  | `shipment`   | `failed_delivery`  | `shipment.update`     |
| Shipment Delivered Event        | `shipment`   | `delivery`         | `shipment.update`     |
| Shipment RTO Event              | `shipment`   | `rto`              | `shipment.update`     |
| Shipment Cancelled Event        | `shipment`   | `cancelled`        | `shipment.update`     |

For order cancellation, identify the event using `resource: "order"` and `resource_type: "order.cancel"`; its sample omits `eventSubType`. Shipment events share `resource_type: "shipment.update"`, so use `eventSubType` to distinguish their lifecycle stages. The delivered event uses `delivery`.

`return_shipment` is also a supported resource. Its event subtype and resource type combinations must follow the corresponding return shipment event contract.

### Common root payload structure

Events follow a common root-level envelope. The event identification fields are `resource`, `eventType`, `eventSubType` where present, `resource_type`, and `version`. Context fields include `actor`, `accountSlug` or `account_slug`, `request_data`, `previous_data`, and `custom` where present. The event-specific entity details are carried in `response_data`. Their values and nested contents vary by event.

The order item cancellation sample uses `responseData` instead of `response_data`. Preserve the exact field names and optional fields shown on each event page; the root-level keys are not identical in every sample.

The payload delivered to your webhook `url` will contain information about the fired event.

The payload attributes and types are defined below.

| Attribute      | Type     | Description                                                                                                                                                                                |
| -------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `resource`     | `string` | The resources affected by this event. Refer here for resource types available.                                                                                                             |
| `eventType`    | `string` | <p>It describes the CRUD format of event .</p><p>Example: <code>POST</code> ,<code>PUT</code> etc.</p>                                                                                     |
| `eventSubType` | `string` | This defines the event verb specifically for an event Type. Refer [Observable Events](https://docs.eshopbox.com/advanced/events-webhook/observable-events) for the defined event subtypes. |
| `version`      | `string` | It is used for versioning the Events.                                                                                                                                                      |
| `accountSlug`  | `string` | It defined the account which has generated the event                                                                                                                                       |
| `accountId`    | `number` | It defines the id of the account which has generated the event                                                                                                                             |
| `responseData` | `object` | This object can differ for different events. It contains metadata about the event.                                                                                                         |

## Sample Json

```
{
   "resource": "fee_rule",
   "eventType": "POST",
   "eventSubType": "created",
   "accountSlug": "KapasKraft",
   "accountId": "1",
   "version": "v1",
   "responseData": {
       "userName": "Kapas Kraft",
       "portalId": "1",
       "portalName": "Amazon",
       "feeType": "Commission fee",
       "validFrom": "Friday 23 Aug 2019",
       "validTo": "Friday 23 Aug 2019",
       "clientId": "1",
       "feeId": "123",
       "feeVersion": "77",
       "requestType":"0",
       "emailTo": {
           "John Doe": "johndoe@gmail.com"
       },
       "noteUrl": "https://auth.auperator.co/settings/fees-details/portalId/feeId/feeVersion",
       "actionButton1Url":"https://auth.auperator.co/settings/fees-details/3/29/1.2",
       "actionButton2Url":"https://auth.auperator.co/settings/transaction-rule-add"
   }
}
```
