This method creates a new product record and returns a ProductRefNum
The addProduct method creates a new product record. If successful, a ProductRefNum will be returned. The ProductRefNum is a gateway assigned product identifier. This product identifier should be stored and is needed for updating and deleting products. The product database is an optional feature and may not be supported by all merchants. The merchant should check their gateway package to determine if this feature is available to them.
string addProduct ( ueSecurityToken, Product)
Type |
Name |
Description |
Token |
Merchant security token: used to identify merchant and retrieve the custom fields. |
|
Product |
Object contain product details |
string |
Returns a ProductRefNum. |
The following exceptions (errors) are applicable to this method.
Code |
Message |
Advice |
41001 |
Unable to create product database |
Merchant does not have a product database. The feature not be enabled for merchant. Contact customer service and make sure product database feature is enabled. |
<?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,
"ImageURL" => "http://acme.com/prodimg/123123.jpg",
"URL" => "http:/acme.com/prod/123123.html"
);
$ProductRefNum = $client->addProduct($token, $Product);
print_r($res);
}
catch(SoapFault $e) {
echo $e->getMessage();
}
?>
Dim product As eBizCharge.Product = New eBizCharge.Product
product.ProductID = "0-13-508011-8"
product.SKU = "135080118"
product.UPC = "9780135080115"
product.Category = "Books:Math"
Dim inventory(0 To 1) As eBizCharge.ProductInventory
inventory(0) = New eBizCharge.ProductInventory()
inventory(0).InventoryLocation = "Los angeles"
inventory(0).QtyOnHand = "10"
inventory(0).QtyOnOrder = "5"
inventory(0).DateAvailable = "2010-08-20"
product.Inventory = inventory
Dim priceTier(0 To 1) As eBizCharge.PriceTier
priceTier(0) = New eBizCharge.PriceTier()
priceTier(0).Qty = "2"
priceTier(0).Price = "100"
product.PriceTiers = priceTier
product.TaxClass = "your_tax_class"
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.0
product.ListPrice = 128.0
product.WholesalePrice = 100.0
product.DateAvailable = "2010-08-01"
product.Manufacturer = "Prentice Hail"
product.MinQuantity = "0"
Dim refNum As String
refNum = client.addProduct(token, product)
MsgBox(refNum)
eBizCharge.Product product = new eBizCharge.Product();
product.ProductID = "0-13-508011-8";
product.SKU = "135080118";
product.UPC = "9780135080115";
product.Category = "Books:Math";
eBizCharge.ProductInventory[] inventory = new eBizCharge.ProductInventory[1];
inventory[0] = new eBizCharge.ProductInventory();
inventory[0].InventoryLocation = "Los angeles";
inventory[0].QtyOnHand = "10";
inventory[0].QtyOnOrder = "5";
inventory[0].DateAvailable = "2010-08-20";
product.Inventory = inventory;
eBizCharge.PriceTier[] priceTier = new eBizCharge.PriceTier[1];
priceTier[0] = new eBizCharge.PriceTier();
priceTier[0].Qty = "2";
priceTier[0].Price = "100";
product.PriceTiers = priceTier;
product.TaxClass = "your_tax_class";
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";
string refNum;
try
{
refNum = client.addProduct(token, product);
MessageBox.Show(string.Concat(refNum));
}
catch (Exception err)
{
MessageBox.Show(err.Message);
}
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:addProduct>
<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>
<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">Test Category</Category>
<Enabled xsi:type="xsd:boolean">true</Enabled>
<Name xsi:type="xsd:string">Elementary Differential Equations</Name>
<Description xsi:type="xsd:string">Rainville (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>
<TaxClass xsi:type="xsd:string">Books</TaxClass>
<MinQuantity xsi:type="xsd:integer">5</MinQuantity>
<ImageURL xsi:type="xsd:string">http://acme.com/prodimg/123123.jpg</ImageURL>
<URL xsi:type="xsd:string">http:/acme.com/prod/123123.html</URL>
<PriceTiers SOAP-ENC:arrayType="ns1:PriceTier[3]" xsi:type="ns1:PriceTierArray">
<item xsi:type="ns1:PriceTier">
<Qty xsi:type="xsd:string">5</Qty>
<Price xsi:type="xsd:string">111.00</Price>
</item>
<item xsi:type="ns1:PriceTier">
<Qty xsi:type="xsd:string">15</Qty>
<Price xsi:type="xsd:string">110.00</Price>
</item>
<item xsi:type="ns1:PriceTier">
<Qty xsi:type="xsd:string">15</Qty>
<Price xsi:type="xsd:string">110.00</Price>
<CustomerTier xsi:type="xsd:string">Reseller</CustomerTier>
</item>
</PriceTiers>
</Product>
</ns1:addProduct>
</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:addProductResponse>
<ProductRefNum xsi:type="xsd:integer">901178061</ProductRefNum>
</ns1:addProductResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>