question

conor avatar image
conor asked conor commented

modifications POST error asking to include a modifier object

Hi. I've ran into a problem with the modifications POST call.

URL https://apisandbox.dev.clover.com/v3/merchants/{mid}/orders/{orderId}/line_items/{lineItemId}/modifications

The docs say that the modifier property is optional' I get the following response message:

{ "message": "Request must contain a modifier object" }

I get this message for all of the following request bodies:

{
  "amount": 1295,
  "name": "12.5\" Medium",
  "alternateName": "",
  "modifier": {
    "hidden": false,
    "name": "12.5 Medium",
    "alternateName": "a",
    "price": 1295,
    "id": null
  },
  "id": null
}

and

{
  "amount": 1295,
  "name": "12.5\" Medium",
  "alternateName": "",
  "modifier": {
    "hidden": false,
    "name": "12.5 Medium",
    "alternateName": "a",
    "price": 1295,
    "modifierGroup": {"id": "12034781"},
    "id": null
  },
  "id": null
}

and

{
  "amount": 1295,
  "name": "12.5\" Medium",
  "alternateName": "",
  "id": null
}

Can you offer any assistance?

10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

anthonypinto avatar image
anthonypinto answered conor commented

Unfortunately It looks like the generated 'Model Schema' in the docs is showing inaccurate information about which fields are required. We will be overhauling much of the API documentation soon.

In this case, creating an item modification does require referencing a pre-existing Modifier. The best way to get a feel for how modifier groups and modifiers work is to go into the inventory app on a sandbox device or emulator and generating a group with some member modifiers. You can find the API actions for modifiers under https://www.clover.com/api_docs#!/inv...

Once you have a modifier you wish to apply the required body of the request to /v3/merchants/{mid}/orders/{orderId}/line_items/{lineItemId}/modifications is:

{
  "modifier": {
    "id": "<IDOfTheReferencedModifier>"
  }
}

PLEASE NOTE:

From your example name, it looks like modifiers may not be the best fit for the case you are working on. Typically modifiers would be used to represent something optional that might be added on to any item within certain categories, the classic example would be toppings on a sandwich. For an item that is sold by length you would typically create an inventory item with 'Per Unit' pricing settings. This would mean that any time the item is sold the teller would be required to enter the quantity being sold, and the price is set dynamically.

1 comment
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

conor avatar image conor commented ·

Thanks very much.

0 Likes 0 ·

Welcome to the
Clover Developer Community