@bates-solutions/squareup API Reference - v3.2.0
    Preparing search index...

    Class InventoryService

    Inventory service for managing Square inventory

    // Get inventory count for an item
    const counts = await square.inventory.getCounts('ITEM_VAR_123');

    // Adjust inventory
    await square.inventory.adjust({
    catalogObjectId: 'ITEM_VAR_123',
    locationId: 'LXXX',
    quantity: 10,
    });
    Index
    • Adjust inventory (add or remove stock)

      Parameters

      • options: {
            catalogObjectId: string;
            idempotencyKey?: string;
            locationId?: string;
            quantity: number;
            reason?: string;
        }

        Adjustment options

      Returns Promise<InventoryCount[]>

      Updated inventory counts

      // Add 10 items to stock
      await square.inventory.adjust({
      catalogObjectId: 'ITEM_VAR_123',
      locationId: 'LXXX',
      quantity: 10,
      });

      // Remove 5 items (negative quantity)
      await square.inventory.adjust({
      catalogObjectId: 'ITEM_VAR_123',
      locationId: 'LXXX',
      quantity: -5,
      });
    • Batch apply multiple inventory changes

      Parameters

      • changes: InventoryChange[]

        Array of inventory changes

      • OptionalidempotencyKey: string

        Optional idempotency key

      Returns Promise<InventoryCount[]>

      Updated inventory counts

      await square.inventory.batchChange([
      {
      type: 'ADJUSTMENT',
      adjustment: {
      catalogObjectId: 'ITEM_1',
      fromState: 'NONE',
      toState: 'IN_STOCK',
      fromLocationId: 'LXXX',
      toLocationId: 'LXXX',
      quantity: '10',
      },
      },
      ]);
    • Batch retrieve inventory counts for multiple objects

      Parameters

      • catalogObjectIds: string[]

        Array of catalog object IDs

      • OptionallocationIds: string[]

        Optional array of location IDs

      Returns Promise<InventoryCount[]>

      Array of inventory counts

      const counts = await square.inventory.batchGetCounts(
      ['ITEM_VAR_1', 'ITEM_VAR_2'],
      ['LOCATION_1']
      );
    • Get inventory counts for a catalog object

      Parameters

      • catalogObjectId: string

        Catalog object ID (usually item variation)

      • OptionallocationId: string

        Optional location ID filter

      Returns Promise<InventoryCount[]>

      Array of inventory counts

      const counts = await square.inventory.getCounts('ITEM_VAR_123');
      console.log(`In stock: ${counts[0].quantity}`);
    • Set the inventory count for an item (physical count)

      Parameters

      • options: {
            catalogObjectId: string;
            idempotencyKey?: string;
            locationId?: string;
            occurredAt?: string;
            quantity: number;
        }

        Physical count options

      Returns Promise<InventoryCount[]>

      Updated inventory counts

      await square.inventory.setCount({
      catalogObjectId: 'ITEM_VAR_123',
      locationId: 'LXXX',
      quantity: 50,
      });
    • Transfer inventory between locations

      Parameters

      • options: {
            catalogObjectId: string;
            fromLocationId: string;
            idempotencyKey?: string;
            quantity: number;
            toLocationId: string;
        }

        Transfer options

      Returns Promise<InventoryCount[]>

      Updated inventory counts

      await square.inventory.transfer({
      catalogObjectId: 'ITEM_VAR_123',
      fromLocationId: 'LOCATION_A',
      toLocationId: 'LOCATION_B',
      quantity: 5,
      });