updateCustomer

Replace all data for customer specified by CustNum.

Description

This method completely replaces all existing customer data for a specific customer. If you leave any of the fields blank or do not include them in the request, it will delete those fields on the customer record.

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.

Depending on your programming language, you should be able to retrieve the customer object using the getCustomer method, alter any fields you want and then submit it back using the updateCustomer method.

If you only wish to update a few specific fields, use the quickUpdateCustomer method.

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

Syntax

boolean updateCustomer ( ueSecurityToken Token, string CustNum, CustomerObject CustomerData )

Arguments

Type Name Description
ueSecurityToken Token Merchant security token: used to identify merchant and validate transaction.
string CustNum A unique customer number assigned by the gateway.
CustomerObject CustomerData Includes customer information such as customer number, merchant assigned customer ID, billing address, receipt settings, recurring billing settings, and other pertinent information.

Return Value

Type Description
boolean Returns confirmation of customer update only if data revision was successful. If update 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.

    <?php

    try {

      $customer=$tran->getCustomer($token, 1309);

      $customer->Amount=29.99;
      $customer->Description='New Description';

      $res=$client->updateCustomer($token, 1309, $customer);

      print_r($res);

    }

    catch(SoapFault $e) {

      echo "SoapFault: " .$e->getMessage();
      print_r($e);
      echo "\n\nRequest: " . $client->__getLastRequest();
      echo "\n\nResponse: " . $client->__getLastResponse();

    }

    ?>

.NET VB

    Dim CustNum As String
            CustNum = "103125"

            Dim customer As usaepay.CustomerObject = New usaepay.CustomerObject
            customer = client.getCustomer(token, CustNum)
            customer.Amount = 29.99

            Dim response As Boolean

            response = client.updateCustomer(token, CustNum, customer)
            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 = "89147";

                usaepay.CustomerObject customer = new usaepay.CustomerObject();
                customer = client.getCustomer(token, CustNum);
                customer.Amount = 29.99;

                Boolean response;

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

Change Log

Version Change
1.7 Changed CustNum to type string