getCustomer
Retrieve the customer details for a given CustNum.
Description
This method allows you to view all of the stored data for a particular customer.
This method requires the use of the CustNum, a unique customer number assigned by the gateway. If you have lost or cannot remember the customer's CustNum, use the searchCustomers method to find the correct CustNum.
Customer details include CustNum (the gateway assigned customer number), CustID (merchant assigned customer ID), billing address, receipt settings, recurring billing settings, and other pertinent information.
See also runCustomerTransaction, enableCustomer, disableCustomer, deleteCustomer, searchCustomerID, searchCustomers, getCustomerHistory, addCustomer, addCustomerPaymentMethod, deleteCustomerPaymentMethod, updateCustomer, quickUpdateCustomer
Syntax
CustomerObject getCustomer ( ueSecurityToken Token, string CustNum )
Arguments
Type | Name | Description |
---|---|---|
ueSecurityToken | Token | Merchant security token: used to identify merchant and validate transaction. |
string | CustNum | Unique customer ID number assigned by the gateway. |
Return Value
Type | Description |
---|---|
CustomerObject | Returns customer information such as customer number, merchant assigned customer ID, billing address, receipt settings, recurring billing settings, and other pertinent information |
Examples
PHP
For directions on how to set up the WSDL link, create "$token" and "$client", go to PHP Soap How-to.
try {
$custnum='532';
print_r($client->getCustomer($token,$custnum));
}
catch(SoapFault $e) {
echo $e->getMessage();
echo "\n\nRequest: " . $client->__getLastRequest();
echo "\n\nResponse: " . $client->__getLastResponse();
}
Java
This example uses the Newtek Gateway Java library. For directions on how to install the library and create the token/client objects, go to the Java JAX-WS Howto.
try {
//Set custnum to the Customer Number of customer you want to retrieve.
BigInteger custnum = new BigInteger("12345678");
CustomerObject customer = new CustomerObject();
customer = client.getCustomer(token, custnum);
} catch (Exception e) {
System.out.println("Soap Exception: " + e.getMessage());
}
.NET VB
Dim custNum As String
custNum = "103125"
Dim customer As newtek.CustomerObject
customer = New newtek.CustomerObject()
customer = client.getCustomer(token, custNum)
MsgBox(customer.CustomerID)
.NET C
For directions on how to set up the WSDL link and create the "token" and "client" variables, go to the C Sharp .Net Soap How-to.
string custNum = "89147";
string response;
newtek.CustomerObject customer = new newtek.CustomerObject();
try
{
customer = client.getCustomer(token, custNum);
MessageBox.Show(string.Concat("CustNum: ", customer.CustomerID));
}
catch (Exception err)
{
MessageBox.Show(err.Message);
}
```
## XML
Request:
```xml
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ns1="urn:newtek"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<ns1:getCustomer>
<Token xsi:type="ns1:ueSecurityToken">
<ClientIP xsi:type="xsd:string">123.123.123.123</ClientIP>
<PinHash xsi:type="ns1:ueHash">
<HashValue xsi:type="xsd:string">0a8ac70263392c59f63476aa13a97cc7e8672a5d</HashValue>
<Seed xsi:type="xsd:string">1176474488-test</Seed>
<Type xsi:type="xsd:string">sha1</Type>
</PinHash>
<SourceKey xsi:type="xsd:string">_B4P7C4K2w2ZCQQQXRqrxDj6agrS2NIT</SourceKey>
</Token>
<CustNum xsi:type="xsd:string">4606615</CustNum>
</ns1:getCustomer>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Reponse:
<?xml version="1.0" encoding="utf-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ns1="urn:newtek"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
<SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<ns1:getCustomerResponse>
<getCustomerReturn xsi:type="ns1:CustomerObject">
<Amount xsi:type="xsd:double">44.93</Amount>
<BillingAddress xsi:type="ns1:Address">
<City xsi:type="xsd:string">Los Angeles</City>
<Company xsi:type="xsd:string">Acme Corp</Company>
<Country xsi:type="xsd:string">US</Country>
<Email xsi:type="xsd:string">joe@example.com</Email>
<Fax xsi:type="xsd:string">333-333-3334</Fax>
<FirstName xsi:type="xsd:string">John</FirstName>
<LastName xsi:type="xsd:string">Doe</LastName>
<Phone xsi:type="xsd:string">333-333-3333</Phone>
<State xsi:type="xsd:string">CA</State>
<Street xsi:type="xsd:string">1234 main st</Street>
<Street2 xsi:type="xsd:string">Suite #123</Street2>
<Zip xsi:type="xsd:string">12345</Zip>
</BillingAddress>
<Created xsi:type="xsd:dateTime">2015-12-07T15:45:32+08:00</Created>
<Currency xsi:type="xsd:string">0</Currency>
<CustNum xsi:type="xsd:string">4606615</CustNum>
<CustomData xsi:type="xsd:string"></CustomData>
<CustomFields SOAP-ENC:arrayType="ns1:FieldValue[0]"
xsi:type="ns1:FieldValueArray" />
<CustomerID xsi:type="xsd:string">711099247</CustomerID>
<Description xsi:type="xsd:string">Weekly Bill</Description>
<Enabled xsi:type="xsd:boolean">true</Enabled>
<Failures xsi:type="xsd:int">0</Failures>
<LookupCode xsi:type="xsd:string"></LookupCode>
<Modified xsi:type="xsd:dateTime">2015-12-07T15:45:32+08:00</Modified>
<Next xsi:type="xsd:string">2016-12-01T12:00:00</Next>
<Notes xsi:type="xsd:string">Testing the soap addCustomer Function</Notes>
<NumLeft xsi:type="xsd:integer">50</NumLeft>
<OrderID xsi:type="xsd:string">2073065117</OrderID>
<PaymentMethods SOAP-ENC:arrayType="ns1:PaymentMethod[1]"
xsi:type="ns1:PaymentMethodArray">
<item xsi:type="ns1:PaymentMethod">
<MethodType xsi:type="xsd:string">cc</MethodType>
<MethodID xsi:type="xsd:string">112</MethodID>
<MethodName xsi:type="xsd:string">CreditCard</MethodName>
<SecondarySort xsi:type="xsd:integer">8</SecondarySort>
<Created xsi:type="xsd:dateTime">2015-12-07T15:45:32+08:00</Created>
<Modified xsi:type="xsd:dateTime">2015-12-07T15:45:32+08:00</Modified>
<CardExpiration xsi:type="xsd:string">2018-12</CardExpiration>
<CardNumber xsi:type="xsd:string">XXXXXXXXXXXX7779</CardNumber>
<CardType xsi:type="xsd:string">V</CardType>
</item>
</PaymentMethods>
<PriceTier xsi:type="xsd:string"></PriceTier>
<ReceiptNote xsi:type="xsd:string">addCustomertestCreatedCharge</ReceiptNote>
<Schedule xsi:type="xsd:string">Weekly</Schedule>
<SendReceipt xsi:type="xsd:boolean">true</SendReceipt>
<Source xsi:type="xsd:string">Recurring</Source>
<Tax xsi:type="xsd:double">0</Tax>
<TaxClass xsi:type="xsd:string"></TaxClass>
<User xsi:type="xsd:string">(Auto)</User>
<URL xsi:type="xsd:string"></URL>
</getCustomerReturn>
</ns1:getCustomerResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Change Log
Version | Change |
---|---|
1.7 | Changed CustNum to type string |