quickUpdateCustomer

Update customer data in selected fields only.

Description

This method allows you to update only specified data for a customer record, rather than replacing all existing data. Fields that can be changed using this method include a customer's contact information, as well as customized notes on their account and information regarding any recurring billing cycle that they have been enabled for, such as the amount to be billed, and the number of transactions remaining.

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.

This method uses the UpdateData array containing the fields that you would like to update. The "key" of each element is the name of the field you wish to change and the "value" of the element is the new value that you would like to assign.

The following fields may be updated using this method:

  • FirstName
  • LastName
  • CustomerID
  • Company
  • Address
  • Address2
  • City
  • State
  • Zip
  • Country
  • Phone
  • Fax
  • Email
  • URL
  • ReceiptNote
  • SendReceipt
  • Notes
  • Description
  • OrderID
  • Enabled
  • Schedule
  • Next
  • NumLeft
  • Amount
  • CustomData
  • Source
  • User
  • Card Number
  • CardExp
  • Account
  • Routing
  • CheckFormat or RecordType

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

Syntax

boolean quickUpdateCustomer ( ueSecurityToken Token, string CustNum, FieldValue UpdateData )

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.
FieldValue UpdateData Array of fields to be updated.

Return Value

Type Description
boolean Returns confirmation of request only if successful. If request 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 {

      $custnum='532';
      $update=array(
        array('Field'=>'CardExp'   , 'Value'=>'0913'),
        array('Field'=>'CardNumber', 'Value'=>'4444555566667779'),
        array('Field'=>'Amount'    , 'Value'=>'1.34'),
        array('Field'=>'Address'   , 'Value'=>'Time: ' . mktime()),
        array('Field'=>'CustomData', 'Value'=> serialize(array("MyField" => "myval"))),      
        );

      print_r($client->quickUpdateCustomer($token,$custnum, $update));

    }

    catch(SoapFault $e) {

      echo "Error: " . $e->faultstring;
      echo "\n\nRequest: " . $client->__getLastRequest();
      echo "\n\nResponse: " . $client->__getLastResponse();

    }

    catch(Exception $e) {
      echo 'Error: ' . $e->getMessage();

    }

    ?>  

Java

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

            BigInteger custnum = new BigInteger("233535");
             // Create array of fields to update
            FieldValueArray itemArray = new FieldValueArray();
            FieldValue  field1 = new FieldValue();

           field1.setField("Schedule", "daily");
           field1.setValue("Amount", "5.00");

            itemArray.getFieldValue().add(field1);



            // run quick update
            boolean response = client.quickUpdateCustomer(token, custnum, itemArray);

            } catch (Exception e) {
                System.out.println("Soap Exception:" + e.getMessage());
            }

.NET VB

    Dim custNum As String
            custNum = "103125"

            Dim fields(0 To 1) As usaepay.FieldValue


            For i As Integer = 0 To 1
                fields(i) = New usaepay.FieldValue
            Next i

            fields(0).Field = "Schedule"
            fields(0).Value = "monthly"
            fields(1).Field = "Amount"
            fields(1).Value = "5.00"

            Dim response As Boolean

            response = client.quickUpdateCustomer(token, custNum, fields)
            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.FieldValue[] fields = new usaepay.FieldValue[2];

                for (int i = 0; i < 2; i++) {
                    fields[i] = new usaepay.FieldValue();
                }

                fields[0].Field = "Schedule";   fields[0].Value = "monthly";
                fields[1].Field = "Amount";     fields[1].Value = "5.00";

                Boolean response;

                try
                {
                    response = client.quickUpdateCustomer(token, custNum, fields);
                    MessageBox.Show(string.Concat(response));
                }

                    catch (Exception err)
                    {
                        MessageBox.Show(err.Message);
                    }

XML

    <?xml version="1.0" encoding="UTF-8"?>
       <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"xmlns:ns1="urn:usaepay"
        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:quickUpdateCustomer>
                <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">aad4e875fdc4ff508e7b426e0bd5f2f322946b75</HashValue>
                      <Seed xsi:type="xsd:string">1425719194-test</Seed>
                      <Type xsi:type="xsd:string">sha1</Type>
                   </PinHash>
                   <SourceKey xsi:type="xsd:string">_B4P7C4K2w2ZCQQQXRqrxDj6agrS2NIT</SourceKey>
                </Token>
                <CustNum xsi:type="xsd:string">4610866</CustNum>
                <UpdateData SOAP-ENC:arrayType="ns1:FieldValue[4]" xsi:type="ns1:FieldValueArray">
                   <item xsi:type="ns1:FieldValue">
                      <Field xsi:type="xsd:string">CustomerID</Field>
                      <Value xsi:type="xsd:string">55555</Value>
                   </item>
                   <item xsi:type="ns1:FieldValue">
                      <Field xsi:type="xsd:string">CardExp</Field>
                      <Value xsi:type="xsd:string">0919</Value>
                   </item>
                   <item xsi:type="ns1:FieldValue">
                      <Field xsi:type="xsd:string">CardNumber</Field>
                      <Value xsi:type="xsd:string">4000100911112225</Value>
                   </item>
                   <item xsi:type="ns1:FieldValue">
                      <Field xsi:type="xsd:string">Amount</Field>
                      <Value xsi:type="xsd:string">80.50</Value>
                   </item>
                </UpdateData>
             </ns1:quickUpdateCustomer>
          </SOAP-ENV:Body>
       </SOAP-ENV:Envelope>   

Request:

    <?xml version="1.0" encoding="utf-8"?>
    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"xmlns:ns1="urn:usaepay"
     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:quickUpdateCustomerResponse>
          <quickUpdateCustomerReturn xsi:type="xsd:boolean">true</quickUpdateCustomerReturn>
        </ns1:quickUpdateCustomerResponse>
      </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>

Change History

Version Change
1.7 Changed CustNum to type string
1.1 Method added prior to v1.1