> For the complete documentation index, see [llms.txt](https://docs.codemash.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.codemash.io/cloud/payments/triggers/new.md).

# Create a trigger

**Where:** Payments → Triggers → New · `/projects/<project>/payments/triggers/new`

{% hint style="info" %}
Screenshot TODO — capture comes from testing-plan area **02-triggers**.
{% endhint %}

The form reads as a sentence: **If this** happens, **... then** do that.

## Fields

**If this** — pick the event:

* **When order created** (`OnOrderCreated`) — a new order is created; all order data is passed to the action.
* **When order paid** (`OnOrderPaid`) — an order is paid; all order data is passed to the action.
* **When webhook call received** (`OnWebhookCallReceived`) — a gateway webhook arrives; all callback data is passed to the action.

For **When webhook call received**, two checkbox lists appear:

* **For these integrations** — your connected integrations, each shown with its gateway (e.g. `Main shop (Stripe)`). Leave everything unchecked to react to every integration.
* **For these events** — the provider's own webhook event names, e.g. `checkout.session.completed`, `charge.refunded` (Stripe), `transaction.completed` (Paddle), `order_created` (Lemon Squeezy). The list narrows to the gateways of the checked integrations. Leave everything unchecked to react to all supported events.

**... then** — pick the action: **Run Code**, **Send Email**, **Send Push Notification**, **Send SMS**, **Call Webhook**, or **Send In-App (Realtime / SSE)**. Each choice opens its own settings — template and recipients for email/push/SMS, destinations for webhooks, the function for code. Marketplace functions you installed surface under **Run Code**.

Below the flow:

* **Order** — a number that sets the run order when several triggers match the same event.
* **Break execution queue on failure** — stop later triggers if this one fails.
* **Name the trigger** (required), **Description**, and **Is this trigger enabled?**

## Example: send a receipt for paid Stripe checkouts

* When: **When webhook call received**
* For these integrations: `Main shop (Stripe)`
* For these events: `checkout.session.completed`
* Action: **Send Email** with your receipt template
* Name: `Send receipt` · Enabled: on

How triggers work — events, actions, and delivery settings — is explained in [Triggers](/other-topics/triggers.md).

## Use it from code

[Payments → Triggers](/sdks-and-cli/payments/triggers.md)

## API reference

Endpoints: [Save Payments Trigger](/api-reference/payments/triggers/save-payments-trigger.md).
