> ## Documentation Index
> Fetch the complete documentation index at: https://docs.corsair.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Webhooks

> Cloudcart incoming webhooks: event paths, payloads, and response data.

The Cloudcart plugin handles incoming webhooks. Point your provider’s subscription URL at your Corsair HTTP handler (see [Overview](/plugins/cloudcart/overview) for setup context and the exact URL shape).

<Info>
  **New to Corsair?** See [webhooks](/concepts/webhooks) and [hooks](/concepts/hooks).
</Info>

## Webhook map

* `customer`
  * `created` (`customer.created`)
* `order`
  * `created` (`order.created`)
* `product`
  * `created` (`product.created`)

## HTTP handler setup

```ts app/api/webhook/route.ts theme={null}
import { processWebhook } from "corsair";
import { corsair } from "@/server/corsair";

export async function POST(request: Request) {
    const headers = Object.fromEntries(request.headers);
    const body = await request.json();
    const result = await processWebhook(corsair, headers, body);
    return result.response;
}
```

## Events

## Customer

### Created

`customer.created`

Customer created webhook event

**Payload**

| Name    | Type               | Required | Description |
| ------- | ------------------ | -------- | ----------- |
| `id`    | `string \| number` | Yes      | —           |
| `email` | `any`              | Yes      | —           |

<AccordionGroup>
  <Accordion title="Response data full type">
    ```ts theme={null}
    {
      id: string | number,
      email: any
    }
    ```
  </Accordion>
</AccordionGroup>

**`webhookHooks` example**

```ts theme={null}
cloudcart({
    webhookHooks: {
        customer: {
            created: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})
```

***

## Order

### Created

`order.created`

Order created webhook event

**Payload**

| Name          | Type               | Required | Description |
| ------------- | ------------------ | -------- | ----------- |
| `id`          | `string \| number` | Yes      | —           |
| `order_total` | `any`              | Yes      | —           |

<AccordionGroup>
  <Accordion title="Response data full type">
    ```ts theme={null}
    {
      id: string | number,
      order_total: any
    }
    ```
  </Accordion>
</AccordionGroup>

**`webhookHooks` example**

```ts theme={null}
cloudcart({
    webhookHooks: {
        order: {
            created: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})
```

***

## Product

### Created

`product.created`

Product created webhook event

**Payload**

| Name  | Type               | Required | Description |
| ----- | ------------------ | -------- | ----------- |
| `id`  | `string \| number` | Yes      | —           |
| `sku` | `any`              | Yes      | —           |

<AccordionGroup>
  <Accordion title="Response data full type">
    ```ts theme={null}
    {
      id: string | number,
      sku: any
    }
    ```
  </Accordion>
</AccordionGroup>

**`webhookHooks` example**

```ts theme={null}
cloudcart({
    webhookHooks: {
        product: {
            created: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})
```

***
