CalculateLoyaltyPoints
Calculates the points earned from a potential purchase. Provide either OrderId or TransactionAmountMoney (one is required).
Stored Procedure Specific Information
Execute
Required Parameters:
- ProgramId - The loyalty program ID
- Either OrderId or TransactionAmountMoney:
- OrderId - If using the Orders API to manage orders
- TransactionAmountMoneyAmount and TransactionAmountMoneyCurrency - If not using the Orders API (both fields required)
Optional Parameters:
- LoyaltyAccountId - To enable promotion points calculation
Example 1: With OrderId
EXECUTE CalculateLoyaltyPoints ProgramId = 'd619f755-2d17-41f3-990d-c04ecedd64dd', OrderId = 'RFZfrdtm3mhO1oGzf5Cx7fEMsmGZY'
Example 2: With TransactionAmountMoney
EXECUTE CalculateLoyaltyPoints ProgramId = 'd619f755-2d17-41f3-990d-c04ecedd64dd', TransactionAmountMoneyAmount = 5000, TransactionAmountMoneyCurrency = 'USD'
Example 3: With OrderId and LoyaltyAccountId for promotion points
EXECUTE CalculateLoyaltyPoints ProgramId = 'd619f755-2d17-41f3-990d-c04ecedd64dd', OrderId = 'RFZfrdtm3mhO1oGzf5Cx7fEMsmGZY', LoyaltyAccountId = '79b807d2-d786-46a9-933b-918028d7a8c5'
Input
| Name | Type | Required | Description |
| ProgramId | String | True | The ID of the loyalty program to calculate points for. |
| OrderId | String | False | The ID of the order to calculate points for. Use when the order is managed by the Orders API. |
| TransactionAmountMoneyAmount | Int64 | False | The amount of the transaction in the smallest currency unit (e.g., cents). Use when not using the Orders API. |
| TransactionAmountMoneyCurrency | String | False | The currency of the transaction amount (e.g., USD). Use when not using the Orders API. |
| LoyaltyAccountId | String | False | The ID of the loyalty account (enables promotion points calculation). |
Result Set Columns
| Name | Type | Description |
| Success | Boolean | Whether the operation was successful. |
| Points | Integer | The number of points earned from the base program. |
| PromotionPoints | Integer | The number of points earned from promotions (0 if order_id not provided). |