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

# Accumulate Loyalty Points

> Adds points earned from a purchase to a [loyalty account](entity:LoyaltyAccount).

`square.accumulateLoyaltyPoints` adds points earned from a purchase to a [loyalty account](entity:LoyaltyAccount).

## Example

```ts automations/square-accumulate-loyalty-points.automation.ts theme={null}
import { automation, onDashboardRun } from "automate.ax"
import { square } from "automate.ax/square"

export default automation("Accumulate Square Loyalty Points", () => {
  onDashboardRun({ title: "Accumulate Square Loyalty Points" })

  square.accumulateLoyaltyPoints({
    accountId: "account_id",
    accumulatePoints: {
      orderId: "RFZfrdtm3mhO1oGzf5Cx7fEMsmGZY",
    },
    idempotencyKey: "58b90739-c3e8-4b11-85f7-e636d48d72cb",
    locationId: "P034NEENMD09F",
  })
})
```

## Inputs

Every input accepts a compatible signal. It requires `LOYALTY_WRITE`.

| Field              | Type                                  | Required | Default | Description                                                                                                                                     |
| ------------------ | ------------------------------------- | -------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
| `accountId`        | `string`                              | Yes      | —       | The ID of the target loyalty account.                                                                                                           |
| `accumulatePoints` | `Square.LoyaltyEventAccumulatePoints` | Yes      | —       | The points to add to the account. If you are using the Orders API to manage orders, specify the order ID. Otherwise, specify the points to add. |
| `idempotencyKey`   | `string`                              | Yes      | —       | A unique string that identifies the `AccumulateLoyaltyPoints` request. Keys can be any valid string but must be unique for every request.       |
| `locationId`       | `string`                              | Yes      | —       | The location where the purchase was made.                                                                                                       |

Use the official [AccumulateLoyaltyPoints reference](https://developer.squareup.com/reference/square/loyalty-api/accumulate-loyalty-points) for provider field semantics and limits.

## Output

Returns the official `Square.AccumulateLoyaltyPointsResponse` response as a codec-safe object. Square integer money amounts remain `bigint` values.
