Discounts marked as manual and not applying

We are using the Square API and trying to use discounts on some items.

I created various discounts according to the steps here, trying to make them automatic (buy one get one, for all days) : Create and Manage Discounts | Square Support Center - US
They work fine if I manually select them from the Square POS app, but they don’t seem to trigger automatically.

When I list the catalog using the API, the discounts have a field that is not documented and that I cannot change:
“application_method”: “MANUALLY_APPLIED”,

Also, they do not automatically, nor manually apply when I use the orders->calculateOrder API

Is there a way to make the discounts apply automatically ?

:wave: With the Catalog API you’ll want to configure pricing rules to enable automatic discounts. :slightly_smiling_face:

I created the discount through the Square portal UI, shouldn’t that apply automatically?

Okay, if you configured Automatic discount from the Dashboard the discount itself won’t have any indication it’s associated to a pricing rule. If you ListCatalog with the type parameter of PRICING_RULE you should get all the pricing rule objects. In the object body it will have pricing_rule_data which will have the discount_ids associated to the pricing rule. :slightly_smiling_face:

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?

It turns out it was my fault
If you set this everything works fine

"pricing_options": {
        "auto_apply_discounts": true,
        "auto_apply_taxes": true
},