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

# Edit a trigger

Edit a payment trigger — its integrations and events, the action, recipients and token values.

**Where:** Payments → Triggers → click a trigger · `/projects/<project>/payments/triggers/<triggerId>/edit`

## Before you start

* The trigger exists — see [Create a trigger](/codemash/cloud/payments/triggers/new.md).
* You need a project role that may change payment triggers (for example **Owner** or **Administrator**).

## Steps

1. In **Payments Triggers**, press the trigger name, here `Email billing when a payment succeeds`. **Edit Trigger** opens with the trigger id (`trg_2Xu768Cp8UiZkOwotP4rDx`, press it to copy) and the **Actions** menu on top. The form is the same as on [Create a trigger](/codemash/cloud/payments/triggers/new.md), filled with the saved values.

   <figure><img src="https://712692422-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHy372bqsaex2cqS3ikhL%2Fuploads%2Fgit-blob-583ea75e35c2a8f3692e45f24c1036122671b41b%2Ftriggers-edit-1.png?alt=media" alt="Edit Trigger trg_2Xu768Cp8UiZkOwotP4rDx with Actions; When webhook call received picked; For these integrations with Stripe test mode ticked"><figcaption><p>The saved trigger.</p></figcaption></figure>
2. Change what it listens to. Here, under **For these events**, `checkout.session.completed` is ticked next to `payment_intent.succeeded`, so a finished Stripe Checkout also sends the email.

   <figure><img src="https://712692422-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHy372bqsaex2cqS3ikhL%2Fuploads%2Fgit-blob-4ff660ee0dae552e7be1577b78b1e3b923776063%2Ftriggers-edit-2.png?alt=media" alt="For these events: the Stripe events with payment_intent.succeeded ticked"><figcaption><p>The event list of the ticked Stripe integration.</p></figcaption></figure>
3. Change the action part if needed: recipients, template, and the values under **Template Tokens**. To use another action type, open the action list under **... then** and pick it.

   <figure><img src="https://712692422-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHy372bqsaex2cqS3ikhL%2Fuploads%2Fgit-blob-546363c2281fb366909a33fdd1275f5a881f6935%2Ftriggers-edit-3.png?alt=media" alt="Template Details with Payment received, and Template Tokens with the saved values: (amount), (currency), Billing team, (provider), (event), (status), (event id)"><figcaption><p>The saved token values.</p></figcaption></figure>
4. Change the name or description if needed, then press **Save**. (The **Order** field is shown but not saved today; it comes back empty.)

   <figure><img src="https://712692422-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHy372bqsaex2cqS3ikhL%2Fuploads%2Fgit-blob-667681464a68cb23c6a36aefc4e392b7cf836352%2Ftriggers-edit-4.png?alt=media" alt="Lower part of Edit Trigger: Order 1, Name the trigger, Description, the switch Is this trigger enabled?, Cancel and Save"><figcaption><p>Ready to save.</p></figcaption></figure>

## Result

Cloud goes back to **Payments Triggers**. The change applies from the next webhook call; calls received earlier are not run again. Reading the trigger back shows both events: `["checkout.session.completed","payment_intent.succeeded"]`.

<figure><img src="https://712692422-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHy372bqsaex2cqS3ikhL%2Fuploads%2Fgit-blob-65f44c33732b7ae056ff455526f43d21396147f9%2Ftriggers-edit-5.png?alt=media" alt="Payments Triggers list after Save: Tell support about refunds, Old test trigger, Email billing when a payment succeeds, all Enabled Yes"><figcaption><p>Back in the list after <strong>Save</strong>.</p></figcaption></figure>

## Change or remove it later

* **Disable / Enable** — [Enable or disable a trigger](/codemash/cloud/payments/triggers/enable.md).
* **Delete** — [Delete a trigger](/codemash/cloud/payments/triggers/delete.md).
* **See documentation** in the **Actions** menu opens the [Triggers](/codemash/cloud/payments/triggers.md) page of these docs.

## Do it from code

A save replaces the whole trigger, so read it first and send every field back with your change:

```ts
const { trigger } = await norbix.hub.payments.getPaymentsTrigger({ id });
await norbix.hub.payments.savePaymentsTrigger({
  trigger: {
    ...trigger,                    // a save replaces the whole trigger: send every field back
    triggerId: id,
    action: trigger.thenAction,    // the read answer calls it thenAction
    name: 'Email billing about chargebacks',
  },
});
```

```sh
norbix hub payments trigger get --id trg_2Xu768Cp8UiZkOwotP4rDx
```

The client setup is on the [Payments page](/codemash/cloud/payments.md#use-it-from-code). API: [Get Payments Trigger](/codemash/api-reference/payments/triggers/get-payments-trigger.md) · [Save Payments Trigger](/codemash/api-reference/payments/triggers/save-payments-trigger.md)
