This endpoint calculates how many points a purchase would earn, without giving any points. Use it to show messages like "Earn 120 points with this order" on a product page, in the cart, or at checkout.
The calculation uses your purchase way to earn settings, active boost campaigns, and, if you send a customer, their VIP tier.
Endpoint ¶
GET https://api.jericommerce.com/v1/programs/{program_slug}/balance-preview?amount=4990¤cy=EUR
This endpoint is public, so it does not need an API key and you can call it from your storefront.
Query Parameters ¶
| Parameter | Required | Notes |
|---|---|---|
amount |
Yes | The order amount in cents. For example, 4990 for 49.90. |
currency |
Yes | The currency of amount, as a three-letter code such as EUR or USD. If it is not your program currency, the amount is converted first. |
customerEmail |
No | Include it to apply the customer's tier factor. If no customer has this email, the API answers 404. |
sourceName |
No | web (default) or pos. Use pos for in-store sales, so boosts limited to a sales channel are applied correctly. |
locationId |
No | The Shopify location ID, used with sourceName=pos for boosts limited to some stores. |
Response ¶
{
"balance": 100,
"tierBalance": 50
}
| Field | Notes |
|---|---|
balance |
The points the customer would earn. |
tierBalance |
The tier points the customer would earn toward their VIP tier. |
appliedBoost |
Only present when a boost campaign applies to this purchase. |
When a boost applies, appliedBoost explains the difference:
{
"balance": 200,
"tierBalance": 50,
"appliedBoost": {
"id": "3c2b1a0f-...",
"name": "Double points weekend",
"pointsMultiplier": 2,
"tierMultiplier": 1,
"unboostedBalance": 100,
"boostedBalance": 200,
"unboostedTierBalance": 50,
"boostedTierBalance": 50
}
}
The result is an estimate for the current moment. The points the customer actually receives are calculated when the order is placed, so they can differ if your settings or boosts change in between.
Errors ¶
| Code | Status | Meaning |
|---|---|---|
PROGRAM_NOT_FOUND |
404 |
The program slug or ID in the URL doesn't exist. |
CUSTOMER_NOT_FOUND |
404 |
You sent a customerEmail that doesn't belong to any customer. |
| Validation errors | 400 |
amount is missing or not a number, or sourceName is not web or pos. |