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

# Update Payment

> Updates a payment with the APPROVED status.

`square.updatePayment` updates a payment with the APPROVED status.

## Example

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

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

  square.updatePayment({
    paymentId: "payment_id",
    payment: {
      amountMoney: {
        amount: BigInt("1000"),
        currency: "USD",
      },
      tipMoney: {
        amount: BigInt("100"),
        currency: "USD",
      },
      versionToken: "ODhwVQ35xwlzRuoZEwKXucfu7583sPTzK48c5zoGd0g6o",
    },
    idempotencyKey: "956f8b13-e4ec-45d6-85e8-d1d95ef0c5de",
  })
})
```

## Inputs

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

| Field            | Type             | Required | Default | Description                                                                                                                                                                                                                                                                 |
| ---------------- | ---------------- | -------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `paymentId`      | `string`         | Yes      | —       | The ID of the payment to update.                                                                                                                                                                                                                                            |
| `payment`        | `Square.Payment` | No       | —       | The updated `Payment` object.                                                                                                                                                                                                                                               |
| `idempotencyKey` | `string`         | Yes      | —       | A unique string that identifies this `UpdatePayment` request. Keys can be any valid string but must be unique for every `UpdatePayment` request. For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). |

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

## Output

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