Announcing Gift Cards API

Integrate Square Gift Cards into your app

Reddit
LinkedIn

Many businesses run gift card programs as a way to attract new customers and increase sales. With Square Gift Cards, we enable sellers to launch a complete gifting program with online and physical gift cards that seamlessly integrate into their Square Dashboard, Customer Directory, and POS system.

Today, we’re thrilled to announce that developers can now extend Square Gift Card capabilities to their app with Gift Cards API — now generally available. Integrating with Gift Cards API empowers developers to offer more flexible payment options and better serve sellers that want to expand their gift card programs to new channels. The API provides endpoints to create, manage, and link or unlink customers from gift cards. Plus, you can also activate, load, redeem a gift card, and receive webhook notifications about gift card events.

Here’s more of what you can do with Gift Cards API:

Integrate Square Gift Cards into any app. Whether you’re building an eCommerce app, custom mobile app, or any other app, you can offer Square Gift Cards on any platform you build to better serve sellers across multiple channels.

Enable sellers to sell and redeem gift cards across channels with custom gift card account numbers. You can now create custom gift card codes and match them across Square merchant accounts, helping sellers to sell and redeem gift cards across multiple sellers within the same organization and on any channel.

Tailor gift card branding. You can build your own checkout or redemption flows and customize the gift card buying experience to match the look and feel of any business.

Sync gift card data into Square Dashboard. The integration ensures that all gift card data flows seamlessly into sellers’ Square accounts, allowing for simplified and centralized data management.

SimpleTix, an event registration and ticketing platform, has been using Gift Cards API since it was launched in beta.

"Gift Cards API enables us to make refunding ticket holders’ money quick and painless. With this integration, we make it possible for event organizers to issue returns in the form of Square Gift Cards. This allows them to hold onto profits while giving ticket holders a flexible way to spend the cost of their tickets on other purchases."
Aron Kansal, Founder & CEO at SimpleTix

How Gift Cards API Works

With Gift Cards API, developers can create gift cards, retrieve gift cards, activate gift cards and redeem gift cards for a purchase.

To get started, you will first call the CreateGiftCard endpoint to create a gift card:

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

The CreateGiftCard endpoint also allows you to specify a custom Gift Card Account Number (GAN) when you create a gift card. Gift cards created with a custom GAN must have a gan_source of OTHER.

Next, you can leverage the integration with the Orders API and Payments APIs to activate a gift card. See here for the full sequence of steps. Once the order is complete, you can activate the gift card by calling the CreateGiftCardActivity endpoint with the order_id and the line_item_uid that was returned in the CreateOrder response.

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

The CreateGiftCardActivity endpoint also supports creating various types of activities, such as LOAD, REDEEM, CLEAR_BALANCE, IMPORT etc. Additionally, Gift Cards API is integrated with Customers API, allowing developers to use the LinkGiftCardToCustomer endpoint in order to associate customer_ids to gift cards.

In order to redeem the gift card for a purchase, you can use the Payments API to take a gift card payment. The source_id of your CreatePayment request can specify a gift card ID. The full sequence of steps is outlined here.

Finally, Gift Cards API webhooks are published whenever gift cards and gift card activities are created or updated.

Start Building

Gift Cards API is generally available to developers and partners in the U.S., Canada, UK, Ireland, Australia, Japan, France, and Spain. Pricing for sellers varies for digital and physical gift cards, as well as by region. To start building, check out our developer documentation and technical reference. As always, please share your feedback in our community Slack channel or Square Developer Forums. If you want to keep up to date with the rest of our content, be sure to follow this blog and our Twitter account.