# Events

Here is an overview of the types of events we send. Note that additional events may be introduced in the future, so your code should be designed to handle new types as they are added.

## checkout.session.completed

This is the example of data Subs sent after a successfull first payment&#x20;

```json
{
  "id": "0x193d230ada8be19827ecccbf870bd050da38885e5cc90a0193f931c6e528a8b4",
  "object": "event",
  "created": 1712051799722,
  "type": "checkout.session.completed",
  "data": {
    "object": {
      "id": "0x193d230ada8be19827ecccbf870bd050da38885e5cc90a0193f931c6e528a8b4",
      "object": "subscription",
      "application": "44",
      "cancel_at": null,
      "cancel_at_period_end": false,
      "canceled_at": null,
      "collection_method": "charge_automatically",
      "chain": "mumbai",
      "created": 1712051799722,
      "token_address": "0x0FA8781a83E46826621b3BC094Ea2A0212e71B23",
      "currency": "USDC",
      "currency_symbol": "USDC",
      "amount_total": 50,
      "amount": 0.5,
      "metadata": {
        "user_email": "user@gmail.com"
      },
      "customer_details": {
        "email": "customer@gmail.com"
      },
      "payment_name": "Standard",
      "payment_id": "0xad00516daf197721f85a4a89afff48066a1778f3c20ae86f8c043e1acf4972ed",
      "period": "Monthly"
    }
  }
}
```

## customer.subscription.updated&#x20;

This is the example of data Subs sent after user cancel his subscripiton. Please, note that the subscription  will not be stopped directly on the blockchain `chain`. It will be definitively stopped on the date `cancel_at`(the end of the current subscription period).&#x20;

```json
 {
  "id": "0x193d230ada8be19827ecccbf870bd050da38885e5cc90a0193f931c6e528a8b4",
  "object": "event",
  "created": 1718211273292,
  "type": "customer.subscription.updated",
  "data": {
    "object": {
      "id": "0x193d230ada8be19827ecccbf870bd050da38885e5cc90a0193f931c6e528a8b4",
      "object": "subscription",
      "application": 4,
      "cancel_at": "123415424542435",
      "cancel_at_period_end": true,
      "canceled_at": 1718211273292,
      "collection_method": "charge_automatically",
      "chain": "bsct",
      "created": 1718211273292,
      "token_address": "0x93F1db0fa9E6997068E5dFF43F6de6E8C51711B7",
      "currency": "USDT",
      "currency_symbol": "USDT",
      "customer": "0x93F1db0fa9E6997068E5dFF43F6de6E8C51711B7",
      "amount_total": 500,
      "amount": 5,
      "metadata": {
        "user_email": "user@gmail.com"
      },
      "customer_details": {
        "email": "customer@gmail.com"
      },
      "payment_name": "Premium",
      "period": "Monthly",
      "user_address": "0x93F1db0fa9E6997068E5dFF43F6de6E8C51711B7"
    }
  }
}
```

## customer.subscription.deleted&#x20;

This is the example of data Subs sent after user definite cancel. The subscription  will be directly stopped on the blockchain `chain`.&#x20;

```json
{
  "id": "0x193d230ada8be19827ecccbf870bd050da38885e5cc90a0193f931c6e528a8b4",
  "object": "event",
  "created": 1718211577616,
  "type": "customer.subscription.deleted",
  "data": {
    "object": {
      "id": "0x193d230ada8be19827ecccbf870bd050da38885e5cc90a0193f931c6e528a8b4",
      "object": "subscription",
      "application": 4,
      "cancel_at": null,
      "cancel_at_period_end": false,
      "canceled_at": 1718211577616,
      "collection_method": "charge_automatically",
      "chain": "bsct",
      "created": 1718211577616,
      "token_address": "0x93F1db0fa9E6997068E5dFF43F6de6E8C51711B7",
      "currency": "USDT",
      "currency_symbol": "USDT",
      "customer": "0x93F1db0fa9E6997068E5dFF43F6de6E8C51711B7",
      "amount_total": 500,
      "amount": 5,
      "metadata": {
        "user_email": "user@gmail.com"
      },
      "customer_details": {
        "email": "customer@gmail.com"
      },
      "payment_name": "Premium",
      "period": "Monthly",
      "user_address": "0x93F1db0fa9E6997068E5dFF43F6de6E8C51711B7"
    }
  }
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.subsprotocol.com/developer-docs/webhook/events.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
