developer:soap-1.2:methods:runtransaction

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

developer:soap-1.2:methods:runtransaction [2010/02/12 09:40] (current)
tem created
Line 1: Line 1:
 +<embed ..:​contents/>​
  
 +====== runTransaction ======
 +
 +Runs a transaction using the Transaction API.
 +
 +===== Description =====
 +
 +This method duplicates the functionality of the gateway API. It can be used to run a wide variety of transaction types including sales, credits, authonly, void, and checks.
 +
 +The parameters argument is a TransactionRequestObject containing any of the variable names supported by the Transaction API (See the docs for a list of valid field names). Make sure to remove the UM from the front of the field names. (ie: UMamount should be passed as Amount.)
 +
 +See also [[runSale]],​ [[runCredit]], ​
 +[[runAuthOnly]],​ [[runQuickSale]],​ [[postAuth]],​ [[captureTransaction]],​ [[voidTransaction]],​ [[getTransactionStatus]],​ [[getTransaction]],​ [[getTransactionCustom]],​ [[searchTransactions]],​ [[searchTransactionsCustom]],​ [[getTransactionReport]]
 +
 +===== Syntax =====
 +
 +
 +[[..:​objects:​TransactionResponse|TransactionResponse]] **runTransaction** ( [[..:​objects:​ueSecurityToken|ueSecurityToken]] Token, [[..:​objects:​TransactionRequestObject|TransactionRequestObject]] Parameters )
 +
 +
 +
 +
 +===== Arguments =====
 +
 +^Type   ​^Name ​  ​^Description ​  ^
 +| [[..:​objects:​ueSecurityToken]] | Token | Merchant security token: used to identify merchant and validate transaction. |
 +| [[..:​objects:​TransactionRequestObject]] | Parameters ​ | Request transaction details from all fields of the transaction form, including reference number, transaction amount, customer ID, currency, authorization code, and any other information entered at the time of the transaction. ​ |
 +
 +
 +
 +
 +===== Return Value =====
 +
 +
 +| [[..:​objects:​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",​ go to [[..:​howto:​php|PHP Soap How-to]].
 +
 +<code php>
 +<?php
 +
 +try {
 +    ​
 +  $Request=array(
 +    '​AccountHolder'​ => '​Tester Jones',​
 +    '​Details'​ => array(
 +      '​Description'​ => '​Example Transaction',​
 +      '​Amount'​ => '​4.00',​
 +      '​Invoice'​ => '​44539'​
 +    ),
 +    '​CreditCardData'​ => array(
 +      '​CardNumber'​ => '​4444555566667779',​
 +      '​CardExpiration'​ => '​0909',​
 +      '​AvsStreet'​ => '1234 Main Street',​
 +      '​AvsZip'​ => '​99281',​
 +      '​CardCode'​ => '​999'​
 +    )
 +  );
 +            ​
 +  $res=$client->​runTransaction($token,​ $Request);
 +    ​
 +  print_r($res);​
 +            ​
 +}
 +catch (SoapFault $e){
 +  echo $client->​__getLastRequest();​
 +  echo $client->​__getLastResponse();​
 +  die("​runTransaction failed :" .$e->​getMessage());​
 +}            ​
 +
 +
 +</​code>​
 +
 +==== Java ====
 +
 +This example uses the [[developer/​javalibrary|USAePay Java library]]. ​ For directions on how to install the library and create the token/​client objects, go to either the [[..:​howto:​javajaxrpc|Java JAX-RPC Howto]] or the [[..:​howto:​javajaxws|Java JAX-WS Howto]].
 +
 +<code java>
 +try {
 +  TransactionRequestObject params = new TransactionRequestObject();​
 +
 +  // set card holder name
 +    params.setAccountHolder("​Test Joe");
 +    params.setCommand("​Sale"​);​
 +
 +  // populate transaction details
 +  TransactionDetail details = new TransactionDetail();​
 +      details.setAmount(22.34);​
 +      details.setDescription("​My Test Sale"​);​
 +      details.setInvoice("​119891"​);​
 +    params.setDetails(details);​
 +
 +  // populate credit card data
 +  CreditCardData ccdata = new CreditCardData();​
 +      ccdata.setCardNumber("​4444555566667779"​);​
 +      ccdata.setCardExpiration("​0912"​);​
 +      ccdata.setCardCode("​999"​);​
 +    params.setCreditCardData(ccdata);​
 +
 +
 +  // Create request object
 +  RunTransaction request = new RunTransaction();​
 +    request.setToken(token);​
 +
 +  // Create response object
 +  TransactionResponse response;
 +
 +  // run transaction
 +  response = client.runTransaction(token,​ params);
 +
 +  System.out.println("​Result:​ " + response.getResult());​
 +} catch (Exception e) {
 +    System.out.println("​Soap Exception: " + e.getMessage());​
 +}
 +</​code>​
 +
 +==== Visual Basic (.Net) ====
 +
 +For directions on how to set up the WSDL link, create "​token"​ and "​client",​ go to [[..:​howto:​vb|Visual Basic .Net Soap How-to]].
 +
 +<code vb>
 +Dim tran As usaepay.TransactionRequestObject = New usaepay.TransactionRequestObject
 +
 +tran.CreditCardData = New usaepay.CreditCardData
 +tran.CreditCardData.CardNumber = "​4444555566667779"​
 +tran.CreditCardData.CardExpiration = "​0913"​
 +tran.CreditCardData.CardCode = "​999"​
 +
 +tran.Details = New usaepay.TransactionDetail
 +tran.Details.Amount = 9.02
 +tran.Details.AmountSpecified = True
 +tran.Details.Invoice = "​434534"​
 +tran.Details.Description = "​Example transaction"​
 +
 +tran.Command = "​sale"​
 +
 +Dim response As usaepay.TransactionResponse
 +
 +response = client.runTransaction(token,​ tran)
 +
 +MsgBox("​Reference Number: " & response.RefNum)
 +</​code>​
 +
 +==== C Sharp (.Net) ====
 +For directions on how to set up the WSDL link, create "​token"​ and "​client",​ go to [[..:​howto:​csharp|C Sharp .Net Soap How-to]].
 +
 +<code c>
 +
 +usaepay.TransactionRequestObject tran = new usaepay.TransactionRequestObject();​
 +
 +tran.Command = "​cc:​sale";​
 +tran.Details =  new usaepay.TransactionDetail();​
 +tran.Details.Amount = 1.00;
 +tran.Details.AmountSpecified = true;
 +tran.Details.Invoice = "​1234";​
 +tran.Details.Description = "​Example Transaction";​
 +
 +tran.CreditCardData = new usaepay.CreditCardData();​
 +tran.CreditCardData.CardNumber = "​4444555566667779";​
 +tran.CreditCardData.CardExpiration = "​0909";​
 +
 +usaepay.TransactionResponse response = new usaepay.TransactionResponse();​
 +
 +try
 +{
 +    response = client.runTransaction(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);​
 +}
 +
 +</​code>​
 +
 +==== XML ====
 +
 +<code xml>
 +<?xml version="​1.0"​ encoding="​UTF-8"?>​
 +<​SOAP-ENV:​Envelope xmlns:​SOAP-ENV="​http://​schemas.xmlsoap.org/​soap/​envelope/" ​
 +xmlns:​ns1="​urn:​usaepay"​ 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:​runTransaction>​
 +<Token xsi:​type="​ns1:​ueSecurityToken">​
 +<​ClientIP xsi:​type="​xsd:​string">​192.168.0.1</​ClientIP>​
 +<PinHash xsi:​type="​ns1:​ueHash">​
 +<​HashValue xsi:​type="​xsd:​string">​00060c94636aa8903bedf1a34ad668775fdf8279</​HashValue>​
 +<Seed xsi:​type="​xsd:​string">​1193430959519300366</​Seed>​
 +<Type xsi:​type="​xsd:​string">​sha1</​Type>​
 +</​PinHash>​
 +<​SourceKey xsi:​type="​xsd:​string">​HB4P7C4K2w2ZCQQQXRqrxDj6agrS2NIT</​SourceKey>​
 +</​Token>​
 +<​Parameters xsi:​type="​ns1:​TransactionRequestObject">​
 +<​AccountHolder xsi:​type="​xsd:​string">​Tester Jones</​AccountHolder>​
 +<​CreditCardData xsi:​type="​ns1:​CreditCardData">​
 +<​AvsStreet xsi:​type="​xsd:​string">​1234 Main Street</​AvsStreet>​
 +<AvsZip xsi:​type="​xsd:​string">​99281</​AvsZip>​
 +<​CardCode xsi:​type="​xsd:​string">​999</​CardCode>​
 +<​CardExpiration xsi:​type="​xsd:​string">​0909</​CardExpiration>​
 +<​CardNumber xsi:​type="​xsd:​string">​4444555566667779</​CardNumber>​
 +</​CreditCardData>​
 +<Details xsi:​type="​ns1:​TransactionDetail">​
 +<Amount xsi:​type="​xsd:​double">​4</​Amount>​
 +<​Description xsi:​type="​xsd:​string">​Example Transaction</​Description>​
 +<Invoice xsi:​type="​xsd:​string">​44539</​Invoice>​
 +</​Details>​
 +</​Parameters>​
 +</​ns1:​runTransaction>​
 +</​SOAP-ENV:​Body>​
 +</​SOAP-ENV:​Envelope>​
 +</​code>​
developer/soap-1.2/methods/runtransaction.txt ยท Last modified: 2010/02/12 09:40 by tem

Page Tools