addProductCategory

This method creates a new product category record and returns a ProductCategoryRefNum

Description

The addProductCategory method creates a new product category record. If successful, a ProductCategoryRefNum will be returned. The ProductCategoryRefNum is a gateway assigned product category identifier. This product category identifier should be stored and is needed for updating and deleting product categories. 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.

See also updateProductCategory, deleteProductCategory

Syntax

string addProductCategory ( ueSecurityToken,ProductCategory)

Arguments

Type Name Description
ueSecurityToken Token Merchant security token: used to identify merchant and retrieve the custom fields.
string ProductCategory Product category data

Return Value

Type Description
string Returns a ProductCategoryRefNum.

Exceptions

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.

Examples

VB

    Dim category As newtek.ProductCategory = New newtek.ProductCategory
            category.Name = "The first"
            Dim response As String

            response = client.addProductCategory(token, category)
            MsgBox(response)

.NET C

                newtek.ProductCategory category = new newtek.ProductCategory();
                category.Name = "The first";
                string response;

                try
                {
                    response = client.addProductCategory(token, category);
                    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: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:addProductCategory>
    <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">e229fb6ce9c42bfc12c41f738dfc3984cb8a5461</HashValue>
    <Seed xsi:type="xsd:string">1975389982-test</Seed>
    <Type xsi:type="xsd:string">sha1</Type>
    </PinHash>
    <SourceKey xsi:type="xsd:string">_B4P7C4K2w2ZCQQQXRqrxDj6agrS2NIT</SourceKey>
    </Token>
    <ProductCategory xsi:type="ns1:ProductCategory">
    <Name xsi:type="xsd:string">IceCream</Name>
    </ProductCategory>
    </ns1:addProductCategory>
    </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:addProductCategoryResponse>
    <ProductCategoryRefNum xsi:type="xsd:string">9001001925</ProductCategoryRefNum>
    </ns1:addProductCategoryResponse>
    </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>