deleteProduct

This method deletes an existing product.

Description

This method removes the specified ProductRefNum from the product database. The product is deleted immediately and this operation can not be undone. The ProductRefNum is the gateway assigned product ID that was returned by addProduct. searchProducts can be used to find the ProductRefNum for a product if it is not known.

See also addProduct, searchProducts

Syntax

boolean deleteProduct ( ueSecurityToken Token, string ProductRefNum)

Arguments

Type Name Description
ueSecurityToken Token Merchant security token: used to identify merchant and retrieve the custom fields.
string ProductRefNum Product reference number used to delete a product

Return Value

| Type | Description | | ---- | ---- | ----------- | boolean | Returns true if product has been deleted (on error an exception is thrown) |

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.
41005 Failed to delete product A database fault was encountered while deleting 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 {

      $ProductRefNum='919932077432';
      $client->deleteProduct($token, $ProductRefNum);

    }

    catch(SoapFault $e) {

      echo $e->getMessage();

    }

    ?>

VB

    Dim refNum As String
            refNum = "9001169810"
            Dim response As Boolean

            response = client.deleteProduct(token, refNum)
            MsgBox(response)

.NET C

                string RefNum = "900116982";

                Boolean response;

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

XML

Request:

    <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:deleteProduct>
    <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">31fdc81f0d453b90e6896ae62062369a33fade08</HashValue>
    <Seed xsi:type="xsd:string">11821282856-test</Seed>
    <Type xsi:type="xsd:string">sha1</Type>
    </PinHash>
    <SourceKey xsi:type="xsd:string">_B4P7C4K2w2ZCQQQXRqrxDj6agrS2NIT</SourceKey>
    </Token>
    <ProductRefNum xsi:type="xsd:string">9001001973</ProductRefNum>
    </ns1:deleteProduct>
    </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:deleteProductResponse>
    <deleteProductReturn xsi:type="xsd:boolean">true</deleteProductReturn>
    </ns1:deleteProductResponse>
    </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>

Change History

Version Change
1.3 Method added in this release