Search code examples
javaclover-payment

Is there a problem with my code or the API I am using?


I am trying to submit an item to an API, the request goes through but comes back with an incorrect item construction returned by the API.

The code works compiles and runs without a problem, unfortunately the item constructed is incorrect. API I am using: https://www.clover.com/api_docs/#!/inventory/CreateItem

If the above link does not work, navigate to Inventory -> Items -> Create an Inventory Item.

I have played around with what I am sending to the server but my problem is with the tags argument of the API. No matter what I set the "tags" field to, the returned item never has a tags field. I also have a UI that I can see all the item's properties. "tags" is always null.

Here is what I am feeding the API:

{
    "name":"test_item_with_label",
    "sku":"1234",
    "code":"959",
    "price":1698,
    "tags":[
        {
            "id":"Z1JC35RHV6PFP", 
            "name":"Sewing",
            "showInReporting":false
        }
    ],
    "priceType":"FIXED",
    "defaultTaxRates":true,
    "hidden":false,
    "revenue":true
}

This is the item's properties after the request:

{
    "id": "FCMS6MSAFYK1E", 
    "hidden": false, 
    "name": "test_item_with_label", 
    "code": "959", 
    "sku": "1234", 
    "price": 1698, 
    "priceType": "FIXED", 
    "defaultTaxRates": true, 
    "isRevenue": true, 
    "modifiedTime": 1564272103000
}

I want the item to be constructed correctly through the API with tags.

This is the available tags for reference.

  "elements": [ {
      "id": "Z1JC35RHV6PFP", 
      "name": "Sewing", 
      "showInReporting": false
    }, {
      "id": "STBVZXTVHDYK6", 
      "name": "Compass Industries", 
      "showInReporting": false
    }, {
      "id": "SSWR290EAK8RM", 
      "name": "Savor Jerky", 
      "showInReporting": false
    }, {
      "id": "GCENM7Y4RBJE2", 
      "name": "Triple K", 
      "showInReporting": false
    }, {
      "id": "E9H3YC70T4D6W", 
      "name": "Sabre/Security Equipment Co.", 
      "showInReporting": false
    }, {
      "id": "4ANVQMMFK7MNR", 
      "name": "Lansky Sharpeners", 
      "showInReporting": false
    }, {
      "id": "1H66V1ZK7Y84Y", 
      "name": "Nebo/ True Utility", 
      "showInReporting": false
    }, {
      "id": "0PZ5R8VV61QDJ", 
      "name": "Victorinox Swiss Army", 
      "showInReporting": false
    }]

Solution

  • Found the answer!

    Leaving it here in case anyone else runs into this problem with the Clover PoS API.

    Basically their API is wrong! It says you can feed all those arguments in the docs, but you first must create the item THEN come back and tag the item with the correct tag by ID.

    Answer found here: https://community.clover.com/questions/1822/can-somebody-tell-me-the-use-of-v3merchantsmidtag.html