updateProduct

Parent Previous Next

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.

 

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

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

 

<?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 eBizCharge.Product = New eBizCharge.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";

           eBizCharge.Product product = new eBizCharge.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:eBizCharge"

       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">192.168.0.1</ClientIP>

<PinHash xsi:type="ns1:ueHash">

<HashValue xsi:type="xsd:string">11ac55b0a0b59f8f028dbf85bc32266fa973dd0e</HashValue>

<Seed xsi:type="xsd:string">12678150211876663375</Seed>

<Type xsi:type="xsd:string">sha1</Type>

</PinHash>

<SourceKey xsi:type="xsd:string">HB4P7C4K2w2ZCQQQXRqrxDj6agrS2NIT</SourceKey>

</Token>

<ProductRefNum xsi:type="xsd:string">9011780623</ProductRefNum>

<Product xsi:type="ns1:Product">

 <ProductID xsi:type="xsd:string">0-13-508011-8</ProductID>

 <SKU xsi:type="xsd:string">135080118</SKU>

 <UPC xsi:type="xsd:string">9780135080115</UPC>

 <Category xsi:type="xsd:string">Books:Math</Category>

 <Enabled xsi:type="xsd:boolean">true</Enabled>

 <Name xsi:type="xsd:string">A new Product Name</Name>

 <Description xsi:type="xsd:string">Rainville, Bedient and Bedient (Eight Edition)</Description>

 <Weight xsi:type="xsd:double">1</Weight>

 <ShipWeight xsi:type="xsd:double">1.1</ShipWeight>

 <Price xsi:type="xsd:double">112</Price>

 <WholesalePrice xsi:type="xsd:double">100</WholesalePrice>

 <ListPrice xsi:type="xsd:double">128</ListPrice>

 <DateAvailable xsi:type="xsd:string">2009-12-01</DateAvailable>

 <Manufacturer xsi:type="xsd:string">Prentice Hall</Manufacturer>

 <MinQuantity xsi:type="xsd:integer">0</MinQuantity>

 <MaxQuantity xsi:type="xsd:integer">10</MaxQuantity>

 <ImageURL xsi:type="xsd:string">http://acme.com/prodimg/123123.jpg</ImageURL>

 <URL xsi:type="xsd:string">http:/acme.com/prod/123123.html</URL>

</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:eBizCharge"

       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>

: