POST /v2/loyalty/programs/{program_id}/calculate
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.
Servers
- https://connect.squareup.com
Path parameters
Name | Type | Required | Description |
---|---|---|---|
program_id |
String | Yes |
The loyalty program ID, which defines the rules for accruing points. |
Request headers
Name | Type | Required | Description |
---|---|---|---|
Content-Type |
String | Yes |
The media type of the request body.
Default value: "application/json" |
Request body fields
Name | Type | Required | Description |
---|---|---|---|
order_id |
String | No |
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 |
Object | No |
Represents an amount of money. |
transaction_amount_money.amount |
Integer | No |
The amount of money, in the smallest denomination of the currency
indicated by |
transaction_amount_money.currency |
String | No |
The type of currency, in ISO 4217 format. For example, the currency
code for US dollars is See Currency for possible values. |
How to start integrating
- Add HTTP Task to your workflow definition.
- Search for the API you want to integrate with and click on the name.
- This loads the API reference documentation and prepares the Http request settings.
- Click Test request to test run your request to the API and see the API's response.