UpdateCustomer

Description

The UpdateCustomer method modifies an existing Customer object in the EBizCharge platform.

Syntax

CustomerResponse UpdateCustomer(SecurityToken securityToken, Customer customer, string customerId, string customerInternalId)

Arguments

Type

Name

Req.

Description

SecurityToken

securityToken

R

A unique token that is used to identify a merchant and authenticate the API request.

Customer

customer

R

The updated Customer object that replaces the existing object.

Warning: Omitting a field clears its value.

string

customerId

D

Custom ID of the associated Customer object.

Note: Required if customerInternalId is not included.

string

customerInternalId

D

Internal ID of the associated Customer object (assigned by EBizCharge).

Note: Required if customerId is not included.

Return Value

TypeDescription
CustomerResponseIndicates whether the operation was successful.

Example Request

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ebiz="http://eBizCharge.ServiceModel.SOAP">
   <soapenv:Header/>
   <soapenv:Body>
      <ebiz:UpdateCustomer>
         <ebiz:securityToken>
            <ebiz:SecurityId>***************************636c223</ebiz:SecurityId>
            <ebiz:UserId/>
            <ebiz:Password/>
         </ebiz:securityToken>
         <ebiz:customer>
            <ebiz:FirstName>Jack</ebiz:FirstName>
            <ebiz:LastName>Smith</ebiz:LastName>
            <ebiz:CompanyName>CBS</ebiz:CompanyName>
            <ebiz:Phone>18885007797</ebiz:Phone>
            <ebiz:Fax>8885557798</ebiz:Fax>
            <ebiz:Email>[email protected]</ebiz:Email>
            <ebiz:RecurringBillingData>
               <!--Zero or more repetitions:-->
               <ebiz:RecurringBilling>
                  <ebiz:Amount>1000.00</ebiz:Amount>
                  <ebiz:Enabled>true</ebiz:Enabled>
                  <ebiz:Expire>2005-09-12T01:55:02-07:00</ebiz:Expire>
               </ebiz:RecurringBilling>
            </ebiz:RecurringBillingData>
            <ebiz:BillingAddress>
               <ebiz:FirstName>Will</ebiz:FirstName>
               <ebiz:LastName>Smith</ebiz:LastName>
               <ebiz:CompanyName>CBS</ebiz:CompanyName>
               <ebiz:Address1>50 Golden</ebiz:Address1>
               <ebiz:City>Abyss</ebiz:City>
               <ebiz:State>CA</ebiz:State>
               <ebiz:ZipCode>56789</ebiz:ZipCode>
            </ebiz:BillingAddress>
            <ebiz:ShippingAddress>
               <ebiz:FirstName/>
               <ebiz:LastName/>
               <ebiz:Address1/>
               <ebiz:City/>
               <ebiz:State/>
               <ebiz:ZipCode/>
            </ebiz:ShippingAddress>
            <ebiz:PaymentMethodProfiles>         
               <ebiz:PaymentMethodProfile>      
                  <ebiz:MethodType/>            
                  <ebiz:MethodID/>  
                  <ebiz:MethodName/>          
               </ebiz:PaymentMethodProfile>
            </ebiz:PaymentMethodProfiles>
            <ebiz:CustomerCustomFields>
               <!--Zero or more repetitions:-->
               <ebiz:EbizCustomField>   
                  <ebiz:FieldId/> 
                  <ebiz:FieldCaption/>
                  <ebiz:FieldName/>
                  <ebiz:FieldValue/>              
                  <ebiz:FieldType/>
                  <ebiz:FieldDataType/>
                  <ebiz:FieldDescription/>
               </ebiz:EbizCustomField>
            </ebiz:CustomerCustomFields>
         </ebiz:customer>
         <ebiz:customerId/>
         <ebiz:customerInternalId>*********************76876d68</ebiz:customerInternalId>
      </ebiz:UpdateCustomer>
   </soapenv:Body>
</soapenv:Envelope>
public void UpdateCustomer()
{
  eBizService apiClient = new eBizService();
  SecurityToken securityToken = new SecurityToken
  {
    SecurityId = "********-c870-41b8-aa5c-********",
    UserId = "",
    Password = ""
    };
  var customer = apiClient.GetCustomer(securityToken, "", "********-c6a7-41b3-a2e7-********");
  customer.FirstName = "Mark update";
  customer.LastName = "Wilson update";
  customer.CompanyName = "CBS";
  customer.CellPhone = "714-555-1111";
  customer.Fax = "714-555-1235";
  customer.Phone = "714-555-2525";
  CustomerResponse Response = apiClient.UpdateCustomer(securityToken,customer,"", "********-c6a7-41b3-a2e7-********");
  Console.WriteLine(Response.CustomerInternalId);
  Console.WriteLine(Response.Status);
  Console.WriteLine(Response.StatusCode);
  Console.WriteLine(Response.Error);
  Console.WriteLine(Response.ErrorCode);
  Console.ReadLine();
}
function updateCustomer()
{
  $client = new SoapClient('End point URL');
  $securityToken = array(
    'SecurityId' => '******-454757-4567457-********',
    'UserId' => 'merchant1',
    'Password' => 'merchant1'
  );
  $customerData = array(
    'CustomerId' => 1,
    'FirstName' => 'Tonya',
    'LastName' => 'Harding',
    'CompanyName' => 'ABC',
    'Phone' => '234-223232',
    'Fax' => '234-223232',
    'Email' => '[email protected]',
    'WebSite' => 1,
    'BillingAddress' => array(), // billing address object
    'ShippingAddress' => array() // shipping address object
  );
  $updateCustomerResponse = $client->UpdateCustomer(
    array(
    'securityToken' => $securityToken,
    'customer' => $customerData,
    'customerId' => 1,
    'customerInternalId' => '*******-45784-478475'
  ));
  $updateCustomer = $updateCustomerResponse->UpdateCustomerResult;
  if ($updateCustomer->Status == "Success")
    echo "Customer Updated";
  else
    echo "Customer not Updated";
}

Example Response

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
   <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <UpdateCustomerResponse xmlns="http://eBizCharge.ServiceModel.SOAP">
         <UpdateCustomerResult>
            <CustomerId>mm-0011-01</CustomerId>
            <CustomerInternalId/>
            <Status>Success</Status>
            <StatusCode>1</StatusCode>
            <Error/>
            <ErrorCode>0</ErrorCode>
         </UpdateCustomerResult>
      </UpdateCustomerResponse>
   </s:Body>
</s:Envelope>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
   <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <UpdateCustomerResponse xmlns="http://eBizCharge.ServiceModel.SOAP">
         <UpdateCustomerResult>
            <CustomerId/>
            <CustomerInternalId/>
            <Status>Failed</Status>
            <StatusCode>0</StatusCode>
            <Error>Not Found</Error>
            <ErrorCode>3</ErrorCode>
         </UpdateCustomerResult>
      </UpdateCustomerResponse>
   </s:Body>
</s:Envelope>