pos-evaluate-promotions
Method: GET
Path: /pos/carts/{id}/evaluate-promotions
Tags: POS
Summary
Evaluate promotions
Description
Evaluate applicable & inapplicable promotions based on the specified cart.
Pos SDK Usage
SDK Method: pos.evaluatePromotions()
Example:
typescript
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
typescript
"pos-evaluate-promotions": {
parameters: {
query?: never;
header?: never;
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"][];
};
};
};
};
401: components["responses"]["Unauthorized"];
};
};Component References
| Reference | Resolves To |
|---|---|
components["schemas"]["ApplicablePromotion"] | ApplicablePromotion |
components["schemas"]["InapplicablePromotion"] | InapplicablePromotion |
components["responses"]["Unauthorized"] | Unauthorized |
Parameters
- id (path): Cart Id
Responses
200
OK
401
Not authorized for given operation on the Resource
OpenAPI Definition
json
{
"tags": [
"POS"
],
"operationId": "pos-evaluate-promotions",
"summary": "Evaluate promotions",
"description": "Evaluate applicable & inapplicable promotions based on the specified cart.",
"parameters": [
{
"name": "id",
"in": "path",
"description": "Cart Id",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"message",
"success",
"content"
],
"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"
}
}
}
}
}
},
"401": {
"$ref": "#/components/responses/Unauthorized"
}
},
"security": [
{
"Authorization": []
}
],
"x-speakeasy-group": "pos",
"x-speakeasy-ignore": true,
"x-speakeasy-name-override": "listPromotions"
}Auto-generated from OpenAPI spec and TypeScript definitions