curl --request POST \
--url "https://api.yukoapp.com/api/v1/public/points/estimate" \
--header "Authorization: Bearer py_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
--header "Content-Type: application/json" \
--data '{
"customer": {
"id": "cus_847362",
"email": "rahul.sharma@example.com"
},
"items": [
{
"product_id": "prod_1001",
"variant_id": "var_1001_red_m"
},
{
"product_id": "prod_2044",
"variant_id": "var_2044_black_42"
}
]
}'
const response = await fetch(
"https://api.yukoapp.com/api/v1/public/points/estimate",
{
method: "POST",
headers: {
Authorization: "Bearer py_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"Content-Type": "application/json",
},
body: JSON.stringify({
customer: {
id: "cus_847362",
email: "rahul.sharma@example.com",
},
items: [
{
product_id: "prod_1001",
variant_id: "var_1001_red_m",
},
{
product_id: "prod_2044",
variant_id: "var_2044_black_42",
},
],
}),
}
);
const data = await response.json();
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.yukoapp.com/api/v1/public/points/estimate");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
"customer" => [
"id" => "cus_847362",
"email" => "rahul.sharma@example.com",
],
"items" => [
[
"product_id" => "prod_1001",
"variant_id" => "var_1001_red_m",
],
[
"product_id" => "prod_2044",
"variant_id" => "var_2044_black_42",
],
],
]));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Authorization: Bearer py_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"Content-Type: application/json",
]);
$response = curl_exec($ch);
curl_close($ch);
$data = json_decode($response, true);
{
"data": {
"points_earned": 0,
"message": "You will earn 0 points after completing this purchase"
}
}
{
"error": {
"code": "validation_error",
"message": "The items field is required.",
"details": {
"items": ["The items field is required."]
}
}
}
{
"error": {
"code": "invalid_token",
"message": "Invalid or revoked API token"
}
}
Points
Points estimate
Estimates how many loyalty points a customer will earn for a given set of cart items.
POST
/
public
/
points
/
estimate
curl --request POST \
--url "https://api.yukoapp.com/api/v1/public/points/estimate" \
--header "Authorization: Bearer py_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
--header "Content-Type: application/json" \
--data '{
"customer": {
"id": "cus_847362",
"email": "rahul.sharma@example.com"
},
"items": [
{
"product_id": "prod_1001",
"variant_id": "var_1001_red_m"
},
{
"product_id": "prod_2044",
"variant_id": "var_2044_black_42"
}
]
}'
const response = await fetch(
"https://api.yukoapp.com/api/v1/public/points/estimate",
{
method: "POST",
headers: {
Authorization: "Bearer py_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"Content-Type": "application/json",
},
body: JSON.stringify({
customer: {
id: "cus_847362",
email: "rahul.sharma@example.com",
},
items: [
{
product_id: "prod_1001",
variant_id: "var_1001_red_m",
},
{
product_id: "prod_2044",
variant_id: "var_2044_black_42",
},
],
}),
}
);
const data = await response.json();
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.yukoapp.com/api/v1/public/points/estimate");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
"customer" => [
"id" => "cus_847362",
"email" => "rahul.sharma@example.com",
],
"items" => [
[
"product_id" => "prod_1001",
"variant_id" => "var_1001_red_m",
],
[
"product_id" => "prod_2044",
"variant_id" => "var_2044_black_42",
],
],
]));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Authorization: Bearer py_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"Content-Type: application/json",
]);
$response = curl_exec($ch);
curl_close($ch);
$data = json_decode($response, true);
{
"data": {
"points_earned": 0,
"message": "You will earn 0 points after completing this purchase"
}
}
{
"error": {
"code": "validation_error",
"message": "The items field is required.",
"details": {
"items": ["The items field is required."]
}
}
}
{
"error": {
"code": "invalid_token",
"message": "Invalid or revoked API token"
}
}
The estimate is based on your active Place an order earn rules. The customer is optional, so guest checkouts are supported.
The request carries product and variant IDs only, with no prices or quantities, so the cart amount used in the calculation is always
0. Every Place an order rule then falls at or below its minimum purchase, so the endpoint currently returns 0 points for every request, including fixed-points rules. Don’t show this estimate to shoppers until you’ve confirmed it returns non-zero values for your earn rules.Requires the
read:points scope. See Scopes.Body parameters
object | null
The customer placing the order. Optional: omit it entirely (or send
null) for guest checkouts. If you send a customer object, include at least id or email; an object with neither returns a 500 error.object[]
required
Response
object
Errors
| Status | Code | When |
|---|---|---|
401 | missing_token, invalid_token | The API key is missing, wrong or revoked. |
403 | insufficient_scope | The key doesn’t have read:points. |
422 | validation_error | The request body is invalid, for example items is missing or empty. |
429 | The key exceeded the rate limit. | |
500 | A customer object was sent with neither id nor email. |
curl --request POST \
--url "https://api.yukoapp.com/api/v1/public/points/estimate" \
--header "Authorization: Bearer py_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
--header "Content-Type: application/json" \
--data '{
"customer": {
"id": "cus_847362",
"email": "rahul.sharma@example.com"
},
"items": [
{
"product_id": "prod_1001",
"variant_id": "var_1001_red_m"
},
{
"product_id": "prod_2044",
"variant_id": "var_2044_black_42"
}
]
}'
const response = await fetch(
"https://api.yukoapp.com/api/v1/public/points/estimate",
{
method: "POST",
headers: {
Authorization: "Bearer py_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"Content-Type": "application/json",
},
body: JSON.stringify({
customer: {
id: "cus_847362",
email: "rahul.sharma@example.com",
},
items: [
{
product_id: "prod_1001",
variant_id: "var_1001_red_m",
},
{
product_id: "prod_2044",
variant_id: "var_2044_black_42",
},
],
}),
}
);
const data = await response.json();
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.yukoapp.com/api/v1/public/points/estimate");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
"customer" => [
"id" => "cus_847362",
"email" => "rahul.sharma@example.com",
],
"items" => [
[
"product_id" => "prod_1001",
"variant_id" => "var_1001_red_m",
],
[
"product_id" => "prod_2044",
"variant_id" => "var_2044_black_42",
],
],
]));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Authorization: Bearer py_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"Content-Type: application/json",
]);
$response = curl_exec($ch);
curl_close($ch);
$data = json_decode($response, true);
{
"data": {
"points_earned": 0,
"message": "You will earn 0 points after completing this purchase"
}
}
{
"error": {
"code": "validation_error",
"message": "The items field is required.",
"details": {
"items": ["The items field is required."]
}
}
}
{
"error": {
"code": "invalid_token",
"message": "Invalid or revoked API token"
}
}