> ## Documentation Index
> Fetch the complete documentation index at: https://docs.automate.ax/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Automate.ax automations are TypeScript programs.
> Use Bun for installation and command examples.
> Use Automate.ax for the product name and automate.ax for the package, CLI, and domain.
> Treat documented public APIs as current; do not invent transitional or deprecated names.

# On Loyalty Event Created

> A balance-changing event occurred. Square Loyalty maintains a ledger of events that occur over the lifetime of a loyalty account. Square publishes notifications for each loyalty event logged to the ledger. These loyalty events are immutable, which means they are never updated or deleted. For example, when a buyer redeems a reward and then returns the order, Square publishes separate notifications for the corresponding CREATE_REWARD and DELETE_REWARD events. Similarly, Square publishes a notification for the OTHER event when points are deducted after a purchase that accrued points is refunded.

`square.onLoyaltyEventCreated` subscribes to `loyalty.event.created` for the selected seller. It requires `LOYALTY_READ`.

## Example

```ts automations/square-on-loyalty-event-created.automation.ts theme={null}
import { automation } from "automate.ax"
import { square } from "automate.ax/square"

export default automation("onLoyaltyEventCreated", () => {
  const event = square.onLoyaltyEventCreated()

  // Send event to the Square-aware order, CRM, or messaging action you use.
})
```

## Event

A balance-changing event occurred. Square Loyalty maintains a ledger of events that occur over the lifetime of a loyalty account. Square publishes notifications for each loyalty event logged to the ledger. These loyalty events are immutable, which means they are never updated or deleted. For example, when a buyer redeems a reward and then returns the order, Square publishes separate notifications for the corresponding CREATE\_REWARD and DELETE\_REWARD events. Similarly, Square publishes a notification for the OTHER event when points are deducted after a purchase that accrued points is refunded.

The signal resolves to the official `Square.LoyaltyEventCreatedEvent` payload with `type` narrowed to `loyalty.event.created`.
