adjustInventory

Parent Previous Next

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

 

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

 

VB

Dim refNum As String

       refNum = "9001169811"

       Dim inventory(0 To 1) As eBizCharge.ProductInventory

       inventory(0) = New eBizCharge.ProductInventory()

       inventory(0).QtyOnHand = "+100"

       inventory(0).DateAvailable = "2010-08-12"

       Dim response() As eBizCharge.ProductInventory

       response = client.adjustInventory(token, refNum, inventory)

       MsgBox(response.Length)

 

.NET C#

           string RefNum = "900116985";

           eBizCharge.ProductInventory[] inventory = new eBizCharge.ProductInventory[1];

           inventory[0] = new eBizCharge.ProductInventory();

           inventory[0].QtyOnHand = "+100";

           inventory[0].DateAvailable = "2010-08-12";

           try

           {

               eBizCharge.ProductInventory[] response = client.adjustInventory(token, RefNum, inventory);

               MessageBox.Show(string.Concat(response.Length));

           }

           catch (Exception err)

           {

               MessageBox.Show(err.Message);

 

 

           }

XML

Request:

Response:

: