getProduct
Retrieve all data for a single product
Description
This method retrieves the Product object for the product specified by ProductRefNum. The ProductRefNum is the gateway assigned unique product identifier that was returned by [addProduct]. [searchProducts can be used to find the ProductRefNum for a product if it is not known.
The entire Product object is returned.
See also addProduct, searchProducts
Syntax
Product getProduct ( ueSecurityToken Token,string ProductRefNum)
Arguments
Type | Name | Description |
---|---|---|
ueSecurityToken | Token | Merchant security token: used to identify merchant and retrieve the custom fields. |
string | ProductRefNum | Gateway assigned product ID used to pull product details |
Return Value
| Type | Description | | ---- | ---- | ----------- | Product | Returns a Product object containing fields and their values. |
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. |
Examples
PHP
For directions on how to set up the WSDL link, create "$token" and "$client", go to PHP Soap How-to.
<?php
try {
$ProductRefNum = '912093987473';
$product = $client->getProduct($token, $ProductRefNum);
print_r($product);
}
catch(SoapFault $e) {
echo $e->getMessage();
}
?>
VB
Dim prod As newtek.Product = New newtek.Product
Dim refNum As String
refNum = "9001169811"
prod = client.getProduct(token, refNum)
MsgBox(prod.Name)
.NET C
string RefNum = "900116985";
newtek.Product response = new newtek.Product();
try
{
response = client.getProduct(token, RefNum);
MessageBox.Show(string.Concat(response.Price));
}
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:newtek"
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:getProduct>
<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">720104052fd3b583716a1b18021b4986fee3c482</HashValue>
<Seed xsi:type="xsd:string">11434035177-test</Seed>
<Type xsi:type="xsd:string">sha1</Type>
</PinHash>
<SourceKey xsi:type="xsd:string">_B4P7C4K2w2ZCQQQXRqrxDj6agrS2NIT</SourceKey>
</Token>
<ProductRefNum xsi:type="xsd:string">9001001976</ProductRefNum>
</ns1:getProduct>
</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:newtek"
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:getProductResponse>
<getProductReturn xsi:type="ns1:Product">
<ProductRefNum xsi:type="xsd:string">9001001976</ProductRefNum>
<ProductID xsi:type="xsd:string">2345678</ProductID>
<SKU xsi:type="xsd:string">909090</SKU>
<UPC xsi:type="xsd:string">789789</UPC>
<Category xsi:type="xsd:string">liqour</Category>
<Enabled xsi:type="xsd:boolean">true</Enabled>
<Name xsi:type="xsd:string">sailor jerry</Name>
<Description xsi:type="xsd:string">spice rum bottle</Description>
<Model xsi:type="xsd:string">bottle</Model>
<Weight xsi:type="xsd:double">7.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>
<DateAvailable xsi:type="xsd:string">0000-00-00</DateAvailable>
<Manufacturer xsi:type="xsd:string">Chase</Manufacturer>
<PhysicalGood xsi:type="xsd:boolean">true</PhysicalGood>
<TaxClass xsi:type="xsd:string">None</TaxClass>
<MinQuantity xsi:type="xsd:integer">18</MinQuantity>
<ImageURL xsi:type="xsd:string">www.candyland.com</ImageURL>
<URL xsi:type="xsd:string">www.candyland.com</URL>
<Created xsi:type="xsd:dateTime">2015-12-17T14:54:28+08:00</Created>
<Modified xsi:type="xsd:dateTime">2015-12-17T14:54:28+08:00</Modified>
<Inventory SOAP-ENC:arrayType="ns1:ProductInventory[0]"
xsi:type="ns1:ProductInventoryArray" />
<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>
<CustomerTier xsi:type="xsd:string"></CustomerTier>
</item>
</PriceTiers>
</getProductReturn>
</ns1:getProductResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>