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.
customer_idquery 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.
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:
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.
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
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:
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:
The payment in the response contains the following
After the payment is completed, Square automatically updates the gift card balance. You don't need to call
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
For more payment-related information, see Redeem a gift card when using the Payments API.
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
UnlinkCustomerFromGiftCardfor 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.updatedwebhook event after a customer is linked to or unlinked from a gift card. These operations don't invoke
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 Seller 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.