Manage Square Gift Cards on File

Square gift cards can be linked with customers and saved as gift cards on file. Linking gift cards with customers makes it easy for buyers and sellers to access gift cards for future redemptions, reloading, and activity tracking. Developers can use the Gift Cards API for managing gift cards on file.

Square provides the following endpoints to manage gift cards on file:

  • LinkCustomerToGiftCard - Adds a gift card on file.
  • UnlinkCustomerFromGiftCard - Removes a gift card on file.
  • ListGiftCards with the customer_id query parameter - Lists the gift cards on file for a customer.

Linked gift cards include a customer_ids field that lists the IDs of all linked customers.

Link to section

Add a gift card on file

To add a gift card on file for a customer, call LinkCustomerToGiftCard and provide the following information in the request:

  • gift_card_id - The ID of the gift card to link to the customer. There are several ways that you can get a gift card ID.
  • customer_id - The ID of the customer to link to the gift card. You can search customer profiles by phone number, email address, or other supported attribute if you need to get the ID.

Link customer to gift card

If successful, the gift card in the response includes the customer_ids field with the ID of the linked customer, as shown in the following example:

Link to section

Remove a gift card on file

To unlink a customer from a gift card, call UnlinkCustomerFromGiftCard and provide the following information in the request:

  • gift_card_id - The ID of the gift card to unlink from the customer. After you get the customer ID, you can list the customer's gift cards on file to get the gift card ID.
  • customer_id - The ID of the customer to unlink from the gift card. You can search customer profiles by phone number, email address, or other supported attribute if you need to get the ID.

Unlink customer from gift card

If successful, Square removes the customer ID from the customer_ids field. Square also removes the customer_ids field if the gift card has no other linked customers.

Link to section

List the gift cards on file for a customer

To retrieve gift cards that are linked to a customer, call ListGiftCards using the customer_id query parameter. You can list gift cards to get the ID of a gift card on file to use for a payment or to check other details such as the gift card balance or state. For example, you might need to show a list of ACTIVE gift cards and balances to the buyer so they can choose one to use for a payment.

Provide the following information in the request:

  • customer_id - The ID of the linked customer. You can search customer profiles by phone number, email address, or other supported attribute if you need to get the ID.
  • state - An optional filter that you can include to request gift cards in a particular state. For example, you can filter for ACTIVE gift cards.

List gift cards

The following example response shows that the customer is linked to two gift cards, one of which is also linked to another customer:

Link to section

Taking payments from gift cards on file

To take a payment from a gift card on file, first list the gift cards on file for the customer and get the gift card ID. Then, call CreatePayment and provide the gift card ID as the source_id of the payment, as shown in the following request:

Create payment

The payment in the response contains the following card_details.card settings:

  • card_brand is SQUARE_GIFT_CARD.
  • card_type is DEBIT.
  • prepaid_type is PREPAID.

After the payment is completed, Square automatically updates the gift card balance. You don't need to call CreateGiftCardActivity directly.

Unlike using a credit or debit card ID, the customer_id field is optional for payments made using a gift card ID. If provided, customer_id can specify any customer in the seller's Customer Directory; Square doesn't validate that the specified customer is linked to the gift card. As a best practice, you should provide a customer_id in your CreatePayment requests.

For more payment-related information, see Redeem a gift card when using the Payments API.

Link to section

Considerations

The following considerations apply to managing gift cards on file:

  • A gift card can be linked to one or more customers. To link or unlink multiple customers, you must call LinkCustomerToGiftCard or UnlinkCustomerFromGiftCard for each customer profile.

    • A customer profile can be linked to a maximum of 50 gift cards.
    • A gift card can be linked to a maximum of 10 customer profiles.
  • Square invokes the gift_card.updated webhook event after a customer is linked to or unlinked from a gift card. These operations don't invoke gift_card.activity or customer events.

  • When the balance of a physical (plastic) gift card reaches zero, Square automatically unlinks the gift card from any customer profiles. This prevents past customers from receiving receipts in the case that a seller resells the gift card to a new customer.

  • In the Customers Directory in the Square Dashboard or Square Point of Sale, sellers can view gift cards on file for the selected customer profile in the Cards on File tile in the details pane. Sellers can also add a gift card on file from the tile.

    Note that gift cards with custom GANs aren't currently visible as a gift card on file for the customer profile.

  • Buyers can view and manage their own gift cards from their Square profile.

Link to section

See also