UpdateCustomer
Description
This method updates an existing customer.
Syntax
CustomerResponse UpdateCustomer(SecurityToken securityToken,Customer customer, string customerId, string customerInternalId);
Arguments
Type | Name | Description |
---|---|---|
SecurityToken | securityToken | Merchant security token: used to identify merchant and validate transaction. (required) |
Customer | customer | Includes customer information, such as customer number, merchant-assigned customer ID, billing address, receipt settings, recurring billing settings, and other pertinent information. (required) |
String | customerId | Customer ID for an existing customer. (required) |
String | customerInternalId | Unique customer ID number assigned by the internal system for an existing customer. (required) |
Return Value
Type | Description |
---|---|
CustomerResponse | Returns result of UpdateCustomer request. |
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";
}
Examples
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>*******-90b4-4a38-ad78-********</ebiz:SecurityId>
<ebiz:UserId/>
<ebiz:Password/>
</ebiz:securityToken>
<ebiz:customer>
<ebiz:MerchantId/>
<ebiz:CustomerInternalId/>
<ebiz:CustomerId>mm-0011-01</ebiz:CustomerId>
<ebiz:FirstName>Jack</ebiz:FirstName>
<ebiz:LastName>Smith</ebiz:LastName>
<ebiz:CompanyName>CBS</ebiz:CompanyName>
<ebiz:Phone>18885007797</ebiz:Phone>
<ebiz:CellPhone>7143581268</ebiz:CellPhone>
<ebiz:Fax>8885557798</ebiz:Fax>
<ebiz:Email>[email protected]</ebiz:Email>
<ebiz:WebSite>centurybizsolutions.net</ebiz:WebSite>
<ebiz:RecurringBillingData>
<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:Next>2006-11-29T09:20:00</ebiz:Next>
<ebiz:NumLeft>*a</ebiz:NumLeft>
<ebiz:Schedule/>
</ebiz:RecurringBilling>
</ebiz:RecurringBillingData>
<ebiz:BillingAddress>
<ebiz:FirstName/>
<ebiz:LastName/>
<ebiz:CompanyName>CBS</ebiz:CompanyName>
<ebiz:Address1>50 Golden</ebiz:Address1>
<ebiz:Address2/>
<ebiz:City>Abyss</ebiz:City>
<ebiz:State>CA</ebiz:State>
<ebiz:ZipCode>56789</ebiz:ZipCode>
</ebiz:BillingAddress>
<ebiz:ShippingAddress>
<ebiz:FirstName/>
<ebiz:LastName/>
<ebiz:CompanyName/>
<ebiz:Address1/>
<ebiz:Address2/>
<ebiz:City/>
<ebiz:State/>
<ebiz:ZipCode/>
</ebiz:ShippingAddress>
</ebiz:customer>
<ebiz:customerId>mm-0011-01</ebiz:customerId>
<ebiz:customerInternalId/>
</ebiz:UpdateCustomer>
</soapenv:Body>
</soapenv:Envelope>
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>
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();
}
Updated over 2 years ago