Square: Create Gift Card Activity
Square giftCardActivities.createGiftCardActivity: arguments, response, policy and SDK examples.
← Gift card activities operations · Get started
Operation square.creategiftcardactivity
Provider route: POST /v2/gift-cards/activities. Alter supplies the connection’s credentials and routing.
Call through Alter
Section titled “Call through Alter”Install @alter-ai/sdk @alter-ai/square with npm, or alter-sdk-square with pip. Supply your connected customer’s grant ID and the arguments described below.
import { App } from "@alter-ai/sdk";import { SquareIntegration } from "@alter-ai/square";
async function execute(input: Parameters<SquareIntegration["giftCardActivities"]["createGiftCardActivity"]>[0]) { const app = new App({ apiKey: process.env.ALTER_API_KEY! }); try { const provider = new SquareIntegration(app, { grantId: process.env.PROVIDER_GRANT_ID! }); const call = await provider.giftCardActivities.createGiftCardActivity(input); const result = await call.wait(); return result.bodyJson(); } finally { await app.close(); }}import osfrom alter_sdk import Appfrom alter_sdk_square import SquareIntegration
async def execute(arguments): async with App(api_key=os.environ["ALTER_API_KEY"]) as app: provider = SquareIntegration(app, {"grant_id": os.environ["PROVIDER_GRANT_ID"]}) call = await provider.gift_card_activities.create_gift_card_activity(arguments) result = await call.wait() return result.body_json()| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Additional keys: not allowed |
body | Model | Required within parent | Expand Create Gift Card Activity — request body — body |
Referenced models: Create Gift Card Activity — request body — body
Response
Section titled “Response”Response media type: application/json. The table describes the pinned successful response. Referenced models link to their complete fields.
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | Model | Root | Expand Create Gift Card Activity — response body |
Referenced models: Create Gift Card Activity — response body
Schemas
Section titled “Schemas”30 more schemas are linked from the tables above, on the schema pages.
Create Gift Card Activity — request body — body
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | A request to create a gift card activity. |
gift_card_activity | Model | Required within parent | Expand Create Gift Card Activity — request body — body gift card activity The activity to create for the gift card. This activity must specify `gift_card_id` or `gift_card_gan` for the target gift card, the `location_id` where the activity occurred, and the activity `type` along with the corresponding activity details. |
idempotency_key | string | Required within parent | A unique string that identifies the `CreateGiftCardActivity` request. Maximum length: 128 Minimum length: 1 |
Referenced models: Create Gift Card Activity — request body — body gift card activity
Create Gift Card Activity — response body
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | A response that contains a `GiftCardActivity` that was created. The response might contain a set of `Error` objects if the request resulted in errors. |
errors | array | Optional | Any errors that occurred during the request. |
errors[] | Model | Each item | Expand Get Shift — response body — errors item |
gift_card_activity | Model | Optional | Expand Create Gift Card Activity — response body — gift card activity The gift card activity that was created. |
Referenced models: Get Shift — response body — errors item, Create Gift Card Activity — response body — gift card activity
Get Shift — response body — errors item
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Represents an error encountered during a request to the Connect API. See [Handling errors](https://developer.squareup.com/docs/build-basics/handling-errors) for more information. |
category | string | Required within parent | Indicates which high-level category of error has occurred during a request to the Connect API. The high-level category for the error. See [ErrorCategory](#type-errorcategory) for possible values Known values: API_ERROR, AUTHENTICATION_ERROR, INVALID_REQUEST_ERROR, RATE_LIMIT_ERROR, PAYMENT_METHOD_ERROR, REFUND_ERROR, MERCHANT_SUBSCRIPTION_ERROR, EXTERNAL_VENDOR_ERROR |
code | Model | Required within parent | Expand Get Shift — response body — errors item code The specific code of the error. See [ErrorCode](#type-errorcode) for possible values |
detail | string | Optional | A human-readable description of the error for debugging purposes. |
field | string | Optional | The name of the field provided in the original request (if any) that the error pertains to. |
Referenced models: Get Shift — response body — errors item code
Create Gift Card Activity — request body — body gift card activity activate activity details amount money, buyer payment instrument ids, line item uid, order id, reference id
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Represents details about an `ACTIVATE` [gift card activity type](entity:GiftCardActivityType). |
amount_money | JSON | Optional | |
amount_money (anyOf 1) | Model | Alternative | Expand Create Payment — request body — body tip money The amount added to the gift card. This value is a positive integer. Applications that use a custom order processing system must specify this amount in the [CreateGiftCardActivity](api-endpoint:GiftCardActivities-CreateGiftCardActivity) request. |
amount_money (anyOf 2) | null | Alternative | |
buyer_payment_instrument_ids | JSON | Optional | |
buyer_payment_instrument_ids (anyOf 1) | array | Alternative | The payment instrument IDs used to process the gift card purchase, such as a credit card ID or bank account ID. Applications that use a custom order processing system must specify payment instrument IDs in the [CreateGiftCardActivity](api-endpoint:GiftCardActivities-CreateGiftCardActivity) request. Square uses this information to perform compliance checks. For applications that use the Square Orders API to process payments, Square has the necessary instrument IDs to perform compliance checks. Each buyer payment instrument ID can contain a maximum of 255 characters. |
buyer_payment_instrument_ids (anyOf 1)[] | string | Each item | |
buyer_payment_instrument_ids (anyOf 2) | null | Alternative | |
line_item_uid | JSON | Optional | |
line_item_uid (anyOf 1) | string | Alternative | The UID of the `GIFT_CARD` line item in the order that represents the gift card purchase. Applications that use the Square Orders API to process orders must specify the line item UID in the [CreateGiftCardActivity](api-endpoint:GiftCardActivities-CreateGiftCardActivity) request. |
line_item_uid (anyOf 2) | null | Alternative | |
order_id | JSON | Optional | |
order_id (anyOf 1) | string | Alternative | The ID of the [order](entity:Order) that contains the `GIFT_CARD` line item. Applications that use the Square Orders API to process orders must specify the order ID [CreateGiftCardActivity](api-endpoint:GiftCardActivities-CreateGiftCardActivity) request. |
order_id (anyOf 2) | null | Alternative | |
reference_id | JSON | Optional | |
reference_id (anyOf 1) | string | Alternative | A client-specified ID that associates the gift card activity with an entity in another system. Applications that use a custom order processing system can use this field to track information related to an order or payment. |
reference_id (anyOf 2) | null | Alternative |
Referenced models: Create Payment — request body — body tip money
Create Gift Card Activity — request body — body gift card activity adjust decrement activity details amount money, reason
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Represents details about an `ADJUST_DECREMENT` [gift card activity type](entity:GiftCardActivityType). |
amount_money | Model | Required within parent | Expand Create Payment — request body — body tip money The amount deducted from the gift card balance. This value is a positive integer. |
reason | string | Required within parent | Indicates the reason for deducting money from a [gift card](entity:GiftCard). The reason the gift card balance was adjusted. See [Reason](#type-reason) for possible values One of: SUSPICIOUS_ACTIVITY, BALANCE_ACCIDENTALLY_INCREASED, SUPPORT_ISSUE, PURCHASE_WAS_REFUNDED |
Referenced models: Create Payment — request body — body tip money
CreateGiftCardActivity — request body — body / gift_card_activity / adjust_increment_activity_details / reason: COMPLIMENTARY, SUPPORT ISSUE, TRANSACTION VOIDED
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Represents details about an `ADJUST_INCREMENT` [gift card activity type](entity:GiftCardActivityType). |
amount_money | Model | Required within parent | Expand Create Payment — request body — body tip money The amount added to the gift card balance. This value is a positive integer. |
reason | string | Required within parent | Indicates the reason for adding money to a [gift card](entity:GiftCard). The reason the gift card balance was adjusted. See [Reason](#type-reason) for possible values One of: COMPLIMENTARY, SUPPORT_ISSUE, TRANSACTION_VOIDED |
Referenced models: Create Payment — request body — body tip money
Create Gift Card Activity — request body — body gift card activity block activity details
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Represents details about a `BLOCK` [gift card activity type](entity:GiftCardActivityType). |
reason | string | Required within parent | Indicates the reason for blocking a [gift card](entity:GiftCard). The reason the gift card was blocked. See [Reason](#type-reason) for possible values One of: CHARGEBACK_BLOCK |
CreateGiftCardActivity — request body — body / gift_card_activity / clear_balance_activity_details / reason: SUSPICIOUS ACTIVITY, REUSE GIFTCARD, UNKNOWN REASON
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Represents details about a `CLEAR_BALANCE` [gift card activity type](entity:GiftCardActivityType). |
reason | string | Required within parent | Indicates the reason for clearing the balance of a [gift card](entity:GiftCard). The reason the gift card balance was cleared. See [Reason](#type-reason) for possible values One of: SUSPICIOUS_ACTIVITY, REUSE_GIFTCARD, UNKNOWN_REASON |
CreateGiftCardActivity — request body — body / gift_card_activity / deactivate_activity_details / reason: SUSPICIOUS ACTIVITY, UNKNOWN REASON, CHARGEBACK DEACTIVATE
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Represents details about a `DEACTIVATE` [gift card activity type](entity:GiftCardActivityType). |
reason | string | Required within parent | Indicates the reason for deactivating a [gift card](entity:GiftCard). The reason the gift card was deactivated. See [Reason](#type-reason) for possible values One of: SUSPICIOUS_ACTIVITY, UNKNOWN_REASON, CHARGEBACK_DEACTIVATE |
Create Gift Card Activity — request body — body gift card activity import activity details
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Represents details about an `IMPORT` [gift card activity type](entity:GiftCardActivityType). This activity type is used when Square imports a third-party gift card, in which case the `gan_source` of the gift card is set to `OTHER`. |
amount_money | Model | Required within parent | Expand Create Payment — request body — body tip money The balance amount on the imported gift card. |
Referenced models: Create Payment — request body — body tip money
Policy, approvals and errors
Section titled “Policy, approvals and errors”SDK function policy ID: square.creategiftcardactivity. Catalog operation: CreateGiftCardActivity. Rules can name either ID; function rules distinguish managed calls and conservatively cover raw calls sharing the route. Existing grant permissions and policy rules apply. wait() returns an immediate result or waits for a required approval; it never approves the request itself. Persist the approval ID to resume after a restart.
Provider errors retain their response; JSON decoding raises ProviderAPIError for provider failures. ManagedOperationError identifies contract/input/retention errors. See error handling and provider-specific behavior. Sensitive input may be refused before approval storage. A decoding error never resubmits a write.
Required provider scopes: ["GIFTCARDS_WRITE"]
Pinned headers: {"Square-Version": "2026-11-18"}