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

# Create Gift Card

> Creates a digital gift card or registers a physical (plastic) gift card.

`square.createGiftCard` creates a digital gift card or registers a physical (plastic) gift card.

## Example

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

export default automation("Create Square Gift Card", () => {
  onDashboardRun({ title: "Create Square Gift Card" })

  square.createGiftCard({
    idempotencyKey: "NC9Tm69EjbjtConu",
    locationId: "81FN9BNFZTKS4",
    giftCard: {
      type: "DIGITAL",
    },
  })
})
```

## Inputs

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

| Field            | Type              | Required | Default | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| ---------------- | ----------------- | -------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `idempotencyKey` | `string`          | Yes      | —       | A unique identifier for this request, used to ensure idempotency. For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `locationId`     | `string`          | Yes      | —       | The ID of the location where the gift card should be registered for reporting purposes. Gift cards can be redeemed at any of the seller's locations.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `giftCard`       | `Square.GiftCard` | Yes      | —       | The gift card to create. The `type` field is required for this request. The `gan_source` and `gan` fields are included as follows: To direct Square to generate a 16-digit GAN, omit `gan_source` and `gan`. To provide a custom GAN, include `gan_source` and `gan`. - For `gan_source`, specify `OTHER`. - For `gan`, provide a custom GAN containing 8 to 20 alphanumeric characters. The GAN must be unique for the seller and cannot start with the same bank identification number (BIN) as major credit cards. Do not use GANs that are easy to guess (such as 12345678) because they greatly increase the risk of fraud. It is the responsibility of the developer to ensure the security of their custom GANs. For more information, see [Custom GANs](https://developer.squareup.com/docs/gift-cards/using-gift-cards-api#custom-gans). To register an unused, physical gift card that the seller previously ordered from Square, include `gan` and provide the GAN that is printed on the gift card. |

Use the official [CreateGiftCard reference](https://developer.squareup.com/reference/square/gift-cards-api/create-gift-card) for provider field semantics and limits.

## Output

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