> ## 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](https://docs.corsair.dev/plugins/cloudcart/overview.md) for setup context and the exact URL shape).

> [!NOTE]
>
> **New to Corsair?** See [webhooks](https://docs.corsair.dev/concepts/webhooks.md) and [hooks](https://docs.corsair.dev/concepts/hooks.md).

## 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 | — |

> [accordion] Response data full type
>
> ```ts theme={null}
> {
>   id: string | number,
>   email: any
> }
> ```

**`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 | — |

> [accordion] Response data full type
>
> ```ts theme={null}
> {
>   id: string | number,
>   order_total: any
> }
> ```

**`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 | — |

> [accordion] Response data full type
>
> ```ts theme={null}
> {
>   id: string | number,
>   sku: any
> }
> ```

**`webhookHooks` example**

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

***


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.