Beta Release
This is pre-release documentation for an API in public beta and is subject to change.
Loyalty API: Walkthrough 2

Step 3: Accrue Points

In walkthrough 1, you created an order and called AccumulateLoyaltyPoints to add points to the buyer's account. This walkthrough uses the AdjustLoyaltyPoints endpoint to add points without creating an order:

Adjust Loyalty Points
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
curl https://connect.squareupsandbox.com/v2/loyalty/accounts/{account_id}/adjust \
  -X POST \
  -H 'Square-Version: 2021-03-17' \
  -H 'Authorization: Bearer {ACCESS_TOKEN}' \
  -H 'Content-Type: application/json' \
  -d '{
    "adjust_points": {
      "points": 12,
      "reason": "Granting 12 points to test redemption"
    },
    "idempotency_key": "{UNIQUE_KEY}"
  }'

The following is an example response:

{
   "event":{
      "id":"iapi_sq0ids-1rZhvN8gJb33LD4mR926xQ_2RNAQEFCTQ18example",
      "type":"ADJUST_POINTS",
      "created_at":"2020-04-10T00:18:51Z",
      "adjust_points":{
         "loyalty_program_id":"93afe66e-3a14-4be6-8d50-02755example",
         "points":12,
         "reason":"Granting 12 more points to test redemption"
      },
      "loyalty_account_id":"1beb38f9-54de-4cb6-8121-718bDexample",
      "source":"LOYALTY_API"
   }
}

(Optional) Call RetrieveLoyaltyAccount to verify the loyalty account point balance:

Retrieve Loyalty Account
  • 1
  • 2
  • 3
  • 4
curl https://connect.squareupsandbox.com/v2/loyalty/accounts/{account_id} \
  -H 'Square-Version: 2021-03-17' \
  -H 'Authorization: Bearer {ACCESS_TOKEN}' \
  -H 'Content-Type: application/json'

In this example, the loyalty account has a balance of 12 points:

{
   "loyalty_account":{
      "id":"1beb38f9-54de-4cb6-8121-718bDexample",
      "mappings":[
         {
            "id":"e27de0ff-e56f-450d-95cb-a49a4example",
            "type":"PHONE",
            "value":"14155551234",
            "created_at":"2020-05-11T22:55:18Z"
         }
      ],
      "program_id":"93afe66e-3a14-4be6-8d50-02755example",
      "balance":12,
      "lifetime_points":12,
      "customer_id":"Q80035RNBEZ4WYTB1P9PTAMTexample",
      "created_at":"2020-05-11T22:55:18Z",
      "updated_at":"2020-05-11T22:55:18Z"
   }
}

Previous

< Enroll a Buyer

Next

Redeem Points >