question

captainben avatar image
captainben asked parquet76 edited

Having a "Modifier(s)" in atomic rest api created order causes printer error

For some reason ONLY orders with modifiers are unable to print.

Creating the orders via Rest API atomic.

I have reviewed:
https://community.clover.com/questions/43918/modifier-items-not-printing-using-rest-api.html
and
https://community.clover.com/questions/40852/printer-not-working-as-expected.html

but with no clover people responding...is this an undocumented Clover API bug?

Looking to get things going ASAP..hoping for a fast response.

Thanks

REST API
2 comments
10 |2000

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

parquet76 avatar image parquet76 commented ·

Hmm, that doesn't sound right. Can you post the body of the request? Do the modifiers you are passing match the modifiers as they exist in the merchant's inventory exactly or are you overriding name/amount? If you can reproduce this on a devkit try grabbing the device logs, maybe that will give you a clue.

0 Likes 0 ·
captainben avatar image captainben parquet76 commented ·

>> Can you post the body of the request

screenshot-2023-12-13-at-113344pm.png

Example receipt that wont print

Here is an example of a request:

https://wtools.io/paste-code/bSwQ

I also attempted to change all the modifiers to line items as work around(haven't tested yet)...but for some reason in the simulation virtual receipt, the items are not in proper order. Yet when viewing on the dashboard they are in proper order
screenshot-2023-12-13-at-111056pm.png

Link to receipt of modifiers converted to line items

Here's the body posted for this the modifications as line items example

https://wtools.io/paste-code/bSwP

>> passing match the modifiers as they exist

I am going full atomic, so not matching anything.

>> reproduce this on a devkit

I do not have access to a devkit

0 Likes 0 ·

1 Answer

·
parquet76 avatar image
parquet76 answered parquet76 edited

Please make sure you read the docs and format your request per the docs. It doesn't appear you have done that based on the request you attached in the nested comment. So, I think you are jumping the gun a bit in looking for a workaround.

The modifiers portion of your request doesn't match the format and notes in Clover's documentation. Here is the relevant excerpt form Clover's working with orders page, they also have a request example, excerpt pasted below.

"Modifiers are optional, but if you are using them, note these requirements:

  • If you do not pass a modifier.id, other modifier fields are ignored
  • You must pass both name and amount values
  • The name and the amount passed override the defaults set on the modification that are set up in the merchant's inventory."

And here is the modifications except from their example:

"modifications": [
                         {
                              "modifier": {
                                   "available": "true",
                                   "id": "4KAZY3PXJQ4P0",
                                   "name": "Whip cream"
                              },
                              "amount": 25
                         }
                    ]
2 comments
10 |2000

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

captainben avatar image captainben commented ·

I appreciate you reviewing this issue, where did you get this example from? Additionally if attempting to set this up in the sandbox on an atomic order (i changed the ID to a modifer ID in my account) it will fail.


Please attempt to mimic the example you provided, but going here: https://docs.clover.com/reference/ordercreateatomicorder

I then attempted to mimic the modifications example you posted, which results in a 400 response and fail:
screenshot-2023-12-14-at-122626pm.png

Now if i change the modification set up to be what I showed in my original post...it doesn't result in a 400...it shows the modifications on the virtual receipt, but again it doesn't print.

Where am I going wrong, would please test what you just posted in the sandbox and see if works for you?




0 Likes 0 ·
parquet76 avatar image parquet76 captainben commented ·

I would recommend against using the API docs to make requests, that is why your request is a mess. I know it's there, that doesn't mean it's good or you have to use it. You should only pass the stuff that is required and that you need, using that page results in a bloated request.

Anyway, the examples I gave you are in the docs - https://docs.clover.com/docs/working-with-orders. Please, update your request based on what is there and I think you should be good. I can't tell if your attempt at matching the request in the docs is valid or not, also, the Clover docs are inconsistent. One of the snippets in the page (name in the modifier, amount out) doesn't match the recipe example (both name and amount in modifier). And the recipe has the array wrapped in an "elements" property which isn't mentioned in thebpage. I would hope either the recipe example or the code snippet is right, try both and report back. Hopefully, Clover will fix the code snippets in their docs.

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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

Welcome to the
Clover Developer Community