getCustomerPaymentMethod
Retrieve a specific customer payment method for a given CustNum.
Description
This method allows you to retrieve a specific payment method 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.
You must also specify the MethodID for the desired Payment Method. This MethodID is assigned by the gateway and returned by addCustomerPaymentMethod. You can also obtain the methodid from the MethodID property of the PaymentMethod object. This is returned by either getCustomer or getCustomerPaymentMethods.
See also getCustomer and getCustomerPaymentMethods
Syntax
PaymentMethod getCustomerPaymentMethod ( ueSecurityToken Token, string CustNum, string MethodID )
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. |
string | MethodID | Unique payment method ID assigned by the gateway. |
Return Value
Name | Description |
---|---|
PaymentMethod | Returns a PaymentMethod object |
Examples
PHP
For directions on how to set up the WSDL link, create "$token" and "$client" please see the SOAP PHP Howto.
try {
$custnum = '532';
$methodid = '1234';
$paymethod = $client->getCustomerPaymentMethod($token,$custnum,$methodid);
print_r($paymethod);
echo $paymethod->MethodName . "\n";
} catch(SoapFault $e) {
echo $e->getMessage();
echo "\n\nRequest: " . $client->__getLastRequest();
echo "\n\nResponse: " . $client->__getLastResponse();
}
.NET VB
Dim CustNum As String
CustNum = "103125"
Dim MethodID As String
MethodID = "39"
Dim Method As newtek.PaymentMethod = New newtek.PaymentMethod
Method = client.getCustomerPaymentMethod(token, CustNum, MethodID)
MsgBox(Method.Created)
.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 MethodID = "19";
newtek.PaymentMethod Method = new newtek.PaymentMethod();
try {
Method = client.getCustomerPaymentMethod(token, CustNum, MethodID);
MessageBox.Show(string.Concat(Method.Created));
}
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 a payment method from.
BigInteger custnum = new BigInteger("12345678");
//Set PayID to the Payment Method ID of the
//Payment Method you want to retrieve.
BigInteger PayID = new BigInteger("654321");
PaymentMethod PayMethod = new PaymentMethod();
PayMethod = client.getCustomerPaymentMethod(token, custnum, PayID);
} catch (Exception e) {
System.out.println("Soap Exception: " + e.getMessage());
}
XML
Request:
<?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:getCustomerPaymentMethod>
<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">cb0d69fef422f746976fa6eceef0cc2535fa6263</HashValue>
<Seed xsi:type="xsd:string">1753029979-test</Seed>
<Type xsi:type="xsd:string">sha1</Type>
</PinHash>
<SourceKey xsi:type="xsd:string">_B4P7C4K2w2ZCQQQXRqrxDj6agrS2NIT</SourceKey>
</Token>
<CustNum xsi:type="xsd:string">4608985</CustNum>
<MethodID xsi:type="xsd:string">178</MethodID>
</ns1:getCustomerPaymentMethod>
</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: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:getCustomerPaymentMethodResponse>
<getCustomerPaymentMethodReturn xsi:type="ns1:PaymentMethod">
<MethodType xsi:type="xsd:string">cc</MethodType>
<MethodID xsi:type="xsd:string">178</MethodID>
<MethodName xsi:type="xsd:string">CreditCard</MethodName>
<SecondarySort xsi:type="xsd:integer">8</SecondarySort>
<Created xsi:type="xsd:dateTime">2015-12-09T11:08:20+08:00</Created>
<Modified xsi:type="xsd:dateTime">2015-12-09T11:08:20+08:00</Modified>
<AvsStreet xsi:type="xsd:string">5454 Bravo St</AvsStreet>
<AvsZip xsi:type="xsd:string">91111</AvsZip>
<CardExpiration xsi:type="xsd:string">2018-12</CardExpiration>
<CardNumber xsi:type="xsd:string">XXXXXXXXXXXX7779</CardNumber>
<CardType xsi:type="xsd:string">V</CardType>
</getCustomerPaymentMethodReturn>
</ns1:getCustomerPaymentMethodResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Change History
Version | Change |
---|---|
1.7 | Changed CustNum and PaymentMethodID to type string |
1.2 | The getPaymentMethod method was added in release 1.2 |