Introducing Gift Cards API

Create, redeem, track, and reload gift cards

Reddit
LinkedIn

Gift cards provide gift-givers the ultimate flexibility when making purchases for a loved one, while recipients are empowered with choice and potentially, an easy payment method. Plus, gift cards help sellers bring in new customers and drive incremental sales while launching complete gifting programs for their businesses. These days, gift cards – or gift card-like functionality - make more than just gift-giving easier. Sellers may choose to launch a loyalty program, which requires customers to buy and load a gift card that they can later use for purchases and get extra points, and reload when the balance is low (think Starbucks Rewards). Other sellers, such as event companies managing concerts or festivals, may ask event-goers to pre-load gift cards for purchases made at events to prevent additional overhead.

Today, we’re thrilled to release the Gift Cards API in beta to enable developers to integrate Square gift cards into third-party applications. Developers can create and access gift cards, link and unlink customers from gift cards, and perform other activities such as activate, reload and redeem gift cards. The Gift Cards API also comes equipped with other advanced functionality, such as webhooks, and the capability to sell discounted gift cards.

See Gift Cards API in action

Gift Cards API provides several capabilities when it comes to managing gift cards–from selling and redeeming gift cards, to tracking and reloading. To sell a gift card, you’ll first need to create a gift card.

curl https://connect.squareupsandbox.com/v2/gift-cards \
  -X POST \
  -H 'Authorization: Bearer {ACCESS_TOKEN}' \
  -H 'Content-Type: application/json' \
  -d '{
    "idempotency_key": "{UNIQUE_KEY}",
    "location_id": "{LOCATION_ID}",
    "gift_card": {
        "type": "DIGITAL"
    }
}'  

For physical gift cards, the request must include the gift card account number (GAN) printed on an unused Square gift card. Physical gift cards can be purchased in the seller dashboard.

Next, you’ll process the payment from the buyer for the gift card purchase. The application has the option to use the Square Orders API or use its own order management system to process funds.

Lastly, you’ll activate the gift card and it’ll be ready to be used by the recipient. Call CreateGiftCardActivity with type ACTIVATE. In the request, the activate_activity_details changes depending on whether your application uses the Square Orders API or a custom API.

If you’re using the Orders API, you’ll provide the order ID and line item ID; the API will read the order and determine the amount to add to the gift card.

curl https://connect.squareupsandbox.com/v2/gift-cards/activities \
  -X POST \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer {ACCESS_TOKEN}' \
  -d '{
    "idempotency_key": "{UNIQUE_KEY}",
    "gift_card_activity": {
        "gift_card_gan": "{GIFT_CARD_GAN}",
        "type": "ACTIVATE",
        "location_id": "{LOCATION_ID}",
        "activate_activity_details": {
            "order_id": "{ORDER_ID}",
            "line_item_uid": "{LINE_ITEM_UID}"
        }
    }
}'  

If you’re using a non-Square API, you’ll need to explicitly specify the amount to add to the gift card and provide payment instrument IDs.

curl https://connect.squareupsandbox.com/v2/gift-cards/activities \
  -X POST \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer {ACCESS_TOKEN}' \
  -d '{
    "idempotency_key": "fjdf-jd",
    "gift_card_activity": {
        "gift_card_gan": "{GIFT_CARD_GAN}",
        "type": "ACTIVATE",
        "location_id": "{LOCATION_ID}",
        "activate_activity_details": {
            "amount_money": {
              "amount": 2500,
              "currency": "USD"
             },
             "buyer_payment_instrument_ids": ["example-id-1","example-id-2"],
             "reference_id": "client-side-example-reference-id"
        }
    }
}'  

Start building

The Gift Cards API is available in beta to developers and sellers in the U.S., Canada, U.K., Ireland, Australia and Japan. Pricing for sellers varies for digital and physical gift cards, but you can refer here for details on pricing for your region. Note that there are no processing fees when paying with a gift card.

Getting started is easy, just head to the Gift Cards API documentation and create a test program in Sandbox. To chat with us, drop by our Slack community or the Square Developer Forums.

Build with Gift Cards API