runTransactionAPI
This method provides a Soap based interface to the Transaction API.
Description
The parameters argument is an array containing any of the variable names supported by the Transaction API.
This method requires more work to implement than the runTransaction method, and typically should not be your first choice for processing transactions. The one benefit of using this method is that it provides a direct interface to the transaction processing engine of the gateway. As new fields are added to the system they can be used immediately via this method without having to wait for the next Soap release or generate a new WSDL link. The runTransaction method on the other hand has its TransactionRequestObject tied to the Soap release (and wsdl url). To access new fields you would have to generate a new WSDL link.
NOTE: In previous releases this method was called runOldApi.
See also: runTransaction
Syntax
TransactionResponse runTransactionAPI ( ueSecurityToken Token, FieldValue Parameters )
Arguments
Type | Name | Description |
---|---|---|
ueSecurityToken | Token | Merchant security token: used to identify merchant and validate transaction. |
FieldValue | Parameters | List of variables to pass to Transaction API. |
Return Value
| Name | Description |
| ---- | ---- | -----------
| TransactionResponse | Returns a TransactionResponse object containing the results of the transaction and all relevant data. |
Examples
PHP
For directions on how to set up the WSDL link, create "$token" and "$client," see the PHP SOAP How-to.
<?php
$Request=array(
array('Field'=>'UMname', 'Value'=>'Tester Jones'),
array('Field'=>'UMdescription', 'Value'=>'runTrasactionAPI sale'),
array('Field'=>'UMamount', 'Value'=>'3.51'),
array('Field'=>'UMinvoice', 'Value'=>'12345'),
array('Field'=>'UMcard', 'Value'=>'4444555566667779'),
array('Field'=>'UMexpir', 'Value'=>'0919'),
array('Field'=>'UMstreet', 'Value'=>'1234 Main Street'),
array('Field'=>'UMzip', 'Value'=>'99281'),
array('Field'=>'UMcvv2', 'Value'=>'444')
);
$res=$client->runTransactionAPI($token, $Request);
``` print_r($res);
### .NET VB
For directions on how to set up the WSDL link, create "token" and "client", go to [Visual Basic .Net Soap How-to](http://help.newtekgateway.com/developer/soap-api/howto/vb/).
```vb
Dim client As newtek.newtekService = New newtek.newtekService
Dim token As newtek.ueSecurityToken
token = Me.CreateToken("714SSUxv1uohng2XkMJ7kLpETsu58G66", "1234")
Dim Fields(0 To 9) As newtek.FieldValue
Dim i As Integer
For i = 0 To 9
Fields(i) = New newtek.FieldValue
Next i
Fields(0).Field = "UMname"
Fields(0).Value = "Tester Jones"
Fields(1).Field = "UMdescription"
Fields(1).Value = "Visual Basic For Dummies"
Fields(2).Field = "UMamount"
Fields(2).Value = "1.00"
Fields(3).Field = "UMinvoice"
Fields(3).Value = "12345"
Fields(4).Field = "UMcard"
Fields(4).Value = "4444555566667779"
Fields(5).Field = "UMexpir"
Fields(5).Value = "1219"
Fields(6).Field = "UMstreet"
Fields(6).Value = "1234 Main Street"
Fields(7).Field = "UMzip"
Fields(7).Value = "90210"
Fields(8).Field = "UMcvv2"
Fields(8).Value = "999"
Dim response As newtek.TransactionResponse
response = client.runTransactionAPI(token, Fields)
MsgBox("Reference Number: " & response.RefNum)
.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.
newtek.FieldValue[] tran = new newtek.FieldValue[9];
for (int i = 0; i < 9; i++)
{
tran[i] = new newtek.FieldValue();
}
tran[0].Field = "UMname"; tran[0].Value = "Tester Jones";
tran[1].Field = "UMdescription"; tran[1].Value = "runTransactionAPI sale";
tran[2].Field = "UMamount"; tran[2].Value = "1.00";
tran[3].Field = "UMinvoice"; tran[3].Value = "12345";
tran[4].Field = "UMcard"; tran[4].Value = "4444555566667779";
tran[5].Field = "UMexpir"; tran[5].Value = "1219";
tran[6].Field = "UMstreet"; tran[6].Value = "123 Main Street";
tran[7].Field = "UMzip"; tran[7].Value = "90046";
tran[8].Field = "UMcvv2"; tran[8].Value = "999";
newtek.TransactionResponse response = new newtek.TransactionResponse();
try
{
response = client.runTransactionAPI(token, tran);
if (response.ResultCode == "A")
{
MessageBox.Show(string.Concat("Transaction Approved, RefNum: ",
response.RefNum));
}
else
{
MessageBox.Show(string.Concat("Transaction Failed: ",
response.Error));
}
}
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:runTransactionAPI>
<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">439257fdca69c2b66565971fced3cc54ec5a6722</HashValue>
<Seed xsi:type="xsd:string">112970899-test</Seed>
<Type xsi:type="xsd:string">sha1</Type>
</PinHash>
<SourceKey xsi:type="xsd:string">_B4P7C4K2w2ZCQQQXRqrxDj6agrS2NIT</SourceKey>
</Token>
<Parameters SOAP-ENC:arrayType="ns1:FieldValue[9]" xsi:type="ns1:FieldValueArray">
<item xsi:type="ns1:FieldValue">
<Field xsi:type="xsd:string">UMname</Field>
<Value xsi:type="xsd:string">Tester Jones</Value>
</item>
<item xsi:type="ns1:FieldValue">
<Field xsi:type="xsd:string">UMdescription</Field>
<Value xsi:type="xsd:string">runTrasactionAPI sale</Value>
</item>
<item xsi:type="ns1:FieldValue">
<Field xsi:type="xsd:string">UMamount</Field>
<Value xsi:type="xsd:string">3.51</Value>
</item>
<item xsi:type="ns1:FieldValue">
<Field xsi:type="xsd:string">UMinvoice</Field>
<Value xsi:type="xsd:string">12345</Value>
</item>
<item xsi:type="ns1:FieldValue">
<Field xsi:type="xsd:string">UMcard</Field>
<Value xsi:type="xsd:string">4444555566667779</Value>
</item>
<item xsi:type="ns1:FieldValue">
<Field xsi:type="xsd:string">UMexpir</Field>
<Value xsi:type="xsd:string">0919</Value>
</item>
<item xsi:type="ns1:FieldValue">
<Field xsi:type="xsd:string">UMstreet</Field>
<Value xsi:type="xsd:string">1234 Main Street</Value>
</item>
<item xsi:type="ns1:FieldValue">
<Field xsi:type="xsd:string">UMzip</Field>
<Value xsi:type="xsd:string">99281</Value>
</item>
<item xsi:type="ns1:FieldValue">
<Field xsi:type="xsd:string">UMcvv2</Field>
<Value xsi:type="xsd:string">444</Value>
</item>
</Parameters>
</ns1:runTransactionAPI>
</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:runTransactionAPIResponse>
<runTransactionAPIReturn xsi:type="ns1:TransactionResponse">
<AcsUrl xsi:type="xsd:string"></AcsUrl>
<AuthAmount xsi:type="xsd:double">3.51</AuthAmount>
<AuthCode xsi:type="xsd:string">037497</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">1</BatchNum>
<BatchRefNum xsi:type="xsd:string">9597</BatchRefNum>
<CardCodeResult xsi:type="xsd:string">No Match</CardCodeResult>
<CardCodeResultCode xsi:type="xsd:string">N</CardCodeResultCode>
<CardLevelResult xsi:type="xsd:string">Visa Traditional</CardLevelResult>
<CardLevelResultCode xsi:type="xsd:string">A</CardLevelResultCode>
<ConversionRate xsi:type="xsd:double">0</ConversionRate>
<ConvertedAmount xsi:type="xsd:double">0</ConvertedAmount>
<ConvertedAmountCurrency xsi:type="xsd:string">840</ConvertedAmountCurrency>
<CustNum xsi:type="xsd:string">0</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">100106558</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>
</runTransactionAPIReturn>
</ns1:runTransactionAPIResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>