AddSubCustomer

Description

The AddSubCustomer method adds a SubCustomer to an existing Customer in the EBizCharge platform.

Syntax

SubCustomerResponse AddSubCustomer(SecurityToken securityToken, SubCustomer subcustomer)

Arguments

Type

Name

Req.

Description

SecurityToken

securityToken

R

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

SubCustomer

subcustomer

R

New SubCustomer object to add to the EBizCharge platform.

Required Fields
  • CustomerID
  • SubCustomerID

If using the objects below, the following fields are required. Unused obects must be removed from the request.

Address:

  • IsDefault

Return Value

TypeDescription
SubCustomerResponseIndicates whether the operation was successful. If successful, returns the assigned CustomerID and SubCustomerInternalID. Otherwise, returns error information.

Example Request

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ebiz="http://eBizCharge.ServiceModel.SOAP">
   <soapenv:Header/>
   <soapenv:Body>
      <ebiz:AddSubCustomer>
         <ebiz:securityToken>
            <ebiz:SecurityId>*******************-ad78-28a795af78e9</ebiz:SecurityId>
            <ebiz:UserId></ebiz:UserId>
            <ebiz:Password></ebiz:Password>
         </ebiz:securityToken>
         <ebiz:subcustomer>
            <ebiz:CustomerId>mm-0011-03</ebiz:CustomerId>
            <ebiz:SubCustomerId>mm-0011-03[4]</ebiz:SubCustomerId>
            <ebiz:BillingAddress>
               <ebiz:FirstName>Anthony</ebiz:FirstName>
               <ebiz:LastName>Kim</ebiz:LastName>
               <ebiz:CompanyName>CBS</ebiz:CompanyName>
               <ebiz:Address1>123 Golden</ebiz:Address1>
               <ebiz:City>Seattle</ebiz:City>
               <ebiz:State>CA</ebiz:State>
               <ebiz:ZipCode>92618</ebiz:ZipCode>
            </ebiz:BillingAddress>
            <ebiz:ShippingAddress>
               <ebiz:FirstName>Anthony</ebiz:FirstName>
               <ebiz:LastName>Kim</ebiz:LastName>
               <ebiz:CompanyName>CBS</ebiz:CompanyName>
               <ebiz:Address1>1234 Golden</ebiz:Address1>
               <ebiz:City>Irvine</ebiz:City>
               <ebiz:State>CA</ebiz:State>
               <ebiz:ZipCode>92618</ebiz:ZipCode>
           </ebiz:ShippingAddress>
           <ebiz:FirstName/>
           <ebiz:LastName/>
           <ebiz:CompanyName/>
           <ebiz:Phone/>
           <ebiz:CellPhone/>
           <ebiz:Fax/>
           <ebiz:Email/>
           <ebiz:WebSite/>
           <ebiz:SubCustomerNotes/>
           <ebiz:SoftwareId/>
           <ebiz:SubCustomerCustomFields>
              <!--Zero or more repetitions:-->
              <ebiz:EbizCustomField>
                 <ebiz:FieldId/>
                 <ebiz:FieldCaption/>
                 <ebiz:FieldName/>
                 <ebiz:FieldValue/>
                 <ebiz:FieldType/>
                 <ebiz:FieldDataType/>
                 <ebiz:FieldDescription/>
              </ebiz:EbizCustomField>
           </ebiz:SubCustomerCustomFields>
           <ebiz:SubCustomerLastSyncDateTime/>
           <ebiz:DivisionId/>
           <ebiz:DateTimeCreated/>
           <ebiz:DateTimeModified/>
         </ebiz:subcustomer>
      </ebiz:AddSubCustomer>
   </soapenv:Body>
</soapenv:Envelope>
public void AddSubCustomer()
{
    eBizService apiClient = new eBizService();
    SecurityToken securityToken = new SecurityToken
    {
      SecurityId = "*******-c870-41b8-aa5c-205e55b7a049",
      UserId = "",
      Password = ""
      };
    SubCustomer customer = new SubCustomer();
    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";
    SubCustomerResponse response = apiClient.AddSubCustomer(securityToken, customer);
    Console.WriteLine(response.SubCustomerInternalId);
    Console.WriteLine(response.Status);
    Console.WriteLine(response.StatusCode);
    Console.WriteLine(response.Error);
    Console.WriteLine(response.ErrorCode);
    Console.ReadLine();
}
public function AddSubCustomer()
{
    $client = new SoapClient('End point URL');
      $securityToken = array(
          'SecurityId' => '******-454757-4567457-777',
          'UserId' => 'merchant1',
          'Password' => 'merchant1'
      );

    $response = $client->AddSubCustomer(
      array(
        'securityToken' => $securityToken,
        'subcustomer' => array(
          'CustomerId' => '123',
          'CustomerInternalId' => '123-343-343-43',
          'SubCustomerId' => '1233',
          'FirstName' => 'Frank',
          'LastName' => 'Jones',
          'CompanyName' => 'CBS',
          'Phone' => 10000000,
          'CellPhone' => 10000000,
          'Fax' => 10000000,
          'Email' => '[email protected]',
          'WebSite' => '',
          'BillingAddress' => array(),
          'ShippingAddress' => array(),
          'DateTimeCreated' => date('Y-m-d H:i:s'),
          'DateTimeModified' => date('Y-m-d H:i:s'),
        )
      )
    );

    $result = $response->AddSubCustomerResult;
}

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">
      <AddSubCustomerResponse xmlns="http://eBizCharge.ServiceModel.SOAP">
         <AddSubCustomerResult>
            <CustomerId>mm-0011-03</CustomerId>
            <SubCustomerInternalId>********-dafe-4529-94f6-7fd458af6958</SubCustomerInternalId>
            <Status>Success</Status>
            <StatusCode>1</StatusCode>
            <Error/>
            <ErrorCode>0</ErrorCode>
         </AddSubCustomerResult>
      </AddSubCustomerResponse>
   </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">
      <AddSubCustomerResponse xmlns="http://eBizCharge.ServiceModel.SOAP">
         <AddSubCustomerResult>
            <CustomerId/>
            <SubCustomerInternalId/>
            <Status>Failed</Status>
            <StatusCode>0</StatusCode>
            <Error>Record already exists</Error>
            <ErrorCode>2</ErrorCode>
         </AddSubCustomerResult>
      </AddSubCustomerResponse>
   </s:Body>
</s:Envelope>