This is what the dashboard generated
[
{
"type": "DISCOUNT",
"id": "MRGKDGGFSKKKUGW7MUG5Q7YS",
"updated_at": "2022-03-14T08:22:29.066Z",
"created_at": "2022-03-14T08:20:59.759Z",
"version": 1647246149066,
"is_deleted": false,
"present_at_all_locations": true,
"discount_data": {
"name": "special coffee blend 80%",
"discount_type": "FIXED_PERCENTAGE",
"percentage": "80.0",
"application_method": "MANUALLY_APPLIED",
"modify_tax_basis": "MODIFY_TAX_BASIS"
}
},
{
"type": "PRICING_RULE",
"id": "SI6LX56JV4UW6TIDAPJ7LCPM",
"updated_at": "2022-03-14T09:54:15.315Z",
"created_at": "2022-03-14T08:20:59.759Z",
"version": 1647251655315,
"is_deleted": false,
"present_at_all_locations": true,
"pricing_rule_data": {
"time_period_ids": [
"Z3LHYQF55DJCCHGNGSRK5MXF",
"TMFS7TJD62EDLGX2QMJTZNH5",
"6ZAJYXTDR6VBTHPDEJIGQLLZ",
"XMMDAAXOLCEUQ6QUAKQI6Q65",
"HHO74WNAKYTYA2YDBES5JAB4",
"J3QM7TKYBOS3HXZKVWH7WSCD",
"WOO3AR5EAWKNN6625KTRYGIA"
],
"discount_id": "MRGKDGGFSKKKUGW7MUG5Q7YS",
"match_products_id": "ZDFTLQTMLIR46TQGAWOFHLDE",
"application_mode": "AUTOMATIC",
"discount_target_scope": "LINE_ITEM"
}
},
{
"type": "PRODUCT_SET",
"id": "ZDFTLQTMLIR46TQGAWOFHLDE",
"updated_at": "2022-03-14T08:20:59.759Z",
"created_at": "2022-03-14T08:20:59.759Z",
"version": 1647246059759,
"is_deleted": false,
"present_at_all_locations": true,
"product_set_data": {
"product_ids_any": [
"XPA2WAULAFDZZE6TXCGXEK6W"
],
"quantity_exact": 1,
"all_products": false
}
},
]
This applies discount, discount specified explicitly:
POST https://connect.squareup.com/v2/orders/calculate \
{
"order": {
"location_id": "LHF8MXF0DYMNB",
"line_items": [
{
"quantity": "2",
"catalog_object_id": "XPA2WAULAFDZZE6TXCGXEK6W"
}
],
"customer_id": "B4HG1BV9R0W176HSB803YVYS7C",
"discounts": [
{
"catalog_object_id": "MRGKDGGFSKKKUGW7MUG5Q7YS",
"scope": "ORDER"
}
]
}
}
If I do not specify discount id, the discount is not applied:
POST https://connect.squareup.com/v2/orders/calculate \
{
"order": {
"location_id": "LHF8MXF0DYMNB",
"line_items": [
{
"quantity": "2",
"catalog_object_id": "XPA2WAULAFDZZE6TXCGXEK6W"
}
],
"customer_id": "B4HG1BV9R0W176HSB803YVYS7C",
}
}
The UI says “Automatic discount”, shouldn’t it apply even if I don’t add it? Can I achieve that?