Orders API: "mixed usage of applied adjustments fields with deprecated adjustments fields is not supported"

I’m looking at the documentation for POST /v2/orders but there doesn’t seem to be a list of deprecated fields.

What could I be missing?

Hi @rei welcome to the forums!

I’m actually not 100% sure of this myself. Could you share the order_id (if it was created)? If it wasn’t created, please share your Square application id and I’ll take a look in our logs to figure out what’s happening.

Hey,

Thanks for the reply.

It isn’t generating any Orders, so here’s the application ID: sq0idp-ufZTqmCnnMGILSjZsY6Nsg

I was able to create an Order by removing taxes and discounts and modifiers of all sorts and removing the catalog object ID from the line (don’t know why it wouldn’t find it; doing a search still finds the right item).

But looking for it on my Square dashboard, under All Orders, All types and All locations, I don’t see it.

I’m also able to create an Invoice out of it, which in turn does show up in my dashboard.

I’m pretty certain I have the right Environment and Location, as I’ve also checked that using the same client object (from C#).

Was just about to follow up: yeah, it sounds like you can’t do applied_discounts and discounts in the line items. applied_discounts is the way forward.

In order to see an order in your dashboard, you need to supply fulfillments in the order, as well as pay for the order.

Ah, I see. Thanks!

Any idea why it might be telling me it can’t find the catalog object ID even though I can see it using RetrieveCatalogObject?

Also, it’s telling me that applied_money for applied_discount is read only. What’s the correct way to change a discount amount from code if we want to use applied_discounts?

Not sure about your first question; what is the catalog object ID?

As for the latter, you should be supplying either a catalog object for discount or an ad-hoc discount in the root-level order discounts array, and then if you intend on using them in the line items, use the applied_discounts to say you want to “apply” this discount to the item. For more info see here: https://developer.squareup.com/docs/orders-api/apply-taxes-and-discounts

The object ID is FWUVMLQQTHDNP3IT32YNGL6U .

So the discounts are specified under order.discounts, and then they’re referenced in order.line_items.applied_discounts by discount_uid, right?

That’s what gives me that error:

{"errors": [{"code": "BAD_REQUEST","detail": "mixed usage of applied adjustments fields with deprecated adjustments fields is not supported","category": "INVALID_REQUEST_ERROR"}]}

Odd…

I do not see an error about FWUVMLQQTHDNP3IT32YNGL6U not being found. Can you provide the full response?

Can you share your full request and I’ll see if I can replicate it?

Request body:

{
  "order": {
    "location_id": "LR4S1V9ZX73S4",
    "reference_id": "CustomerID 791115421179711488L Week 1s",
    "customer_id": "2V872E88NCZG3A3E80Y67ZACXC",
    "line_items": [
      {
        "name": "standard 6 for Week 1",
        "quantity": "1",
        "catalog_object_id": "FWUVMLQQTHDNP3IT32YNGL6U",
        "modifiers": [
          {
            "uid": "PID-786235143399411712",
            "name": "Buri Teriyaki × 2",
            "base_price_money": {
              "amount": 2000,
              "currency": "CAD"
            }
          }
        ],
        "base_price_money": {
          "amount": 7050,
          "currency": "CAD"
        }
      }
    ],
    "discounts": [
      {
        "uid": "SoftLaunchDiscount",
        "name": "Soft launch discount"
      },
      {
        "uid": "DiscountAmount",
        "name": "Order discount"
      }
    ],
    "pricing_options": {
      "auto_apply_taxes": true
    }
  },
  "idempotency_key": "5ce2e6f0-1dbf-4217-8744-ae1e364e3d81"
}

Full HTTP response:

HTTP/1.1 404 Not Found
Date: Fri, 22 Jan 2021 22:20:37 GMT
Frame-Options: DENY
X-Frame-Options: DENY
X-Content-Type-Options: nosniff
X-Xss-Protection: 1; mode=block
Content-Type: application/json;charset=utf-8
Square-Version: 2021-01-21
Content-Length: 160
Strict-Transport-Security: max-age=631152000; includeSubDomains; preload

{"errors": [{"code": "NOT_FOUND","detail": "Item variation with catalog object ID `FWUVMLQQTHDNP3IT32YNGL6U` not found.","category": "INVALID_REQUEST_ERROR"}]}

Ah, that id is the item id, not the variation id. You need to pass the variation id. Also…there’s a few more issues with this request. If you’re passing catalog_object_id, you do not need the name nor the price, unless it’s variably priced. Also the discounts is missing the scope and the price or ID. This request actually fails for me due to the missing scope field, which is required in discounts.

Nice, that went through.

Thanks for all the help!

1 Like