runCustomerTransaction
Run a transaction using payment data stored in the customer database.
Description
Processes a new transaction using the payment details stored for the customer. This is a one time charge and does not use or affect the recurring billing values, such as amount and description, that have been stored for the customer. The transaction result will be tied to the customer and will be visible in the customer's billing history. The customer does not need to have recurring billing enabled for this method to be used. If you do not have a cardholder listed as part of the payment method, the customer's first and last name in their customer profile will be used as the cardholder.
See also addCustomer, addCustomerPaymentMethod
Syntax
TransactionResponse runCustomerTransaction ( ueSecurityToken Token, string CustNum, string PaymentMethodID, CustomerTransactionRequest Parameters )
Arguments
Type | Name | Description |
---|---|---|
ueSecurityToken | Token | Merchant security token: used to identify merchant and validate transaction. |
string | CustNum | Customer Reference number assigned by the gateway |
string | PaymentMethodID | ID of payment method to use for transaction. Send 0 to use default method |
CustomerTransactionRequest | Parameters | Transaction amount, invoice number, etc. |
Return Value
Type | Description |
---|---|
TransactionResponse | Returns all applicable transaction results including transaction reference number, batch number, transaction result (approved, declined, error), result code, authorization code, AVS result, CVV2 result, Verified by Visa or SecureCode Mastercard results, and converted currency amount and rate. |
Examples
PHP
For directions on how to set up the WSDL link, create "$token" and "$client", go to PHP Soap How-to.
<?php
try {
$Parameters=array(
'Command'=>'Sale',
'Details'=>array(
'Invoice' => rand(),
'PONum' => '',
'OrderID' => '',
'Description' => 'Sample Credit Card Sale',
'Amount'=>'1.50' )
);
$CustNum='123456';
$PayMethod='0';
$res=$client->runCustomerTransaction($token, $CustNum, $PayMethod, $Parameters);
print_r($res);
}
catch (SoapFault $e) {
echo $client->__getLastRequest();
echo $client->__getLastResponse();
die("runCustomerTransaction failed :" .$e->getMessage());
}
?>
.NET VB
Dim custnum As String
custnum = "103125"
Dim paymentMethodID As String
paymentMethodID = "39"
Dim tran As newtek.CustomerTransactionRequest = New newtek.CustomerTransactionRequest
tran.Details = New newtek.TransactionDetail
tran.Details.Invoice = "123456"
tran.Details.Description = "Sample Credit Card Sale"
tran.Details.Amount = 1.05
tran.Details.AmountSpecified = True
Dim response As newtek.TransactionResponse
response = New newtek.TransactionResponse
response = client.runCustomerTransaction(token, custnum, paymentMethodID, tran)
MessageBox.Show(String.Concat(response.Result))
.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 paymentMethodID = "19";
newtek.CustomerTransactionRequest tran = new newtek.CustomerTransactionRequest();
tran.Details = new newtek.TransactionDetail();
tran.Details.Invoice = "123456";
tran.Details.Description = "Sample Credit Card Sale";
tran.Details.Amount = 1.05;
tran.Details.AmountSpecified = true;
newtek.TransactionResponse response = new newtek.TransactionResponse();
try
{
response = client.runCustomerTransaction(token, custNum, paymentMethodID, tran);
MessageBox.Show(string.Concat(response.Result));
}
catch (Exception err)
{
MessageBox.Show(err.Message);
}
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:runCustomerTransaction>
<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">28294c0d68cd498353c6f6dad03e00a1ac8668e1</HashValue>
<Seed xsi:type="xsd:string">11688496410-test</Seed>
<Type xsi:type="xsd:string">sha1</Type>
</PinHash>
<SourceKey xsi:type="xsd:string">_B4P7C4K2w2ZCQQQXRqrxDj6agrS2NIT</SourceKey>
</Token>
<CustNum xsi:type="xsd:string">4600666</CustNum>
<PaymentMethodID xsi:type="xsd:string">0</PaymentMethodID>
<Parameters xsi:type="ns1:CustomerTransactionRequest">
<Command xsi:type="xsd:string">Sale</Command>
<Details xsi:type="ns1:TransactionDetail">
<Amount xsi:type="xsd:double">10.5</Amount>
<Description xsi:type="xsd:string">Sample Credit Card Sale</Description>
<Invoice xsi:type="xsd:string">327061455</Invoice>
<OrderID xsi:type="xsd:string"></OrderID>
<PONum xsi:type="xsd:string"></PONum>
</Details>
</Parameters>
</ns1:runCustomerTransaction>
</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:runCustomerTransactionResponse>
<runCustomerTransactionReturn xsi:type="ns1:TransactionResponse">
<AcsUrl xsi:type="xsd:string"></AcsUrl>
<AuthAmount xsi:type="xsd:double">10.5</AuthAmount>
<AuthCode xsi:type="xsd:string">144519</AuthCode>
<AvsResult xsi:type="xsd:string">Address: Match & 5 Digit Zip: Match</AvsResult>
<AvsResultCode xsi:type="xsd:string">YYY</AvsResultCode>
<BatchNum xsi:type="xsd:string">211</BatchNum>
<BatchRefNum xsi:type="xsd:string">198907</BatchRefNum>
<CardCodeResult xsi:type="xsd:string">Not Processed</CardCodeResult>
<CardCodeResultCode xsi:type="xsd:string">P</CardCodeResultCode>
<CardLevelResult xsi:nil="true" />
<CardLevelResultCode xsi:nil="true" />
<ConversionRate xsi:type="xsd:double">0</ConversionRate>
<ConvertedAmount xsi:type="xsd:double">0</ConvertedAmount>
<ConvertedAmountCurrency xsi:type="xsd:string">0</ConvertedAmountCurrency>
<CustNum xsi:type="xsd:string">4600666</CustNum>
<Error xsi:type="xsd:string">Approved</Error>
<ErrorCode xsi:type="xsd:integer">0</ErrorCode>
<isDuplicate xsi:type="xsd:boolean">false</isDuplicate>
<Payload xsi:type="xsd:string"></Payload>
<RefNum xsi:type="xsd:string">102506029</RefNum>
<Result xsi:type="xsd:string">Approved</Result>
<ResultCode xsi:type="xsd:string">A</ResultCode>
<Status xsi:type="xsd:string">Pending</Status>
<StatusCode xsi:type="xsd:string">P</StatusCode>
<VpasResultCode xsi:type="xsd:string"></VpasResultCode>
</runCustomerTransactionReturn>
</ns1:runCustomerTransactionResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Change Log
Version | Change |
---|---|
1.7 | Changed CustNum and PaymentMethodID to type string |