v1

latestOpenAPI 3.0.0Apache 2.02026-07-142008071.1 MB
Loyalty

CalculateLoyaltyPoints

Calculates the points a purchase earns.

  • If you are using the Orders API to manage orders, you provide order_id in the request. The endpoint calculates the points by reading the order.
  • If you are not using the Orders API to manage orders, you provide the purchase amount in the request for the endpoint to calculate the points.

An application might call this endpoint to show the points that a buyer can earn with the specific purchase.

Note: The country of the seller's Square account determines whether tax is included in the purchase amount when accruing points for spend-based and visit-based programs. For more information, see Availability of Square Loyalty.

post/v2/loyalty/programs/{program_id}/calculate

Path parameters

program_idstring required

The loyalty program ID, which defines the rules for accruing points.

Request body

order_idstring

The order ID for which to calculate the points. Specify this field if your application uses the Orders API to process orders. Otherwise, specify the transaction_amount_money.

Example request

{
  "request_body": {
    "order_id": "RFZfrdtm3mhO1oGzf5Cx7fEMsmGZY"
  },
  "request_params": "?program_id=d619f755-2d17-41f3-990d-c04ecedd64dd"
}

Response

Success

pointsinteger

The points that the buyer can earn from a specified purchase.

Example response

{
  "points": 6
}