pos-evaluate-promotions
Method: GET
Path: /pos/carts/{id}/evaluate-promotions
Tags: Coupons & promotions
Summary
Evaluate promotions
Description
Evaluates all promotions against the current cart contents. Returns separate applicable_promotions and inapplicable_promotions arrays with eligibility reasons. When customer groups are enabled, a missing or unknown x-customer-group-id uses the default group. Requires a signed-in POS staff session with permission for this operation.
Pos SDK Usage
SDK Method: pos.evaluatePromotions()
Example:
const { data, error } = await pos.evaluatePromotions({
id: "01H9CART12345ABCDE"
});
if (error) {
console.error("Failed to evaluate promotions:", error.message);
} else {
const applicable = data.applicable_promotions || [];
const inapplicable = data.inapplicable_promotions || [];
console.log("Applicable promotions:", applicable.length);
applicable.forEach(promo => {
console.log(`- ${promo.name}: ${promo.savings_message}`);
});
console.log("Inapplicable promotions:", inapplicable.length);
inapplicable.forEach(promo => {
console.log(`- ${promo.name}: ${promo.reason}`);
});
}TypeScript Definition
"pos-evaluate-promotions": {
parameters: {
query?: never;
header?: {
/** @description Customer group used for eligibility and pricing. A missing or unknown value uses the default group. */
"x-customer-group-id"?: string;
};
path: {
/** @description Cart Id */
id: string;
};
cookie?: never;
};
requestBody?: never;
responses: {
/** @description OK */
200: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": {
message: string;
success: boolean;
content: {
applicable_promotions: components["schemas"]["ApplicablePromotion"][];
inapplicable_promotions: components["schemas"]["InapplicablePromotion"][];
};
};
};
};
/** @description The cart is missing or inactive, or the request is invalid. */
400: components["responses"]["BadRequest"];
401: components["responses"]["Unauthorized"];
403: components["responses"]["Forbidden"];
500: components["responses"]["InternalServerError"];
504: components["responses"]["GatewayTimeout"];
};
};Component References
| Reference | Resolves To |
|---|---|
components["schemas"]["ApplicablePromotion"] | ApplicablePromotion |
components["schemas"]["InapplicablePromotion"] | InapplicablePromotion |
components["responses"]["BadRequest"] | BadRequest |
components["responses"]["Unauthorized"] | Unauthorized |
components["responses"]["Forbidden"] | Forbidden |
components["responses"]["InternalServerError"] | InternalServerError |
components["responses"]["GatewayTimeout"] | GatewayTimeout |
Parameters
- id (path): Cart Id
- x-customer-group-id (header): Customer group used for eligibility and pricing. A missing or unknown value uses the default group.
Responses
200
OK
400
Bad request
401
Authentication failed. Codes include token-required, token-expired and token_not_valid for an invalid or expired token.
403
Access denied. token-required requires an authenticated session; permission-denied means the caller cannot access this resource. On POS, session-expired requires signing in again.
500
The request failed because of an unexpected error.
504
The request timed out.
OpenAPI Definition
{
"operationId": "pos-evaluate-promotions",
"summary": "Evaluate promotions",
"description": "Evaluates all promotions against the current cart contents. Returns separate `applicable_promotions` and `inapplicable_promotions` arrays with eligibility reasons. When customer groups are enabled, a missing or unknown x-customer-group-id uses the default group. Requires a signed-in POS staff session with permission for this operation.",
"parameters": [
{
"name": "id",
"in": "path",
"description": "Cart Id",
"required": true,
"schema": {
"type": "string",
"maxLength": 128,
"minLength": 1,
"pattern": "^[A-Za-z0-9_-]{1,128}$"
}
},
{
"name": "x-customer-group-id",
"in": "header",
"description": "Customer group used for eligibility and pricing. A missing or unknown value uses the default group.",
"required": false,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"message": {
"type": "string"
},
"success": {
"type": "boolean"
},
"content": {
"properties": {
"applicable_promotions": {
"type": "array",
"items": {
"$ref": "#/components/schemas/ApplicablePromotion"
}
},
"inapplicable_promotions": {
"type": "array",
"items": {
"$ref": "#/components/schemas/InapplicablePromotion"
}
}
},
"required": [
"applicable_promotions",
"inapplicable_promotions"
],
"type": "object"
}
},
"required": [
"message",
"success",
"content"
]
}
}
}
},
"400": {
"description": "The cart is missing or inactive, or the request is invalid.",
"$ref": "#/components/responses/BadRequest"
},
"401": {
"$ref": "#/components/responses/Unauthorized"
},
"403": {
"$ref": "#/components/responses/Forbidden"
},
"500": {
"$ref": "#/components/responses/InternalServerError"
},
"504": {
"$ref": "#/components/responses/GatewayTimeout"
}
},
"externalDocs": {
"url": "https://llm-docs.commercengine.io/admin-pos/operations/pos-evaluate-promotions"
},
"security": [
{
"Authorization": []
}
],
"tags": [
"Coupons & promotions"
],
"x-speakeasy-group": "pos",
"x-speakeasy-name-override": "evaluatePromotions"
}Auto-generated from OpenAPI spec and TypeScript definitions