deleteCustomerPaymentMethod

Delete a payment method from an existing customer.

Description

This method removes a stored payment method from a customer's record.

Each customer record may contain multiple payment methods. (Exception: see Beta6 note below.) This option allows you to remove expired or unused payment methods from your customer's records.

New payment methods may be added by using addCustomerPaymentMethod.

This method requires the use of the CustNum, a unique customer number assigned by the gateway. If you have lost or cannot remember the customer's CustNum, use the searchCustomers method to find the correct CustNum.

Please Note: Beta6 supports only one payment method for each customer. This means that if you delete a payment method from a customer's account without adding a new method, the customer will be left with no existing payment methods.

See also runCustomerTransaction, enableCustomer, disableCustomer, deleteCustomer, searchCustomerID, getCustomer, searchCustomers, getCustomerHistory, addCustomer, addCustomerPaymentMethod, updateCustomer, quickUpdateCustomer

Syntax

boolean deleteCustomerPaymentMethod, ueSecurityToken Token, string Custnum, string PaymentMethodID

Arguments

Type Name Description
ueSecurityToken Token Merchant security token: used to identify merchant and validate transaction.
string Custnum CustNum of the customer which owns the payment method.
string PaymentMethodID The ID of the payment method to be deleted.

Return Value

Name Description
boolean Returns confirmation of payment method deletion only if successful. If deletion fails, an exception will be thrown.

Examples

PHP

For directions on how to set up the WSDL link, create "$token" and "$client", go to PHP Soap How-to.


        try {
      //Set CustNum for the Customer that you
      //want to delete a payment method from
      $CustNum="12345678"

      //Set PayID for the Payment Method ID
      //that you want to delete
      $PayID="7654321"

      // Delete the payment method
      $Result=$client->deleteCustomerPaymentMethod($token, $CustNum, $PayID);
    } catch(Exception $e) {
      echo 'Error: ' . $e->getMessage();
    }

Java

This example uses the Newtek Gateway Java library. For directions on how to install the library and create the token/client objects, go to the Java JAX-WS Howto.

    try {
      //Set CustNum for the Customer that you
      //want to delete a payment method from
      BigInteger custnum = new BigInteger("12345678");

      //Set PayID for the Payment Method ID
      //that you want to delete
      BigInteger PayID = new BigInteger("7654321");

      boolean Result = client.deleteCustomerPaymentMethod(token, CustNum, PayID);
    } catch (Exception e) {
        System.out.println("Soap Exception: " + e.getMessage());
    }```


### .NET VB

```vb
    Dim CustNum As String
            CustNum = "103125"
            Dim PaymentID As String
            PaymentID = "41"

            Dim response As Boolean

            response = client.deleteCustomerPaymentMethod(token, CustNum, PaymentID)
            MsgBox(response)

.NET C

For directions on how to set up the WSDL link and create the "token" and "client" variables, go to the C Sharp .Net Soap How-to.

                string CustNum = "89792";
                string PaymentID = "21";

               Boolean response;

                try
                {
                    response = client.deleteCustomerPaymentMethod(token, CustNum, PaymentID);
                    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:deleteCustomerPaymentMethod>
    <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">3d3a48eb1887857ae8bcb74a8e106ffecd7127de</HashValue>
    <Seed xsi:type="xsd:string">1782568488-test</Seed>
    <Type xsi:type="xsd:string">sha1</Type>
    </PinHash>
    <SourceKey xsi:type="xsd:string">_B4P7C4K2w2ZCQQQXRqrxDj6agrS2NIT</SourceKey>
    </Token>
    <Custnum xsi:type="xsd:string">4608157</Custnum>
    <PaymentMethodID xsi:type="xsd:string">163</PaymentMethodID>
    </ns1:deleteCustomerPaymentMethod>
    </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:deleteCustomerPaymentMethodResponse>
    <deleteCustomerPaymentMethodReturn xsi:type="xsd:boolean">true</deleteCustomerPaymentMethodReturn>
    </ns1:deleteCustomerPaymentMethodResponse>
    </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>

Change Log

Version Change
1.7 Changed CustNum and PaymentMethodID to type string