updateProduct

This method updates an existing product.

Description

Updates an existing product based on its ProductRefNum. The entire product is replaced by the contents of the Product parameter. Developers can use the getProduct method to retrieve the Product object, modify a field and then post the object back to the server. If you only need to update one field, consider using the quickUpdateProduct method instead.

See also quickUpdateProduct

Syntax

boolean updateProduct ( ueSecurityToken, ProductRefNum, Product)

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)
Product Product Product data

Return Value

Type Description
boolean Returns a true if the product is updated correctly

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.

    <?php

    try {
                $Product = array(
                "ProductID" => "0-13-508011-8",
                "SKU" =>"135080118",
                "UPC" => "9780135080115",
                "Category" => "Books:Math",
                "Enabled" => true,
                "Name" => "Elementary Differential Equations",
                "Description" => "Rainville, Bedient and Bedient (Eight Edition)",
                "Weight" => 1.0,
                "ShipWeight" => 1.1,
                "Price" => 112.00,
                "ListPrice" =>  128.00,
                "WholesalePrice"=> 100.00,
                "DateAvailable" => "2009-12-01",
                "Manufacturer" => "Prentice Hall",
                "Type" => "Unknown",
                "MinQuantity" =>0,
                "MaxQuantity" =>10,
                "ImageURL" => "http://acme.com/prodimg/123123.jpg",
                "URL" => "http:/acme.com/prod/123123.html"
            );

            $client->updateProduct($token, $ProductRefNum, $Product);

    }

    catch(SoapFault $e) {

      echo $e->getMessage();

    }

    ?>

VB

    Dim RefNum As String
            RefNum = "9001169810"

            Dim product As usaepay.Product = New usaepay.Product()
            product.ProductID = "0-13-508011-8"
            product.SKU = "135080118"
            product.UPC = "9780135080115"
            product.Category = "Books:Science"
            product.Enabled = True
            product.Name = "Non-Elementary Differential Equations"
            product.Description = "Rainville, Bedient and Bedient (Eight Edition)"
            product.Weight = 1.0
            product.ShipWeight = 1.1
            product.Price = 112.0
            product.ListPrice = 128.0
            product.WholesalePrice = 100.0
            product.DateAvailable = "2010-08-01"
            product.Manufacturer = "Prentice Hail"
            product.MinQuantity = "0"

            Dim response As Boolean

            response = client.updateProduct(token, RefNum, product)
            MsgBox(response)

.NET C

                string RefNum = "900116982";

                usaepay.Product product = new usaepay.Product();
                product.ProductID = "0-13-508011-8";
                product.SKU = "135080118";
                product.UPC = "9780135080115";
                product.Category = "Books:Science";
                product.Enabled = true;
                product.Name = "Elementary Differential Equations";
                product.Description = "Rainville, Bedient and Bedient (Eight Edition)";
                product.Weight = 1.0;
                product.ShipWeight = 1.1;
                product.Price = 112.00;
                product.ListPrice = 128.00;
                product.WholesalePrice = 100.00;
                product.DateAvailable = "2010-08-01";
                product.Manufacturer = "Prentice Hail";
                product.MinQuantity = "0";

                Boolean response;

                try
                {
                    response = client.updateProduct(token, RefNum, product);
                    MessageBox.Show(string.Concat(response));
                }
                catch (Exception err)
                {
                    MessageBox.Show(err.Message);
                }

XML

Request:

    <?xml version="1.0" encoding="UTF-8"?>
    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:ns1="urn:usaepay"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
    SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
    <SOAP-ENV:Body>
    <ns1:updateProduct>
    <Token xsi:type="ns1:ueSecurityToken">
    <ClientIP xsi:type="xsd:string">123.123.123.123</ClientIP>
    <PinHash xsi:type="ns1:ueHash">
    <HashValue xsi:type="xsd:string">a6a24337700a018bb569202fefb5e034414f2adf</HashValue>
    <Seed xsi:type="xsd:string">11288967116-test</Seed>
    <Type xsi:type="xsd:string">sha1</Type>
    </PinHash>
    <SourceKey xsi:type="xsd:string">_B4P7C4K2w2ZCQQQXRqrxDj6agrS2NIT</SourceKey>
    </Token>
    <ProductRefNum xsi:type="xsd:string">9001001967</ProductRefNum>
    <Product xsi:type="ns1:Product">
    <ProductID xsi:type="xsd:string">866872</ProductID>
    <SKU xsi:type="xsd:string">111111111</SKU>
    <UPC xsi:type="xsd:string">555555555</UPC>
    <Category xsi:type="xsd:string">liqour</Category>
    <Enabled xsi:type="xsd:boolean">true</Enabled>
    <Name xsi:type="xsd:string">Big V</Name>
    <Description xsi:type="xsd:string">vodka</Description>
    <Model xsi:type="xsd:string">bottle</Model>
    <Weight xsi:type="xsd:double">5.7</Weight>
    <ShipWeight xsi:type="xsd:double">11.7</ShipWeight>
    <Price xsi:type="xsd:double">40</Price>
    <WholesalePrice xsi:type="xsd:double">60</WholesalePrice>
    <ListPrice xsi:type="xsd:double">20</ListPrice>
    <Manufacturer xsi:type="xsd:string">Chase</Manufacturer>
    <PhysicalGood xsi:type="xsd:boolean">true</PhysicalGood>
    <MinQuantity xsi:type="xsd:integer">80</MinQuantity>
    <ImageURL xsi:type="xsd:string">www.lime.com</ImageURL>
    <URL xsi:type="xsd:string">www.lime.com</URL>
    <Created xsi:type="xsd:dateTime"/>
    <Modified xsi:type="xsd:dateTime"/>
    <PriceTiers SOAP-ENC:arrayType="ns1:PriceTier[1]" xsi:type="ns1:PriceTierArray">
    <item xsi:type="ns1:PriceTier">
    <Qty xsi:type="xsd:string">10</Qty>
    <Price xsi:type="xsd:string">25</Price>
    </item>
    </PriceTiers>
    </Product>
    </ns1:updateProduct>
    </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>

Response:

    <?xml version="1.0" encoding="utf-8"?>
    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:ns1="urn:usaepay"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
    SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
    <SOAP-ENV:Body>
    <ns1:updateProductResponse>
    <updateProductReturn xsi:type="xsd:boolean">true</updateProductReturn>
    </ns1:updateProductResponse>
    </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>