Sitecore OrderCloud: Cannot Create a Buyer and a Supplier with the Same ID

I was playing around with OrderCloud and tried to manually create initial Suppliers and Buyers for a Marketplace. First, I created a Supplier:

{

     "ID": "Test",

     "Name": "Test Company",

     "Active": true,

     "AllBuyersCanOrder": false

}


After that, I wanted to create a Buyer:

{

     "ID": "Test",

     "Name": "Test",

     "DefaultCatalogID": "Test",

     "Active": true

}

In my case, I was trying to create the Buyer and the Supplier with the same Test ID. As a result, OrderCloud returned the following in the response:


{

     "Errors": [

     {

          "ErrorCode": "IdExists",

          "Message": "Object already exists.",

          "Data": null

     }

     ]

}

To be honest, I did not expect this behavior and was surprised to receive this error. I did not create the Buyer with the Test ID earlier. From a technical point of view, it seems that Suppliers and Buyers are organizations and can be stored in the same DB table or something (not sure how OrderCloud works under the hood). I tried to find any sort of restrictions for the IDs but had no luck.

Of course, I tried to change the ID and was able to create the Buyer in OrderCloud. So, it looks like there should be any restrictions between the Supplier and Buyer IDs.

I asked the OrderCloud support team about this issue and here is the response:
Buyer, Supplier, and Marketplace owner IDs all share the same uniqueness factor, so you cannot reuse IDs in the same marketplace for those resources.

I hope this blog post will save you from using the same IDs for a Buyer, a Supplier, and a Marketplace.

Stay tuned!