Loyalty API is Generally Available

Loyalty API is Generally Available

Enroll, engage, and reward customers on third-party platforms

We’re excited to announce that Loyalty API is now generally available. Square Loyalty API enables developers to extend the intuitive Square Loyalty rewards program beyond Square’s Point of Sale, Square Online and Cash App to third-party channels–offering a seamless omnichannel loyalty experience for Square sellers. Loyalty programs help sellers show appreciation toward loyal customers, drive repeat visits, and can increase overall sales. Square Loyalty has traditionally catered to offline businesses or in-person sales; however, the Loyalty API now helps extend the Square Loyalty experience beyond the point of sale, helping sellers engage customers in their reward programs wherever they sell.

Everything new that we build in the future will revolve around the Loyalty API, because it delivers so much value. — Michael Taylor, Co-Founder; Birrdi

Setting up a loyalty program

With Loyalty API, developers can enroll customers into a loyalty program, view loyalty account details, and accrue and redeem loyalty points. Sellers can customize items such as unit name, program type, earning criteria and rewards within the Loyalty dashboard. Buyers can participate by enrolling in the seller’s loyalty program via their phone number, punch in their phone number or linked card to earn points for qualifying purchases, and redeem points for rewards.

Here’s how to create a loyalty account:

curl https://connect.squareupsandbox.com/v2/loyalty/accounts \
  -X POST \
  -H 'Square-Version: 2021-05-13' \
  -H 'Authorization: Bearer {{ACCESS_TOKEN}}' \
  -H 'Content-Type: application/json' \
  -d '{
    "idempotency_key": "b28baa32-274e-4fdf-9691-e098r36f5107",
    "loyalty_account": {
      "program_id": "506c9i8f-b515-479e-ace4-ac4ae79c2362",
      "mapping": {
        "phone_number": "+14155554321"
      }
    }
  }'

To set up a loyalty program, use your Sandbox access token to authorize calls to your Square API and your location ID to create orders and add points to a loyalty account. Follow these steps to gather account information for your Sandbox environment.

Then, to reduce application development time and complexity, you can leverage the integration between the Orders API to create orders and the Loyalty API to manage loyalty accounts and redeem loyalty points. Start by configuring a loyalty program in the seller dashboard with the following settings:

  • An “amount spent” accrual rule: earn one point for each dollar spent
  • “a discount on entire sale” reward tier: redeem 10 points for 10% off the entire sale

Next, set up a loyalty program following these steps.

Loyalty API endpoints also enable specific actions, such as Retrieve, Create, Accrue and Redeem. Plus, Loyalty API webhooks are published when accounts and loyalty programs are created, deleted and updated. Seller pricing can be found here.

Here’s the call to begin accumulating loyalty points:

curl https://connect.squareupsandbox.com/v2/loyalty/accounts/{{account_id}}/accumulate \
  -X POST \
  -H 'Square-Version: 2021-05-13' \
  -H 'Authorization: Bearer {{ACCESS_TOKEN}}' \
  -H 'Content-Type: application/json' \
  -d '{
    "accumulate_points": {
      "order_id": "TumMiuTAOaY63AA8Vsr5mYQruaR"
    },
    "idempotency_key": "57e7347a-91ff-446c-b226-d7b1b9c6a5cd",
    "location_id": "6YKED4JCQFH0E"
  }'

Start building

The Loyalty API is generally available to developers and sellers in the U.S., Canada, and Australia; it’s also available in beta in the U.K. Developers can build with Loyalty API free-of-charge in Sandbox and in production on behalf of sellers with Square Loyalty subscriptions.

Getting started is simple; check out the documentation and create a test program in Sandbox. To chat with us, drop by our Slack community or the Square Developer Forums.

Build with Loyalty API

Table Of Contents
View More Articles ›