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

# PayPal webhooks

> PayPal incoming webhooks in Corsair: the event paths to subscribe to, the payload each event carries, and the response data.

The PayPal plugin handles incoming webhooks. Point your provider’s subscription URL at your Corsair HTTP handler (see [Overview](https://docs.corsair.dev/plugins/paypal/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

* `catalogProduct` (`catalogProduct`)
* `checkoutOrder` (`checkoutOrder`)
* `dispute` (`dispute`)
* `invoice` (`invoice`)
* `other` (`other`)
* `paymentAuthorization` (`paymentAuthorization`)
* `paymentCapture` (`paymentCapture`)
* `payout` (`payout`)
* `plan` (`plan`)
* `sale` (`sale`)
* `subscription` (`subscription`)
* `vault` (`vault`)

## 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);
    // With multiTenancy, give each tenant its own URL (/api/webhook?tenantId=acme):
    // the query says whose account, secret and hooks handle the delivery.
    const query = Object.fromEntries(new URL(request.url).searchParams);
    // The raw text, not request.json(): signatures are checked over the exact bytes sent.
    const body = await request.text();
    const result = await processWebhook(corsair, headers, body, query);
    if (!result.plugin) {
        return Response.json({ success: false }, { status: 404 });
    }
    // A refusal (bad signature) carries no status and answers 400; a handler
    // that threw comes back with 500, so the sender retries it.
    const status =
        result.response?.success === false ? (result.response.statusCode ?? 400) : 200;
    return Response.json(result.response ?? { success: true }, {
        status,
        headers: result.responseHeaders,
    });
}
```

## Events

## Catalog Product

### Catalog Product

`catalogProduct`

A catalog product was created or updated (event\_type CATALOG.PRODUCT.\*)

**Payload**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string \| null` | No | The event id (WH-...); PayPal resends an event with the same id. |
| `create_time` | `string \| null` | No | — |
| `resource_type` | `string \| null` | No | The kind of resource: capture, checkout-order, subscription, invoices, dispute ... |
| `event_type` | `string \| null` | No | What happened, for example PAYMENT.CAPTURE.COMPLETED. |
| `event_version` | `string \| null` | No | — |
| `resource_version` | `string \| null` | No | — |
| `summary` | `string \| null` | No | A one-line summary. |
| `resource` | `Record<string, any> \| null` | No | The resource as the matching REST API returns it (an order, a capture, a subscription ...). |
| `links` | `object[] \| null` | No | — |

> [accordion] links full type
>
> ```ts theme={null}
> {
>   href?: string | null,
>   rel?: string | null,
>   method?: string | null
> }[] | null
> ```

> [accordion] Response data full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   create_time?: string | null,
>   resource_type?: string | null,
>   event_type?: string | null,
>   event_version?: string | null,
>   resource_version?: string | null,
>   summary?: string | null,
>   resource?: Record<string, any> | null,
>   links?: {
>     href?: string | null,
>     rel?: string | null,
>     method?: string | null
>   }[] | null
> }
> ```

**`webhookHooks` example**

```ts theme={null}
paypal({
    webhookHooks: {
        catalogProduct: {
            before(ctx, args) {
                return { ctx, args };
            },
            after(ctx, response) {
            },
        },
    },
})
```

***

## Checkout Order

### Checkout Order

`checkoutOrder`

A Checkout order was approved, completed, saved or voided (event\_type CHECKOUT.ORDER.\*)

**Payload**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string \| null` | No | The event id (WH-...); PayPal resends an event with the same id. |
| `create_time` | `string \| null` | No | — |
| `resource_type` | `string \| null` | No | The kind of resource: capture, checkout-order, subscription, invoices, dispute ... |
| `event_type` | `string \| null` | No | What happened, for example PAYMENT.CAPTURE.COMPLETED. |
| `event_version` | `string \| null` | No | — |
| `resource_version` | `string \| null` | No | — |
| `summary` | `string \| null` | No | A one-line summary. |
| `resource` | `Record<string, any> \| null` | No | The resource as the matching REST API returns it (an order, a capture, a subscription ...). |
| `links` | `object[] \| null` | No | — |

> [accordion] links full type
>
> ```ts theme={null}
> {
>   href?: string | null,
>   rel?: string | null,
>   method?: string | null
> }[] | null
> ```

> [accordion] Response data full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   create_time?: string | null,
>   resource_type?: string | null,
>   event_type?: string | null,
>   event_version?: string | null,
>   resource_version?: string | null,
>   summary?: string | null,
>   resource?: Record<string, any> | null,
>   links?: {
>     href?: string | null,
>     rel?: string | null,
>     method?: string | null
>   }[] | null
> }
> ```

**`webhookHooks` example**

```ts theme={null}
paypal({
    webhookHooks: {
        checkoutOrder: {
            before(ctx, args) {
                return { ctx, args };
            },
            after(ctx, response) {
            },
        },
    },
})
```

***

## Dispute

### Dispute

`dispute`

A dispute was created, updated or resolved (event\_type CUSTOMER.DISPUTE.\*)

**Payload**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string \| null` | No | The event id (WH-...); PayPal resends an event with the same id. |
| `create_time` | `string \| null` | No | — |
| `resource_type` | `string \| null` | No | The kind of resource: capture, checkout-order, subscription, invoices, dispute ... |
| `event_type` | `string \| null` | No | What happened, for example PAYMENT.CAPTURE.COMPLETED. |
| `event_version` | `string \| null` | No | — |
| `resource_version` | `string \| null` | No | — |
| `summary` | `string \| null` | No | A one-line summary. |
| `resource` | `Record<string, any> \| null` | No | The resource as the matching REST API returns it (an order, a capture, a subscription ...). |
| `links` | `object[] \| null` | No | — |

> [accordion] links full type
>
> ```ts theme={null}
> {
>   href?: string | null,
>   rel?: string | null,
>   method?: string | null
> }[] | null
> ```

> [accordion] Response data full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   create_time?: string | null,
>   resource_type?: string | null,
>   event_type?: string | null,
>   event_version?: string | null,
>   resource_version?: string | null,
>   summary?: string | null,
>   resource?: Record<string, any> | null,
>   links?: {
>     href?: string | null,
>     rel?: string | null,
>     method?: string | null
>   }[] | null
> }
> ```

**`webhookHooks` example**

```ts theme={null}
paypal({
    webhookHooks: {
        dispute: {
            before(ctx, args) {
                return { ctx, args };
            },
            after(ctx, response) {
            },
        },
    },
})
```

***

## Invoice

### Invoice

`invoice`

An invoice was created, updated, paid, refunded, scheduled or cancelled (event\_type INVOICING.INVOICE.\*)

**Payload**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string \| null` | No | The event id (WH-...); PayPal resends an event with the same id. |
| `create_time` | `string \| null` | No | — |
| `resource_type` | `string \| null` | No | The kind of resource: capture, checkout-order, subscription, invoices, dispute ... |
| `event_type` | `string \| null` | No | What happened, for example PAYMENT.CAPTURE.COMPLETED. |
| `event_version` | `string \| null` | No | — |
| `resource_version` | `string \| null` | No | — |
| `summary` | `string \| null` | No | A one-line summary. |
| `resource` | `Record<string, any> \| null` | No | The resource as the matching REST API returns it (an order, a capture, a subscription ...). |
| `links` | `object[] \| null` | No | — |

> [accordion] links full type
>
> ```ts theme={null}
> {
>   href?: string | null,
>   rel?: string | null,
>   method?: string | null
> }[] | null
> ```

> [accordion] Response data full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   create_time?: string | null,
>   resource_type?: string | null,
>   event_type?: string | null,
>   event_version?: string | null,
>   resource_version?: string | null,
>   summary?: string | null,
>   resource?: Record<string, any> | null,
>   links?: {
>     href?: string | null,
>     rel?: string | null,
>     method?: string | null
>   }[] | null
> }
> ```

**`webhookHooks` example**

```ts theme={null}
paypal({
    webhookHooks: {
        invoice: {
            before(ctx, args) {
                return { ctx, args };
            },
            after(ctx, response) {
            },
        },
    },
})
```

***

## Other

### Other

`other`

Any other PayPal event (merchant onboarding, risk, customer, Venmo ...) (event\_type \*)

**Payload**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string \| null` | No | The event id (WH-...); PayPal resends an event with the same id. |
| `create_time` | `string \| null` | No | — |
| `resource_type` | `string \| null` | No | The kind of resource: capture, checkout-order, subscription, invoices, dispute ... |
| `event_type` | `string \| null` | No | What happened, for example PAYMENT.CAPTURE.COMPLETED. |
| `event_version` | `string \| null` | No | — |
| `resource_version` | `string \| null` | No | — |
| `summary` | `string \| null` | No | A one-line summary. |
| `resource` | `Record<string, any> \| null` | No | The resource as the matching REST API returns it (an order, a capture, a subscription ...). |
| `links` | `object[] \| null` | No | — |

> [accordion] links full type
>
> ```ts theme={null}
> {
>   href?: string | null,
>   rel?: string | null,
>   method?: string | null
> }[] | null
> ```

> [accordion] Response data full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   create_time?: string | null,
>   resource_type?: string | null,
>   event_type?: string | null,
>   event_version?: string | null,
>   resource_version?: string | null,
>   summary?: string | null,
>   resource?: Record<string, any> | null,
>   links?: {
>     href?: string | null,
>     rel?: string | null,
>     method?: string | null
>   }[] | null
> }
> ```

**`webhookHooks` example**

```ts theme={null}
paypal({
    webhookHooks: {
        other: {
            before(ctx, args) {
                return { ctx, args };
            },
            after(ctx, response) {
            },
        },
    },
})
```

***

## Payment Authorization

### Payment Authorization

`paymentAuthorization`

A payment authorization was created or voided (event\_type PAYMENT.AUTHORIZATION.\*)

**Payload**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string \| null` | No | The event id (WH-...); PayPal resends an event with the same id. |
| `create_time` | `string \| null` | No | — |
| `resource_type` | `string \| null` | No | The kind of resource: capture, checkout-order, subscription, invoices, dispute ... |
| `event_type` | `string \| null` | No | What happened, for example PAYMENT.CAPTURE.COMPLETED. |
| `event_version` | `string \| null` | No | — |
| `resource_version` | `string \| null` | No | — |
| `summary` | `string \| null` | No | A one-line summary. |
| `resource` | `Record<string, any> \| null` | No | The resource as the matching REST API returns it (an order, a capture, a subscription ...). |
| `links` | `object[] \| null` | No | — |

> [accordion] links full type
>
> ```ts theme={null}
> {
>   href?: string | null,
>   rel?: string | null,
>   method?: string | null
> }[] | null
> ```

> [accordion] Response data full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   create_time?: string | null,
>   resource_type?: string | null,
>   event_type?: string | null,
>   event_version?: string | null,
>   resource_version?: string | null,
>   summary?: string | null,
>   resource?: Record<string, any> | null,
>   links?: {
>     href?: string | null,
>     rel?: string | null,
>     method?: string | null
>   }[] | null
> }
> ```

**`webhookHooks` example**

```ts theme={null}
paypal({
    webhookHooks: {
        paymentAuthorization: {
            before(ctx, args) {
                return { ctx, args };
            },
            after(ctx, response) {
            },
        },
    },
})
```

***

## Payment Capture

### Payment Capture

`paymentCapture`

A payment capture completed, was denied, pending, refunded, reversed or declined (event\_type PAYMENT.CAPTURE.\*)

**Payload**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string \| null` | No | The event id (WH-...); PayPal resends an event with the same id. |
| `create_time` | `string \| null` | No | — |
| `resource_type` | `string \| null` | No | The kind of resource: capture, checkout-order, subscription, invoices, dispute ... |
| `event_type` | `string \| null` | No | What happened, for example PAYMENT.CAPTURE.COMPLETED. |
| `event_version` | `string \| null` | No | — |
| `resource_version` | `string \| null` | No | — |
| `summary` | `string \| null` | No | A one-line summary. |
| `resource` | `Record<string, any> \| null` | No | The resource as the matching REST API returns it (an order, a capture, a subscription ...). |
| `links` | `object[] \| null` | No | — |

> [accordion] links full type
>
> ```ts theme={null}
> {
>   href?: string | null,
>   rel?: string | null,
>   method?: string | null
> }[] | null
> ```

> [accordion] Response data full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   create_time?: string | null,
>   resource_type?: string | null,
>   event_type?: string | null,
>   event_version?: string | null,
>   resource_version?: string | null,
>   summary?: string | null,
>   resource?: Record<string, any> | null,
>   links?: {
>     href?: string | null,
>     rel?: string | null,
>     method?: string | null
>   }[] | null
> }
> ```

**`webhookHooks` example**

```ts theme={null}
paypal({
    webhookHooks: {
        paymentCapture: {
            before(ctx, args) {
                return { ctx, args };
            },
            after(ctx, response) {
            },
        },
    },
})
```

***

## Payout

### Payout

`payout`

A payout batch or item was processed, succeeded, denied, blocked, held, refunded, returned, unclaimed or cancelled (event\_type PAYMENT.PAYOUTS\*)

**Payload**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string \| null` | No | The event id (WH-...); PayPal resends an event with the same id. |
| `create_time` | `string \| null` | No | — |
| `resource_type` | `string \| null` | No | The kind of resource: capture, checkout-order, subscription, invoices, dispute ... |
| `event_type` | `string \| null` | No | What happened, for example PAYMENT.CAPTURE.COMPLETED. |
| `event_version` | `string \| null` | No | — |
| `resource_version` | `string \| null` | No | — |
| `summary` | `string \| null` | No | A one-line summary. |
| `resource` | `Record<string, any> \| null` | No | The resource as the matching REST API returns it (an order, a capture, a subscription ...). |
| `links` | `object[] \| null` | No | — |

> [accordion] links full type
>
> ```ts theme={null}
> {
>   href?: string | null,
>   rel?: string | null,
>   method?: string | null
> }[] | null
> ```

> [accordion] Response data full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   create_time?: string | null,
>   resource_type?: string | null,
>   event_type?: string | null,
>   event_version?: string | null,
>   resource_version?: string | null,
>   summary?: string | null,
>   resource?: Record<string, any> | null,
>   links?: {
>     href?: string | null,
>     rel?: string | null,
>     method?: string | null
>   }[] | null
> }
> ```

**`webhookHooks` example**

```ts theme={null}
paypal({
    webhookHooks: {
        payout: {
            before(ctx, args) {
                return { ctx, args };
            },
            after(ctx, response) {
            },
        },
    },
})
```

***

## Plan

### Plan

`plan`

A billing plan was created, updated, activated, deactivated or its pricing changed (event\_type BILLING.PLAN.\*)

**Payload**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string \| null` | No | The event id (WH-...); PayPal resends an event with the same id. |
| `create_time` | `string \| null` | No | — |
| `resource_type` | `string \| null` | No | The kind of resource: capture, checkout-order, subscription, invoices, dispute ... |
| `event_type` | `string \| null` | No | What happened, for example PAYMENT.CAPTURE.COMPLETED. |
| `event_version` | `string \| null` | No | — |
| `resource_version` | `string \| null` | No | — |
| `summary` | `string \| null` | No | A one-line summary. |
| `resource` | `Record<string, any> \| null` | No | The resource as the matching REST API returns it (an order, a capture, a subscription ...). |
| `links` | `object[] \| null` | No | — |

> [accordion] links full type
>
> ```ts theme={null}
> {
>   href?: string | null,
>   rel?: string | null,
>   method?: string | null
> }[] | null
> ```

> [accordion] Response data full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   create_time?: string | null,
>   resource_type?: string | null,
>   event_type?: string | null,
>   event_version?: string | null,
>   resource_version?: string | null,
>   summary?: string | null,
>   resource?: Record<string, any> | null,
>   links?: {
>     href?: string | null,
>     rel?: string | null,
>     method?: string | null
>   }[] | null
> }
> ```

**`webhookHooks` example**

```ts theme={null}
paypal({
    webhookHooks: {
        plan: {
            before(ctx, args) {
                return { ctx, args };
            },
            after(ctx, response) {
            },
        },
    },
})
```

***

## Sale

### Sale

`sale`

A subscription payment (sale) completed, was denied, pending, refunded or reversed (event\_type PAYMENT.SALE.\*)

**Payload**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string \| null` | No | The event id (WH-...); PayPal resends an event with the same id. |
| `create_time` | `string \| null` | No | — |
| `resource_type` | `string \| null` | No | The kind of resource: capture, checkout-order, subscription, invoices, dispute ... |
| `event_type` | `string \| null` | No | What happened, for example PAYMENT.CAPTURE.COMPLETED. |
| `event_version` | `string \| null` | No | — |
| `resource_version` | `string \| null` | No | — |
| `summary` | `string \| null` | No | A one-line summary. |
| `resource` | `Record<string, any> \| null` | No | The resource as the matching REST API returns it (an order, a capture, a subscription ...). |
| `links` | `object[] \| null` | No | — |

> [accordion] links full type
>
> ```ts theme={null}
> {
>   href?: string | null,
>   rel?: string | null,
>   method?: string | null
> }[] | null
> ```

> [accordion] Response data full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   create_time?: string | null,
>   resource_type?: string | null,
>   event_type?: string | null,
>   event_version?: string | null,
>   resource_version?: string | null,
>   summary?: string | null,
>   resource?: Record<string, any> | null,
>   links?: {
>     href?: string | null,
>     rel?: string | null,
>     method?: string | null
>   }[] | null
> }
> ```

**`webhookHooks` example**

```ts theme={null}
paypal({
    webhookHooks: {
        sale: {
            before(ctx, args) {
                return { ctx, args };
            },
            after(ctx, response) {
            },
        },
    },
})
```

***

## Subscription

### Subscription

`subscription`

A subscription was created, activated, updated, renewed, suspended, cancelled, expired or a payment failed (event\_type BILLING.SUBSCRIPTION.\*)

**Payload**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string \| null` | No | The event id (WH-...); PayPal resends an event with the same id. |
| `create_time` | `string \| null` | No | — |
| `resource_type` | `string \| null` | No | The kind of resource: capture, checkout-order, subscription, invoices, dispute ... |
| `event_type` | `string \| null` | No | What happened, for example PAYMENT.CAPTURE.COMPLETED. |
| `event_version` | `string \| null` | No | — |
| `resource_version` | `string \| null` | No | — |
| `summary` | `string \| null` | No | A one-line summary. |
| `resource` | `Record<string, any> \| null` | No | The resource as the matching REST API returns it (an order, a capture, a subscription ...). |
| `links` | `object[] \| null` | No | — |

> [accordion] links full type
>
> ```ts theme={null}
> {
>   href?: string | null,
>   rel?: string | null,
>   method?: string | null
> }[] | null
> ```

> [accordion] Response data full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   create_time?: string | null,
>   resource_type?: string | null,
>   event_type?: string | null,
>   event_version?: string | null,
>   resource_version?: string | null,
>   summary?: string | null,
>   resource?: Record<string, any> | null,
>   links?: {
>     href?: string | null,
>     rel?: string | null,
>     method?: string | null
>   }[] | null
> }
> ```

**`webhookHooks` example**

```ts theme={null}
paypal({
    webhookHooks: {
        subscription: {
            before(ctx, args) {
                return { ctx, args };
            },
            after(ctx, response) {
            },
        },
    },
})
```

***

## Vault

### Vault

`vault`

A vaulted payment token was created or deleted (event\_type VAULT.PAYMENT-TOKEN.\*)

**Payload**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string \| null` | No | The event id (WH-...); PayPal resends an event with the same id. |
| `create_time` | `string \| null` | No | — |
| `resource_type` | `string \| null` | No | The kind of resource: capture, checkout-order, subscription, invoices, dispute ... |
| `event_type` | `string \| null` | No | What happened, for example PAYMENT.CAPTURE.COMPLETED. |
| `event_version` | `string \| null` | No | — |
| `resource_version` | `string \| null` | No | — |
| `summary` | `string \| null` | No | A one-line summary. |
| `resource` | `Record<string, any> \| null` | No | The resource as the matching REST API returns it (an order, a capture, a subscription ...). |
| `links` | `object[] \| null` | No | — |

> [accordion] links full type
>
> ```ts theme={null}
> {
>   href?: string | null,
>   rel?: string | null,
>   method?: string | null
> }[] | null
> ```

> [accordion] Response data full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   create_time?: string | null,
>   resource_type?: string | null,
>   event_type?: string | null,
>   event_version?: string | null,
>   resource_version?: string | null,
>   summary?: string | null,
>   resource?: Record<string, any> | null,
>   links?: {
>     href?: string | null,
>     rel?: string | null,
>     method?: string | null
>   }[] | null
> }
> ```

**`webhookHooks` example**

```ts theme={null}
paypal({
    webhookHooks: {
        vault: {
            before(ctx, args) {
                return { ctx, args };
            },
            after(ctx, response) {
            },
        },
    },
})
```

***


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