getCustomerPaymentMethods
Retrieve the customer payment methods for a given CustNum.
Description
This method allows you to retrieve all of the payment methods stored 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.
See also getCustomer
Syntax
PaymentMethod getCustomerPaymentMethods ( 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
Name | Description |
---|---|
PaymentMethod | Returns Array of PaymentMethod objects. |
Examples
PHP
// for directions on how to set up the
// WSDL link and create "$token" and "$client,"
// see: http://newtekgateway.com/developer/howto/php.
try {
$custnum='532';
$paymethods = $client->getCustomerPaymentMethods($token,$custnum);
print_r($paymethods);
echo "Found " . count($paymethods) . " payment methods: \n";
foreach($paymethods as $paymethod)
{
echo $paymethod->MethodName . "\n";
}
} catch(SoapFault $e) {
echo $e->getMessage();
echo "\n\nRequest: " . $tran->__getLastRequest();
echo "\n\nResponse: " . $tran->__getLastResponse();
}
.NET VB
Dim CustNum As String
CustNum = "103125"
Dim Method() As newtek.PaymentMethod
Method = client.getCustomerPaymentMethods(token, CustNum)
MsgBox(Method.Length)
.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";
try
{
newtek.PaymentMethod[] Method = client.getCustomerPaymentMethods(token, CustNum);
MessageBox.Show(string.Concat(Method.Length));
}
catch (Exception err)
{
MessageBox.Show(err.Message);
}
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 payment methods from.
BigInteger custnum = new BigInteger;
PaymentMethodArray PaymentMethods = new PaymentMethodArray();
PaymentMethods = client.getCustomerPaymentMethods(token, custnum);
} catch (Exception e) {
System.out.println("Soap Exception: " + e.getMessage());
}
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:getCustomerPaymentMethods>
<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">74a3b26c0c2942e4178264ea865fa01e052b687f</HashValue>
<Seed xsi:type="xsd:string">1630163526-test</Seed>
<Type xsi:type="xsd:string">sha1</Type>
</PinHash>
<SourceKey xsi:type="xsd:string">_B4P7C4K2w2ZCQQQXRqrxDj6agrS2NIT</SourceKey>
</Token>
<CustNum xsi:type="xsd:string">4610401</CustNum>
</ns1:getCustomerPaymentMethods>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Response:
<?xml version="1.0" encoding="utf-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ns1="urn:newtek"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<ns1:getCustomerPaymentMethodsResponse>
<getCustomerPaymentMethodsReturn SOAP-ENC:arrayType="ns1:PaymentMethod[2]"
xsi:type="ns1:PaymentMethodArray">
<item xsi:type="ns1:PaymentMethod">
<MethodType xsi:type="xsd:string">cc</MethodType>
<MethodID xsi:type="xsd:string">184</MethodID>
<MethodName xsi:type="xsd:string">CreditCard</MethodName>
<SecondarySort xsi:type="xsd:integer">8</SecondarySort>
<Created xsi:type="xsd:dateTime">2015-12-09T14:10:28+08:00</Created>
<Modified xsi:type="xsd:dateTime">2015-12-09T14:10:28+08:00</Modified>
<AvsStreet xsi:type="xsd:string">1818 Beverly St</AvsStreet>
<AvsZip xsi:type="xsd:string">90057</AvsZip>
<CardExpiration xsi:type="xsd:string">2019-09</CardExpiration>
<CardNumber xsi:type="xsd:string">XXXXXXXXXXXX2224</CardNumber>
<CardType xsi:type="xsd:string">V</CardType>
</item>
<item xsi:type="ns1:PaymentMethod">
<MethodType xsi:type="xsd:string">cc</MethodType>
<MethodID xsi:type="xsd:string">181</MethodID>
<MethodName xsi:type="xsd:string">CreditCard</MethodName>
<SecondarySort xsi:type="xsd:integer">9</SecondarySort>
<Created xsi:type="xsd:dateTime">2015-12-09T14:10:28+08:00</Created>
<Modified xsi:type="xsd:dateTime">2015-12-09T14:10:28+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>
</getCustomerPaymentMethodsReturn>
</ns1:getCustomerPaymentMethodsResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Change History
Version | Change |
---|---|
1.7 | Changed CustNum and PaymentMethodID to type string |
1.2 | The getPaymentMethods method was added in release 1.2 |