<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>thread Question on Inventory Change API in Archived Discussions (Read Only)</title>
    <link>https://community.squareup.com/t5/Archived-Discussions-Read-Only/Question-on-Inventory-Change-API/m-p/226488#M96862</link>
    <description>&lt;P&gt;I am integrating the Inventory Change API to integrate the Squareup to the ecommerce website.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I am able to use this code without problems.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;$adjustment = new \Square\Models\InventoryAdjustment();&lt;BR /&gt;$adjustment-&amp;gt;setFromState('IN_STOCK');&lt;BR /&gt;$adjustment-&amp;gt;setToState('SOLD');&lt;BR /&gt;$adjustment-&amp;gt;setLocationId('XXXXXXXXXX');&lt;BR /&gt;$adjustment-&amp;gt;setCatalogObjectId('XXXXXXXXXXX');&lt;BR /&gt;$adjustment-&amp;gt;setQuantity('4');&lt;BR /&gt;$adjustment-&amp;gt;setOccurredAt('2020-12-11T12:16:09+00:00');&lt;/P&gt;
&lt;P&gt;$inventory_change = new \Square\Models\InventoryChange();&lt;BR /&gt;$inventory_change-&amp;gt;setType('ADJUSTMENT');&lt;BR /&gt;$inventory_change-&amp;gt;setAdjustment($adjustment);&lt;/P&gt;
&lt;P&gt;$changes = [$inventory_change];&lt;BR /&gt;$body = new \Square\Models\BatchChangeInventoryRequest();&lt;BR /&gt;$body-&amp;gt;setIdempotencyKey('some-key');&lt;BR /&gt;$body-&amp;gt;setChanges($changes);&lt;BR /&gt;$body-&amp;gt;setIgnoreUnchangedCounts(true);&lt;/P&gt;
&lt;P&gt;$api_response = $client-&amp;gt;getInventoryApi()-&amp;gt;batchChangeInventory($body);&lt;/P&gt;
&lt;P&gt;if ($api_response-&amp;gt;isSuccess()) {&lt;BR /&gt;$result = $api_response-&amp;gt;getResult();&lt;BR /&gt;} else {&lt;BR /&gt;$errors = $api_response-&amp;gt;getErrors();&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;I could call this API when a product is been sold in the eCommerce Website so that I have to update the count in the Square POS - here, 4 quantity of the Product was sold so, I have given 4 as Quantity.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;How should I use this API if I want to increase the quantity of a product from my ecommerce website. Like the quantity is now 10 in the Website and Square POS. Now, I received 5 more items from the vendor - I would edit the ecommerce admin Product catalog and make it 15. So,&amp;nbsp; quantity is increased 5 in numbers.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;In order to make the quantity of the Product from 10 to 15 ( or just add 5 ) how should I use this API ? I tried changing the from state and to state from various states and did not work for me. Could someone please guide me on this ?&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 11 Dec 2020 12:59:35 GMT</pubDate>
    <dc:creator>jishcem</dc:creator>
    <dc:date>2020-12-11T12:59:35Z</dc:date>
    <item>
      <title>Question on Inventory Change API</title>
      <link>https://community.squareup.com/t5/Archived-Discussions-Read-Only/Question-on-Inventory-Change-API/m-p/226488#M96862</link>
      <description>&lt;P&gt;I am integrating the Inventory Change API to integrate the Squareup to the ecommerce website.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I am able to use this code without problems.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;$adjustment = new \Square\Models\InventoryAdjustment();&lt;BR /&gt;$adjustment-&amp;gt;setFromState('IN_STOCK');&lt;BR /&gt;$adjustment-&amp;gt;setToState('SOLD');&lt;BR /&gt;$adjustment-&amp;gt;setLocationId('XXXXXXXXXX');&lt;BR /&gt;$adjustment-&amp;gt;setCatalogObjectId('XXXXXXXXXXX');&lt;BR /&gt;$adjustment-&amp;gt;setQuantity('4');&lt;BR /&gt;$adjustment-&amp;gt;setOccurredAt('2020-12-11T12:16:09+00:00');&lt;/P&gt;
&lt;P&gt;$inventory_change = new \Square\Models\InventoryChange();&lt;BR /&gt;$inventory_change-&amp;gt;setType('ADJUSTMENT');&lt;BR /&gt;$inventory_change-&amp;gt;setAdjustment($adjustment);&lt;/P&gt;
&lt;P&gt;$changes = [$inventory_change];&lt;BR /&gt;$body = new \Square\Models\BatchChangeInventoryRequest();&lt;BR /&gt;$body-&amp;gt;setIdempotencyKey('some-key');&lt;BR /&gt;$body-&amp;gt;setChanges($changes);&lt;BR /&gt;$body-&amp;gt;setIgnoreUnchangedCounts(true);&lt;/P&gt;
&lt;P&gt;$api_response = $client-&amp;gt;getInventoryApi()-&amp;gt;batchChangeInventory($body);&lt;/P&gt;
&lt;P&gt;if ($api_response-&amp;gt;isSuccess()) {&lt;BR /&gt;$result = $api_response-&amp;gt;getResult();&lt;BR /&gt;} else {&lt;BR /&gt;$errors = $api_response-&amp;gt;getErrors();&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;I could call this API when a product is been sold in the eCommerce Website so that I have to update the count in the Square POS - here, 4 quantity of the Product was sold so, I have given 4 as Quantity.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;How should I use this API if I want to increase the quantity of a product from my ecommerce website. Like the quantity is now 10 in the Website and Square POS. Now, I received 5 more items from the vendor - I would edit the ecommerce admin Product catalog and make it 15. So,&amp;nbsp; quantity is increased 5 in numbers.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;In order to make the quantity of the Product from 10 to 15 ( or just add 5 ) how should I use this API ? I tried changing the from state and to state from various states and did not work for me. Could someone please guide me on this ?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Dec 2020 12:59:35 GMT</pubDate>
      <guid>https://community.squareup.com/t5/Archived-Discussions-Read-Only/Question-on-Inventory-Change-API/m-p/226488#M96862</guid>
      <dc:creator>jishcem</dc:creator>
      <dc:date>2020-12-11T12:59:35Z</dc:date>
    </item>
    <item>
      <title>Re: Question on Inventory Change API</title>
      <link>https://community.squareup.com/t5/Archived-Discussions-Read-Only/Question-on-Inventory-Change-API/m-p/227754#M96863</link>
      <description>&lt;P&gt;We recommend taking a look at this&amp;nbsp;helpful &lt;A href="https://developer.squareup.com/docs/inventory-api/how-it-works#supported-state-transitions" target="_blank"&gt;documentation&lt;/A&gt; about the supported state transitions, &lt;A href="https://www.sellercommunity.com/t5/user/viewprofilepage/user-id/336894" target="_blank"&gt;@jishcem&lt;/A&gt;.&lt;BR /&gt;
&lt;BR /&gt;
If you're just wanting to add stock, you will most likely want to use &lt;STRONG&gt;from_state == NONE&lt;/STRONG&gt; and &lt;STRONG&gt;to_state == IN_STOCK &lt;/STRONG&gt;to add inventory. If you still need a bit of help, I put together a post including links to resources for developers &lt;A href="https://www.sellercommunity.com/t5/E-Commerce-API/Where-can-I-find-my-Application-ID-and-Access-Token/m-p/177989#M787" target="_blank"&gt;here&lt;/A&gt;.&amp;nbsp;I hope this helps!&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":sparkles:"&gt;✨&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Dec 2020 23:07:55 GMT</pubDate>
      <guid>https://community.squareup.com/t5/Archived-Discussions-Read-Only/Question-on-Inventory-Change-API/m-p/227754#M96863</guid>
      <dc:creator>Valentina</dc:creator>
      <dc:date>2020-12-15T23:07:55Z</dc:date>
    </item>
  </channel>
</rss>

