AddCustomer
Description
This method allows to add a new customer to EBizCharge.
Customer will be assigned a unique customer id by EBizCharge (CustomerInternalId), which can then be used to establish recurring billing cycles, recall customer data, and manually charge the customer for later products or services without needing to reenter their information.
Syntax
CustomerResponse AddCustomer(SecurityToken securityToken,Customer customer);
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) |
Return Value
Type | Description |
---|---|
CustomerResponse | Returns result of AddCustomer request. |
Examples
function addCustomer()
{
$client = new SoapClient('End point URL');
$securityToken = array(
'SecurityId' => '******-454757-4567457-********',
'UserId' => 'merchant1',
'Password' => 'merchant1'
);
$customerData = array(
'CustomerId' => '123',
'FirstName' => 'Why',
'LastName' => 'What',
'CompanyName' => 'CBS',
'Phone' => '234-343434',
'CellPhone' => '44-3343434',
'Fax' => '234-343434',
'Email' => '[email protected]',
'WebSite' => 2,
'ShippingAddress' => array(
'FirstName' => 'Why',
'LastName' => 'What',
'Company' => 'HereNow',
'Address1' => 'ST # 8 HS 9 London',
'Address2' => 'ST # 1 HS 11 London',
'City' => 'London',
'State' => 'London',
'ZipCode' => 'E1 6AN',
'Country' => 'UK',
'Phone' => '233-23445',
'Fax' => '233-234432',
'Email' => '[email protected]'
),
'BillingAddress' => array(
'FirstName' => 'Why',
'LastName' => 'What',
'Company' => 'Anycompany',
'Address1' => 'ST # 266 HS 102 London',
'Address2' => 'ST # 566 HS 21 London',
'City' => 'London',
'State' => 'London',
'ZipCode' => 'E1 6AN',
'Country' => 'UK',
'Phone' => '456-23445',
'Fax' => '456-234432',
'Email' => '[email protected]'
))
;
$customerResult = $client->AddCustomer(array(
'securityToken' => $securityToken,
'customer' => $customerData
));
$addCustomerResult = $customerResult->AddCustomerResult;
if ($customerResult->Status == 'Success')
return 'Customer Added Successfully';
else
return 'Customer not Added';
}
Request:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ebiz="http://eBizCharge.ServiceModel.SOAP">
<soapenv:Header/>
<soapenv:Body>
<ebiz:AddCustomer>
<ebiz:securityToken>
<ebiz:SecurityId>********-90b4-4a38-ad78-********</ebiz:SecurityId>
<ebiz:UserId>userid</ebiz:UserId>
<ebiz:Password>userpassword</ebiz:Password>
</ebiz:securityToken>
<ebiz:customer>
<ebiz:MerchantId/>
<ebiz:CustomerInternalId/>
<ebiz:CustomerId>mm-0011-03</ebiz:CustomerId>
<ebiz:FirstName>Dan</ebiz:FirstName>
<ebiz:LastName>Tran</ebiz:LastName>
<ebiz:CompanyName>CBS</ebiz:CompanyName>
<ebiz:Phone>1-888-500-7798</ebiz:Phone>
<ebiz:CellPhone>1-714-555-1234</ebiz:CellPhone>
<ebiz:Fax>1-888-777-7797</ebiz:Fax>
<ebiz:Email>[email protected]</ebiz:Email>
<ebiz:WebSite>https://ebizcharge.com</ebiz:WebSite>
<ebiz:BillingAddress>
<ebiz:FirstName>m</ebiz:FirstName>
<ebiz:LastName>e</ebiz:LastName>
<ebiz:CompanyName></ebiz:CompanyName>
<ebiz:Address1></ebiz:Address1>
<ebiz:Address2>r</ebiz:Address2>
<ebiz:City></ebiz:City>
<ebiz:State></ebiz:State>
<ebiz:ZipCode></ebiz:ZipCode>
</ebiz:BillingAddress>
<ebiz:ShippingAddress>
<ebiz:FirstName></ebiz:FirstName>
<ebiz:LastName></ebiz:LastName>
<ebiz:CompanyName></ebiz:CompanyName>
<ebiz:Address1></ebiz:Address1>
<ebiz:Address2></ebiz:Address2>
<ebiz:City></ebiz:City>
<ebiz:State></ebiz:State>
<ebiz:ZipCode></ebiz:ZipCode>
</ebiz:ShippingAddress>
</ebiz:customer>
</ebiz:AddCustomer>
</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">
<AddCustomerResponse xmlns="http://eBizCharge.ServiceModel.SOAP">
<AddCustomerResult>
<CustomerId>mm-0011-03</CustomerId>
<CustomerInternalId>********-9e4a-4e77-a55b-********</CustomerInternalId>
<Status>Success</Status>
<StatusCode>1</StatusCode>
<Error/>
<ErrorCode>0</ErrorCode>
</AddCustomerResult>
</AddCustomerResponse>
</s:Body>
</s:Envelope>
public void AddCustomer()
{
eBizService apiClient = new eBizService();
SecurityToken securityToken = new SecurityToken
{
SecurityId = "*******-c870-41b8-aa5c-********",
UserId = "",
Password = ""
};
Customer customer = new Customer();
customer.FirstName = "Mark";
customer.LastName = "Wilson";
customer.CompanyName = "CBS";
customer.CustomerId = "C-E&000002";
customer.CellPhone = "714-555-5014";
customer.Fax = "714-555-5010";
customer.Phone = "714-555-5015";
customer.BillingAddress = new Address();
customer.BillingAddress.Address1 = "55 Golden";
customer.BillingAddress.Address2 = "Suite 5555";
customer.BillingAddress.City = "Abyss";
customer.BillingAddress.ZipCode = "56789";
customer.BillingAddress.State = "CA";
CustomerResponse response = apiClient.AddCustomer(securityToken, customer);
Console.WriteLine(response.CustomerInternalId);
Console.WriteLine(response.Status);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Error);
Console.WriteLine(response.ErrorCode);
Console.ReadLine();
}
Updated about 1 year ago