This object contains all relevant customer data including the CustNum (a unique customer number assigned by the gateway), CustID (a merchant assigned customer ID), as well as customer name, address, recurring billing status and schedule, and any other relevant data.
<?php
// for directions on how to set up the
// WSDL link and create "$token" and "$client,"
// see: http://wiki.usaepay.com/developer/soap/howto/php
$CustomerObject=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'=>'support@usaepay.com',
'Phone'=>'333-333-3333',
'Fax'=>'333-333-3334'
),
'PaymentMethods' =>
array(
array(
'CreditCardData' =>
array(
'CardNumber'=>'4444555566667779',
'CardExpiration'=>'0908',
'CardType'=>'',
'CardCode'=>'',
'AvsStreet'=>'',
'AvsZip'=>'',
'CardPresent'=>'',
'MagStripe'=>'',
'TermType'=>'',
'MagSupport'=>'',
'XID'=>'',
'CAVV'=>'',
'ECI'=>'',
'InternalCardAuth'=>'',
'Pares'=>''
),
"Expires"=>"",
"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',
'CustNum'=>'C'.rand()
);
$CustomerNumber=$this->client->addCustomer($this->token,$CustomerObject);
$CustomerObject= $this->client->getCustomer($this->token, $CustomerNumber);
echo $CustomerObject->CustNum;
?>