Learn how to redeem and reload a Square gift card and the check activity history using the Gift Card Activities API.
Gift Cards API

Walkthrough 2: Use a Gift Card

This walkthrough provides step-by-step instructions that show how to redeem a gift card for a purchase, reload it with additional funds, and check gift card activity. The walkthrough includes separate procedures for applications that process orders and payments with the Square Orders and Payments APIs or with a custom processing system.

This walkthrough assumes that you completed Walkthrough 1: Sell a Gift Card and have an activated gift card.

This walkthrough includes steps that show how your application can take payment from a gift card on file. To prepare for this procedure, you must link a customer profile to your gift card.

Note

Linking a customer profile to a gift card is only required to follow the steps in this walkthrough, which takes a payment from a gift card on file.

Alternatively, to get the gift card ID to provide as the source_id in the CreatePayment request, your application can collect the gift card account number (GAN) from the buyer and call RetrieveGiftCardFromGAN.

  1. Call SearchCustomers or ListCustomers to get the ID of a customer profile in your Customer Directory.

    If you do not have a customer profile, call CreateCustomer to create one:

    Create Customer
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    curl https://connect.squareupsandbox.com/v2/customers \
      -X POST \
      -H 'Square-Version: 2022-09-21' \
      -H 'Authorization: Bearer {ACCESS_TOKEN}' \
      -H 'Content-Type: application/json' \
      -d '{
        "email_address": "janedoe@email.com",
        "given_name": "Jane",
        "family_name": "Doe"
      }'
  2. Copy the id of the customer profile from the response.

  3. Call LinkCustomerToGiftCard to add a gift card on file for the customer. Provide the gift card ID as a path parameter and the customer ID as a body parameter:

    Link Customer To Gift Card
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    curl https://connect.squareupsandbox.com/v2/gift-cards/{gift_card_id}/link-customer \
      -X POST \
      -H 'Square-Version: 2022-09-21' \
      -H 'Authorization: Bearer {ACCESS_TOKEN}' \
      -H 'Content-Type: application/json' \
      -d '{
        "customer_id": "{CUSTOMER_ID}"
      }'

    For more information about linking customers to gift cards, see Manage gift cards on file.

You are now ready to use a gift card. In this walkthrough, you take a gift card payment, add additional funds to the gift card, and check gift card activity.

This walkthrough provides two separate application flows:

If you need more assistance, contact Developer Support or ask for help in the Developer Forums.