developer:soap-1.1:methods:addcustomer

addCustomer

This method adds a customer to your stored customer database so that their information can be recalled at a later date.

Description

The customer will be assigned a unique customer number by the gateway (CustNum), which you can then use to establish recurring billing cycles, recall customer data, and manually charge the customer for later products or services without needing to reenter their information.

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

Syntax

integer addCustomer ( ueSecurityToken Token, CustomerObject CustomerData )

Arguments

Type Name Description
ueSecurityToken Token Merchant security token: used to identify merchant and validate transaction.
CustomerObject CustomerData Includes customer information such as customer number, merchant assigned customer ID, billing address, receipt settings, recurring billing settings, and other pertinent information.

Return Value

integer Returns result of add customer request.

Examples

PHP

For directions on how to set up the WSDL link, create “$token” and “$client”, go to PHP Soap How-to.

<?php 
 
try { 
 
$CustomerData=array(
	'BillingAddress'=>array(
		'FirstName'=>'John',
		'LastName'=>'Doe',
		'Company'=>'Acme Corp',
		'Street'=>'1234 main st',
		'Street2'=>'Suite #123',
		'City'=>'Los Angeles',
		'State'=>'CA',
		'Zip'=>'12345',
		'Country'=>'US',
		'Email'=>'example@usaepay.com',
		'Phone'=>'333-333-3333',
		'Fax'=>'333-333-3334'),
	'PaymentMethods' => array(
		array(
			'CreditCardData' => array(
					'CardNumber'=>'4444555566667779',
					'CardExpiration'=>'0213',
					'CardType'=>'', 'CardCode'=>'','AvsStreet'=>'',
					'AvsZip'=>'', 'CardPresent'=>'','MagStripe'=>'',
					'TermType'=>'','MagSupport'=>'','XID'=>'', 'CAVV'=>'',
					'ECI'=>'','InternalCardAuth'=>'', 'Pares'=>''
				), 
				"Expires"=>"2010-4-1",
				"MethodName"=>"My Visa",
				"SecondarySort"=>1
			)
		),
		'CustomData'=>base64_encode(serialize(array("mydata"=>"We could put anything in here!"))),
		'CustomFields'=>array(
			array('Field'=>'Foo', 'Value'=>'Testing'),
			array('Field'=>'Bar', 'Value'=>'Tested')
		),
	'CustomerID'=>123123 + rand(),
	'Description'=>'Weekly Bill',
	'Enabled'=>false,
	'Amount'=>'44.93',
	'Tax'=>'0',
	'Next'=>'2012-01-21',
	'Notes'=>'Testing the soap addCustomer Function',
	'NumLeft'=>'50',
	'OrderID'=>rand(),
	'ReceiptNote'=>'addCustomer test Created Charge',
	'Schedule'=>'weekly',
	'SendReceipt'=>true,
	'Source'=>'Recurring',
	'User'=>'',
	'CustNum'=>'C'.rand()
);
 
  $res=$client->addCustomer($token,$CustomerData); 
 
 
} 
 
catch(SoapFault $e) { 
 
  echo "SoapFault: " .$e->getMessage(); print_r($e); 
  echo "\n\nRequest: " . $tran->__getLastRequest(); 
  echo "\n\nResponse: " . $tran->__getLastResponse(); 
} 
 
?> 

.NET VB

Dim customer As usaepay.CustomerObject = New usaepay.CustomerObject
        Dim address As usaepay.Address = New usaepay.Address
        address.FirstName = "John"
        address.LastName = "Doe"
        address.Company = "Acme"
        address.Street = "123 main st."
        address.City = "Hollywood"
        address.State = "ca"
        address.Zip = "91607"
        address.Country = "USA"
        customer.BillingAddress = address
 
        customer.Enabled = True
        customer.Amount = 5.0
        customer.Next = "2010-08-15"
        customer.Schedule = "monthly"
 
        Dim payMethod(0) As usaepay.PaymentMethod
        payMethod(0) = New usaepay.PaymentMethod
        payMethod(0).CreditCardData = New usaepay.CreditCardData
        payMethod(0).CreditCardData.CardExpiration = "1212"
        payMethod(0).CreditCardData.CardNumber = "4444555566667779"
        payMethod(0).CreditCardData.AvsStreet = "123 Main st."
        payMethod(0).CreditCardData.AvsZip = "90046"
        payMethod(0).MethodName = "My Visa"
 
        customer.PaymentMethods = payMethod
        Dim response As String
 
        response = client.addCustomer(token, customer)
        MsgBox(String.Concat(response))

.NET C#

usaepay.CustomerObject customer = new usaepay.CustomerObject();
            usaepay.Address address = new usaepay.Address();
            address.FirstName = "John";
            address.LastName = "Doe";
            address.Company = "Acme";
            address.Street = "123 main st.";
            address.City = "Hollywood";
            address.State = "ca";
            address.Zip = "91607";
            address.Country = "USA";
            customer.BillingAddress = address;
 
            customer.Enabled = true;
            customer.Amount = 5.00;
            customer.Next = "2010-08-15";
            customer.Schedule = "monthly";
 
            usaepay.PaymentMethod[] payMethod = new usaepay.PaymentMethod[1];
            payMethod[0] = new usaepay.PaymentMethod();
            payMethod[0].CreditCardData = new usaepay.CreditCardData();
            payMethod[0].CreditCardData.CardExpiration = "1212";
            payMethod[0].CreditCardData.CardNumber = "4444555566667779";
            payMethod[0].CreditCardData.AvsStreet = "123 Main st.";
            payMethod[0].CreditCardData.AvsZip = "90046";
            payMethod[0].MethodName = "My Visa";
 
            customer.PaymentMethods = payMethod;
 
 
            string response;
 
            try
            {
                response = client.addCustomer(token, customer);
                MessageBox.Show(string.Concat(response));
            }
 
            catch (Exception err)
            {
                MessageBox.Show(err.Message);
            }
developer/soap-1.1/methods/addcustomer.txt · Last modified: 2017/01/30 10:29 by charlie

Page Tools