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

# List Payment Refunds

> Retrieves a list of refunds for the account making the request.

`square.listPaymentRefunds` retrieves a list of refunds for the account making the request.

## Example

```ts automations/square-list-payment-refunds.automation.ts theme={null}
import { automation, onDashboardRun } from "automate.ax"
import { square } from "automate.ax/square"

export default automation("List Square Payment Refunds", () => {
  onDashboardRun({ title: "List Square Payment Refunds" })

  square.listPaymentRefunds({
    beginTime: "begin_time",
    endTime: "end_time",
    sortOrder: "sort_order",
    cursor: "cursor",
    locationId: "location_id",
    status: "status",
    sourceType: "source_type",
    limit: 1,
    updatedAtBeginTime: "updated_at_begin_time",
    updatedAtEndTime: "updated_at_end_time",
    sortField: "CREATED_AT",
  })
})
```

## Inputs

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

| Field                | Type                                                | Required | Default                                                        | Description                                                                                                                                                                                                                                                                                                                                                                       |
| -------------------- | --------------------------------------------------- | -------- | -------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `beginTime`          | `string \| null`                                    | No       | The current time minus one year                                | Indicates the start of the time range to retrieve each `PaymentRefund` for, in RFC 3339 format. The range is determined using the `created_at` field for each `PaymentRefund`. Default: The current time minus one year.                                                                                                                                                          |
| `endTime`            | `string \| null`                                    | No       | The current time                                               | Indicates the end of the time range to retrieve each `PaymentRefund` for, in RFC 3339 format. The range is determined using the `created_at` field for each `PaymentRefund`. Default: The current time.                                                                                                                                                                           |
| `sortOrder`          | `string \| null`                                    | No       | —                                                              | The order in which results are listed by `PaymentRefund.created_at`: - `ASC` - Oldest to newest. - `DESC` - Newest to oldest (default).                                                                                                                                                                                                                                           |
| `cursor`             | `string \| null`                                    | No       | —                                                              | A pagination cursor returned by a previous call to this endpoint. Provide this cursor to retrieve the next set of results for the original query. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).                                                                                                        |
| `locationId`         | `string \| null`                                    | No       | —                                                              | Limit results to the location supplied. By default, results are returned for all locations associated with the seller.                                                                                                                                                                                                                                                            |
| `status`             | `string \| null`                                    | No       | If omitted, refunds are returned regardless of their status    | If provided, only refunds with the given status are returned. For a list of refund status values, see PaymentRefund. Default: If omitted, refunds are returned regardless of their status.                                                                                                                                                                                        |
| `sourceType`         | `string \| null`                                    | No       | If omitted, refunds are returned regardless of the source type | If provided, only returns refunds whose payments have the indicated source type. Current values include `CARD`, `BANK_ACCOUNT`, `WALLET`, `CASH`, and `EXTERNAL`. For information about these payment source types, see [Take Payments](https://developer.squareup.com/docs/payments-api/take-payments). Default: If omitted, refunds are returned regardless of the source type. |
| `limit`              | `number \| null`                                    | No       | 100                                                            | The maximum number of results to be returned in a single page. It is possible to receive fewer results than the specified limit on a given page. If the supplied value is greater than 100, no more than 100 results are returned. Default: 100                                                                                                                                   |
| `updatedAtBeginTime` | `string \| null`                                    | No       | If omitted, the time range starts at `begin_time`              | Indicates the start of the time range to retrieve each `PaymentRefund` for, in RFC 3339 format. The range is determined using the `updated_at` field for each `PaymentRefund`. Default: If omitted, the time range starts at `begin_time`.                                                                                                                                        |
| `updatedAtEndTime`   | `string \| null`                                    | No       | The current time                                               | Indicates the end of the time range to retrieve each `PaymentRefund` for, in RFC 3339 format. The range is determined using the `updated_at` field for each `PaymentRefund`. Default: The current time.                                                                                                                                                                           |
| `sortField`          | `Square.ListPaymentRefundsRequestSortField \| null` | No       | —                                                              | The field used to sort results by. The default is `CREATED_AT`.                                                                                                                                                                                                                                                                                                                   |

Use the official [ListPaymentRefunds reference](https://developer.squareup.com/reference/square/refunds-api/list-payment-refunds) for provider field semantics and limits.

## Output

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