Step 3: Adjust Loyalty Points for a Buyer

In walkthrough 1, you created an order and called AccumulateLoyaltyPoints to compute the points earned from the purchase and add them to the buyer's loyalty account. The scenario for this walkthrough assumes that you need to manually adjust the loyalty point balance, so you call AdjustLoyaltyPoints to add points without creating an order.

Note

When buyers earn points from a purchase, you should use the AccumulateLoyaltyPoints endpoint. The endpoint accepts an order ID or the number of points to add. For more information, see Accumulate loyalty points from a purchase.

Link to section

Add points to the loyalty account

Call AdjustLoyaltyPoints in the Loyalty API to add the points to the loyalty account. This endpoint accepts a positive or negative integer for the points value. Use this endpoint only when you need to manually adjust the point balance.

  • Replace {ACCESS_TOKEN} with your Sandbox access token and {UNIQUE_KEY} with a unique idempotency key.
  • Replace the example account ID in the path with the actual loyalty account ID. If you need to get an account ID, you can call SearchLoyaltyAccounts and search by phone number or customer ID.

Adjust loyalty points

The following is an example response:

{ "event":{ "id":"e13a6fca-8d67-39d0-bbd2-3b4bCexample", "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 points to test redemption" }, "loyalty_account_id":"1beb38f9-54de-4cb6-8121-718bDexample", "source":"LOYALTY_API" } }

Did you know?

A searchable loyalty event is generated when the loyalty point balance changes. For more information, see Search for Balance-Changing Loyalty Events.

Link to section

Verify the loyalty account balance

(Optional) Call RetrieveLoyaltyAccount to verify the loyalty point balance.

  • Replace {ACCESS_TOKEN} with your Sandbox access token.
  • Replace the example account ID in the path with the actual loyalty account ID.

Retrieve loyalty account

The following example response shows that 12 points were added to the balance and lifetime_points fields of the loyalty account:

{ "loyalty_account":{ "id":"1beb38f9-54de-4cb6-8121-718bDexample", "mapping":{ "id":"e27de0ff-e56f-450d-95cb-a49a4example", "phone_number":"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-11T25:11:07Z" } }