json icon

Calculate Discount

v1.0.0commands

Command to calculate the discount that applies to a cart.

1{
2  "$schema": "http://json-schema.org/draft-07/schema#",
3  "title": "CalculateDiscount",
4  "description": "Command to calculate the discount for a cart, and the discount returned",
5  "type": "object",
6  "properties": {
7    "request": {
8      "type": "object",
9      "properties": {
10        "cartId": {
11          "type": "string",
12          "format": "uuid"
13        },
14        "customerId": {
15          "type": "string",
16          "format": "uuid"
17        },
18        "subtotal": {
19          "description": "Cart subtotal before discounts, in minor units (e.g. cents)",
20          "type": "integer",
21          "minimum": 0
22        },
23        "currency": {
24          "type": "string",
25          "pattern": "^[A-Z]{3}$"
26        },
27        "promotionCode": {
28          "description": "Optional promotion code supplied by the customer",
29          "type": "string"
30        }
31      },
32      "required": ["cartId", "subtotal", "currency"]
33    },
34    "response": {
35      "type": "object",
36      "properties": {
37        "discount": {
38          "description": "Total discount to apply, in minor units (e.g. cents)",
39          "type": "integer",
40          "minimum": 0
41        },
42        "appliedPromotions": {
43          "type": "array",
44          "items": {
45            "type": "string"
46          }
47        }
48      },
49      "required": ["discount"]
50    }
51  },
52  "required": ["request", "response"]
53}
54

Details

Format
JSON Schema
Resource
commands
Filename
schema.json

Versions