Creating an Order Object from a Catalog

So I’m having a hell of a time creating orders from the items in my sandbox catalog. To simplify things I have retreated to curl. I’m trying to find the simplest approach that will actually work. Here’s what I’m currently trying …

curl https://connect.squareupsandbox.com/v2/orders \
  -X POST \
  -H 'Square-Version: 2020-10-28' \
  -H 'Authorization: Bearer ========================================================' \
  -H 'Content-Type: application/json' \
  -d '{
    "idempotency_key": "f1c7fcd9-d07e-4284-ae33-d8e9c6b38532",
    "location_id": "XGHYZDVTGBYJA",
    "order": {
      "location_id": "XGHYZDVTGBYJA",
      "line_items": [
        {
          "quantity": "1",
          "catalog_object_id": "5V2KIC2RMGABFBR2ZZEDRZF5",
          "uid": "1",
          "variation_name": "Small"
        }
      ]
    }
  }'

So that's one line item with qty 1 of one of my items (I have verified that I have the correct item_id). 

I have applied the variation_name 'Small' which is one of my variations. I have also tried putting he variation id in there. In both cases the error I get is...

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

I certainly understand the error message, but it is wrong. Small is a variation of that particular item. 

Additionally, if I provide no variation name at all, I get the same error. 

Any help would be appreciated. I'm pulling my hair out over this one.

Note: I have redacted the auth token. If someone at square would actually like to give this a whirl, I can provide that.

All of the data from my sandbox…

{
“locations”: [
{
“id”: “XGHYZDVTGBYJA”,
“name”: “Default Test Account”,
“address”: {
“address_line_1”: “1600 Pennsylvania Ave NW”,
“locality”: “Washington”,
“administrative_district_level_1”: “DC”,
“postal_code”: “20500”,
“country”: “US”
},
“timezone”: “Etc/UTC”,
“capabilities”: [
“CREDIT_CARD_PROCESSING”
],
“status”: “ACTIVE”,
“created_at”: “2019-11-06T21:39:08Z”,
“merchant_id”: “D5M2WTT984VGC”,
“country”: “US”,
“language_code”: “en-US”,
“currency”: “USD”,
“business_name”: “Default Test Account”,
“type”: “PHYSICAL”,
“business_hours”: {},
“mcc”: “7299”
}
]
}
{
“objects”: [
{
“type”: “CATEGORY”,
“id”: “XEVG7OMS3YDXZJFVSAH2MOMV”,
“updated_at”: “2020-11-04T16:08:24.562Z”,
“version”: 1604506104562,
“is_deleted”: false,
“present_at_all_locations”: true,
“category_data”: {
“name”: “Bowls”
}
},
{
“type”: “CATEGORY”,
“id”: “TUPP5IO6TRU6GS5TVYPYIKX4”,
“updated_at”: “2020-11-04T16:08:37.504Z”,
“version”: 1604506117504,
“is_deleted”: false,
“present_at_all_locations”: true,
“category_data”: {
“name”: “Smoothies”
}
},
{
“type”: “ITEM”,
“id”: “KAFUECOT6SY3B5KQX7W7KK4Z”,
“updated_at”: “2020-11-04T16:26:44.678Z”,
“version”: 1604507204678,
“is_deleted”: false,
“present_at_all_locations”: true,
“item_data”: {
“name”: “Mamaka”,
“description”: “Blend: Acai, banana, strawberry, mango, blueberries, almond milk \nToppings: Homemade granola, strawberries, banana, blueberries”,
“visibility”: “PRIVATE”,
“category_id”: “XEVG7OMS3YDXZJFVSAH2MOMV”,
“tax_ids”: [
“3JS7JQEWC5LCVDT2N2ODVNZO”
],
“modifier_list_info”: [
{
“modifier_list_id”: “5TL4VD4RLXTV3TAIWA2IOS5X”,
“visibility”: “PUBLIC”,
“min_selected_modifiers”: -1,
“max_selected_modifiers”: -1,
“enabled”: true
}
],
“variations”: [
{
“type”: “ITEM_VARIATION”,
“id”: “HOS2XB5JG3FS3IS6CJ7E5GYY”,
“updated_at”: “2020-11-04T16:12:46.423Z”,
“version”: 1604506366423,
“is_deleted”: false,
“present_at_all_locations”: true,
“item_variation_data”: {
“item_id”: “KAFUECOT6SY3B5KQX7W7KK4Z”,
“name”: “Small”,
“ordinal”: 1,
“pricing_type”: “FIXED_PRICING”,
“price_money”: {
“amount”: 850,
“currency”: “USD”
}
}
},
{
“type”: “ITEM_VARIATION”,
“id”: “HOBWMZZU3EDJZXQYUS5F354O”,
“updated_at”: “2020-11-04T16:12:46.423Z”,
“version”: 1604506366423,
“is_deleted”: false,
“present_at_all_locations”: true,
“item_variation_data”: {
“item_id”: “KAFUECOT6SY3B5KQX7W7KK4Z”,
“name”: “Regular”,
“ordinal”: 2,
“pricing_type”: “FIXED_PRICING”,
“price_money”: {
“amount”: 1000,
“currency”: “USD”
}
}
}
],
“product_type”: “REGULAR”,
“skip_modifier_screen”: false,
“legacy_tax_ids”: [
“3JS7JQEWC5LCVDT2N2ODVNZO”
]
}
},
{
“type”: “MODIFIER_LIST”,
“id”: “5TL4VD4RLXTV3TAIWA2IOS5X”,
“updated_at”: “2020-11-04T16:16:14.835Z”,
“version”: 1604506574835,
“is_deleted”: false,
“present_at_all_locations”: true,
“modifier_list_data”: {
“name”: “Add-Ons”,
“selection_type”: “MULTIPLE”,
“modifiers”: [
{
“type”: “MODIFIER”,
“id”: “XEPLDRSSLSZLN7C3HMT5F5CF”,
“updated_at”: “2020-11-04T16:16:14.835Z”,
“version”: 1604506574835,
“is_deleted”: false,
“present_at_all_locations”: true,
“modifier_data”: {
“name”: “Extra Granola On Top”,
“price_money”: {
“amount”: 100,
“currency”: “USD”
},
“on_by_default”: false,
“ordinal”: 1,
“modifier_list_id”: “5TL4VD4RLXTV3TAIWA2IOS5X”
}
},
{
“type”: “MODIFIER”,
“id”: “NGUA24T6CWL7ELLPZSR2TQMM”,
“updated_at”: “2020-11-04T16:16:14.835Z”,
“version”: 1604506574835,
“is_deleted”: false,
“present_at_all_locations”: true,
“modifier_data”: {
“name”: “Peanut Butter On Top”,
“price_money”: {
“amount”: 50,
“currency”: “USD”
},
“on_by_default”: false,
“ordinal”: 2,
“modifier_list_id”: “5TL4VD4RLXTV3TAIWA2IOS5X”
}
},
{
“type”: “MODIFIER”,
“id”: “RN2324G3ABPEFZGNG2TOWFEQ”,
“updated_at”: “2020-11-04T16:16:14.835Z”,
“version”: 1604506574835,
“is_deleted”: false,
“present_at_all_locations”: true,
“modifier_data”: {
“name”: “Strawberries On Top”,
“price_money”: {
“amount”: 50,
“currency”: “USD”
},
“on_by_default”: false,
“ordinal”: 3,
“modifier_list_id”: “5TL4VD4RLXTV3TAIWA2IOS5X”
}
},
{
“type”: “MODIFIER”,
“id”: “FQUDSNKINE4IULKKRHBNGMHM”,
“updated_at”: “2020-11-04T16:16:14.835Z”,
“version”: 1604506574835,
“is_deleted”: false,
“present_at_all_locations”: true,
“modifier_data”: {
“name”: “Blueberries On Top”,
“price_money”: {
“amount”: 50,
“currency”: “USD”
},
“on_by_default”: false,
“ordinal”: 4,
“modifier_list_id”: “5TL4VD4RLXTV3TAIWA2IOS5X”
}
}
]
}
},
{
“type”: “ITEM”,
“id”: “5V2KIC2RMGABFBR2ZZEDRZF5”,
“updated_at”: “2020-11-04T16:26:50.158Z”,
“version”: 1604507210158,
“is_deleted”: false,
“present_at_all_locations”: true,
“item_data”: {
“name”: “Maui Sunrise”,
“description”: “Blend: Strawberry, mango, banana, pineapple juice\nToppings: Homemade granola, strawberries, banana, mango”,
“visibility”: “PRIVATE”,
“category_id”: “XEVG7OMS3YDXZJFVSAH2MOMV”,
“tax_ids”: [
“3JS7JQEWC5LCVDT2N2ODVNZO”
],
“modifier_list_info”: [
{
“modifier_list_id”: “5TL4VD4RLXTV3TAIWA2IOS5X”,
“visibility”: “PUBLIC”,
“min_selected_modifiers”: -1,
“max_selected_modifiers”: -1,
“enabled”: true
}
],
“variations”: [
{
“type”: “ITEM_VARIATION”,
“id”: “YH2XQWQ23TWYFMYP3IVEYLEX”,
“updated_at”: “2020-11-04T16:18:57.357Z”,
“version”: 1604506737357,
“is_deleted”: false,
“present_at_all_locations”: true,
“item_variation_data”: {
“item_id”: “5V2KIC2RMGABFBR2ZZEDRZF5”,
“name”: “Small”,
“ordinal”: 1,
“pricing_type”: “FIXED_PRICING”,
“price_money”: {
“amount”: 850,
“currency”: “USD”
}
}
},
{
“type”: “ITEM_VARIATION”,
“id”: “3ML6EAGLYH46BZUGLICEJXDS”,
“updated_at”: “2020-11-04T16:18:57.357Z”,
“version”: 1604506737357,
“is_deleted”: false,
“present_at_all_locations”: true,
“item_variation_data”: {
“item_id”: “5V2KIC2RMGABFBR2ZZEDRZF5”,
“name”: “Regular”,
“ordinal”: 2,
“pricing_type”: “FIXED_PRICING”,
“price_money”: {
“amount”: 1000,
“currency”: “USD”
}
}
}
],
“product_type”: “REGULAR”,
“skip_modifier_screen”: false,
“legacy_tax_ids”: [
“3JS7JQEWC5LCVDT2N2ODVNZO”
]
}
},
{
“type”: “ITEM”,
“id”: “26CNUNBNOEZKGSDDPPNEANQU”,
“updated_at”: “2020-11-04T16:27:05.367Z”,
“version”: 1604507225367,
“is_deleted”: false,
“present_at_all_locations”: true,
“item_data”: {
“name”: “Pipeline”,
“description”: “Blend: Acai, banana, strawberry, peanut butter, chocolate almond milk”,
“visibility”: “PRIVATE”,
“category_id”: “TUPP5IO6TRU6GS5TVYPYIKX4”,
“tax_ids”: [
“3JS7JQEWC5LCVDT2N2ODVNZO”
],
“modifier_list_info”: [
{
“modifier_list_id”: “5TL4VD4RLXTV3TAIWA2IOS5X”,
“visibility”: “PUBLIC”,
“min_selected_modifiers”: -1,
“max_selected_modifiers”: -1,
“enabled”: true
}
],
“variations”: [
{
“type”: “ITEM_VARIATION”,
“id”: “NJBJGQVNMWN3YXNXCDLTCFZZ”,
“updated_at”: “2020-11-04T16:22:52.804Z”,
“version”: 1604506972804,
“is_deleted”: false,
“present_at_all_locations”: true,
“item_variation_data”: {
“item_id”: “26CNUNBNOEZKGSDDPPNEANQU”,
“name”: “Regular”,
“ordinal”: 1,
“pricing_type”: “FIXED_PRICING”,
“price_money”: {
“amount”: 650,
“currency”: “USD”
}
}
}
],
“product_type”: “REGULAR”,
“skip_modifier_screen”: false,
“legacy_tax_ids”: [
“3JS7JQEWC5LCVDT2N2ODVNZO”
]
}
},
{
“type”: “ITEM”,
“id”: “HKT53G3EIJU2ACEQNEBOZW23”,
“updated_at”: “2020-11-04T16:26:57.351Z”,
“version”: 1604507217351,
“is_deleted”: false,
“present_at_all_locations”: true,
“item_data”: {
“name”: “Ohana”,
“description”: “Blend: Strawberry, banana, coconut milk, agave, vanilla”,
“visibility”: “PRIVATE”,
“category_id”: “TUPP5IO6TRU6GS5TVYPYIKX4”,
“tax_ids”: [
“3JS7JQEWC5LCVDT2N2ODVNZO”
],
“modifier_list_info”: [
{
“modifier_list_id”: “5TL4VD4RLXTV3TAIWA2IOS5X”,
“visibility”: “PUBLIC”,
“min_selected_modifiers”: -1,
“max_selected_modifiers”: -1,
“enabled”: true
}
],
“variations”: [
{
“type”: “ITEM_VARIATION”,
“id”: “73H5SVETF3JC4575WCA5DRWG”,
“updated_at”: “2020-11-04T16:23:28.047Z”,
“version”: 1604507008047,
“is_deleted”: false,
“present_at_all_locations”: true,
“item_variation_data”: {
“item_id”: “HKT53G3EIJU2ACEQNEBOZW23”,
“name”: “Regular”,
“ordinal”: 1,
“pricing_type”: “FIXED_PRICING”,
“price_money”: {
“amount”: 650,
“currency”: “USD”
}
}
}
],
“product_type”: “REGULAR”,
“skip_modifier_screen”: false,
“legacy_tax_ids”: [
“3JS7JQEWC5LCVDT2N2ODVNZO”
]
}
},
{
“type”: “TAX”,
“id”: “3JS7JQEWC5LCVDT2N2ODVNZO”,
“updated_at”: “2020-11-04T16:25:38.598Z”,
“version”: 1604507138598,
“is_deleted”: false,
“present_at_all_locations”: true,
“tax_data”: {
“name”: “Texas Sales Tax”,
“calculation_phase”: “TAX_SUBTOTAL_PHASE”,
“inclusion_type”: “ADDITIVE”,
“percentage”: “8.25”,
“applies_to_custom_amounts”: true,
“enabled”: true,
“tax_type_id”: “us_sales_tax”,
“tax_type_name”: “Sales Tax”
}
}
]
}

5V2KIC2RMGABFBR2ZZEDRZF5 appears to be the ITEM, not the ITEM_VARIATION. The “Small” item variation id is YH2XQWQ23TWYFMYP3IVEYLEX, which is why the error is occurring. You should be passing the variation id (the latter id) instead. You do not need to pass the variation name, since it’s pulled from the variation itself.

#%$@#!!! And if I click on the little [?] icon by catalog_object_id that is EXACTLY what is says to drop in there. My assumption was that the item id would go there since you have to specify the variation by name (which seems odd).

Thanks AGAIN, man. That one was too easy.

1 Like