# Events and webhooks

> Which shop events Gears can react to, and how incoming payment webhooks from Stripe, PayPal and Paddle are handled.

## Shop events

Gears react to events with `on`:

```js
on: {
  "order.placed": async (ctx, order) => {},    // a pay-later order was placed
  "order.paid": async (ctx, order) => {},      // payment confirmed (card, PayPal…)
  "order.delivered": async (ctx, order) => {}, // a shipment was marked delivered
},
```

Events never block the shopper. An error is logged to the site's log and the shop carries on. The Meta Pixel and TikTok Pixel Gears use these events to send purchases to their ad platforms.

| Event | When | Data |
| --- | --- | --- |
| `order.created` | Every new order | The order |
| `order.placed` | A pay-later order was placed | The order |
| `order.paid` | Payment confirmed | The order |
| `order.fulfilled`, `order.delivered`, `order.refunded` | Shipped, delivered, refunded | The order |
| `booking.confirmed` | A booking is confirmed (paid, or nothing to pay) | `{ id, service, staff, startsAt, endsAt, status, customer, paid, currency }` |
| `form.submitted` | A form message that isn't spam | `{ id, form, data, page, createdAt }` |
| `subscriber.added` | Someone joins the newsletter (after confirming, with double opt-in) | `{ id, email, name, status, consentAt, confirmedAt, country, page, tags }` |
| `subscriber.removed` | Someone unsubscribes | The same, with `unsubscribedAt` |

Preview (test) orders, bookings and messages carry `test: true`; the email-list and Webhooks Gears skip them. The email-list
Gears (Mailchimp, Klaviyo, Brevo, MailerLite, Kit) use `subscriber.added` and `subscriber.removed`.

## Incoming webhooks

Payment providers call a Gear's route on the site's own address:

| Provider | Address | Checked with |
| --- | --- | --- |
| Stripe | `/_vorjo/gears/stripe/webhook` | Stripe's signature (HMAC, 5-minute tolerance) |
| PayPal | `/_vorjo/gears/paypal/webhook` | PayPal's verify-webhook-signature API |
| Paddle | `/_vorjo/gears/paddle/webhook` | `Paddle-Signature` (`ts=…;h1=…`, HMAC-SHA256 of `ts:body` with the destination's secret key, 5-minute tolerance); a repeated notification id is answered but not acted on |

Owners connect the Stripe and Paddle webhooks with one click (**Connect webhooks** on the Gear). Payment status is always confirmed with the provider, not taken from the webhook body alone.

## Webhooks to your own server

A [hosted Gear](/developers/gears-hosted) gets signed webhooks on your own server: `order.created`, `order.paid`, `order.fulfilled`, `order.refunded`, `product.updated`, `customer.created`, `app.installed` and `app.uninstalled`, each with an HMAC-SHA256 signature, a delivery ID and retries. See [Webhooks](/developers/gears-hosted#webhooks) in the hosted Gears guide for the headers and how to verify them.

## Webhooks to the owner's tools (Zapier, Make, n8n)

Site owners send events to their own web addresses in **Settings › Developers › Webhooks** (the **Webhooks**
Gear opens the same page): up to 10 endpoints, each with its own events (ticked one by one, or all) and signing secret, a delivery log (the **Logs** tab), replays and test
events. The body is `{ id, type, site, createdAt, data }`, signed like a hosted Gear's webhook. Every event, its payload and the
headers are in [Webhook events](/developers/webhook-events).

Owners also get email alerts for new orders, bookings and messages.
