developer:soap-1.3:methods:adjustinventory

Soap API v1.3

adjustInventory

This method adjusts the inventory for a product

Description

This method can be used to either adjust or set the inventory for a product. The product to update inventory for is selected by the ProductRefNum parameter which is assigned by the gateway when the product was added. Inventory levels for multiple warehouses (inventory locations) may be set at the same time. The Inventory parameter is an array of ProductInventory objects containing the new qty levels or adjustments to current levels. Warehouses that are not sent in the array are left as is. Quantaties sent as simple numbers will replace the existing quanties. If a ”+” or ”-” is sent before the number, the existing quantity will be either increased or decreased.

For example:

Starting Inventory
InventoryLocation QtyOnHand QtyOnOrder
Los Angeles 5 200
Washington DC 10 0
New York 123 10
Chicago 24 0
Array of ProductInventory
InventoryLocation QtyOnHand QtyOnOrder DateAvailable
Los Angeles +100 -100 8/10/2010
Washington DC 0 19 6/30/2010
New York -13 10 8/10/2010
Ending Inventory
InventoryLocation QtyOnHand QtyOnOrder
Los Angeles 105 100
Washington DC 0 19
New York 110 10
Chicago 24 0

See also updateProduct

Syntax

ProductInventory[] adjustInventory ( ueSecurityToken, ProductRefNum, ProductInventory[])

Arguments

Type Name Description
ueSecurityToken Token Merchant security token: used to identify merchant and retrieve the custom fields.
string ProductRefNum Product reference number (gateway assigned)
ProductInventory[] Inventory Array of ProductInventory objects containing qty or adjustments for each warehouse/inventory location

Return Value

ProductInventory[] Returns an array of ProductInventory objects containing the adjusted inventory levels.

Exceptions

The following exceptions (errors) are applicable to this method.

Code Message Advice
41002 Product Not Found Product specified by ProductRefNum was not found. Make sure the number stored is not truncated or rounded.
41003 Error saving product A database fault was encountered while saving product record. Try operation again or contact support

Examples

PHP

For directions on how to set up the WSDL link, create “$token” and “$client”, go to PHP Soap How-to.

 

VB

Dim refNum As String
        refNum = "9001169812"
 
        Dim inventory(0 To 1) As usaepay.ProductInventory
        inventory(0) = New usaepay.ProductInventory()
 
        inventory(0).QtyOnHand = "+100"
        inventory(0).DateAvailable = "2010-08-12"
 
        Dim response() As usaepay.ProductInventory
        response = client.adjustInventory(token, refNum, inventory)
        MsgBox(response.Length)

.NET C#

string RefNum = "900116989";
 
            usaepay.ProductInventory[] inventory = new usaepay.ProductInventory[1];
            inventory[0] = new usaepay.ProductInventory();
 
            inventory[0].QtyOnHand = "+100";
            inventory[0].DateAvailable = "2010-08-12";
 
            try
            {
                usaepay.ProductInventory[] response = client.adjustInventory(token, RefNum, inventory);
                MessageBox.Show(string.Concat(response.Length));
            }
            catch (Exception err)
            {
                MessageBox.Show(err.Message);
            }

XML

Request:

 

Response:

 

Change History

Version Change
1.3 Method added in this release
developer/soap-1.3/methods/adjustinventory.txt · Last modified: 2010/10/12 15:51 by irina

Page Tools