developer:soap-1.4:methods:capturetransaction

Soap API v1.4

captureTransaction

Capture a queued transaction.

Description

Move an authorized transaction into the current batch for settlement. It is possible to capture an amount other than the one originally authorized, however, you must follow the guidelines established by the merchant service bank. Capturing a higher or lower dollar amount could result in additional penalties and fees.

Most banks typically allow no more than 10 days to pass between the authorization/capture and settlement of a transaction.

If you do not wish to capture a previously authorized transaction, you may void the original authorization rather than capturing a 0 dollar amount, or simply allow the captured transaction to time out.

See also runTransaction, runQuickSale, voidTransaction, runCredit, runSale, runAuthOnly, getTransactionStatus

Syntax

TransactionResponse captureTransaction ( ueSecurityToken Token, integer RefNum, Amount )

Arguments

Type Name Description
ueSecurityToken Token Merchant security token: used to identify merchant and validate transaction.
integer RefNum Unique transaction reference number assigned by the gateway.
double Amount Capture Amount if different from authorization

Return Value

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 SOAP PHP How-to.

<?php 
 
try { 
 
//Initial Authorization
  $Request=array( 
    'AccountHolder' => 'Tester Jones', 
    'Command' => 'authonly', 
    'Details' => array( 
      'Description' => 'Example Transaction', 
      'Amount' => '4.00', 
      'Invoice' => '44539' 
      ), 
    'CreditCardData' => array( 
      'CardNumber' => '4444555566667779', 
      'CardExpiration' => '0909', 
      'AvsStreet' => '1234 Main Street', 
      'AvsZip' => '99281', 
      'CardCode' => '999' 
      ) 
    ); 
 
  $amount='4.00'; 
 
  $temp=$client->runTransaction($token, $Request); 
 
//Capturing the authorization
  $res=$client->captureTransaction($token,$temp->RefNum,$amount );  
 
} 
 
catch (SoapFault $e) { 
  echo $client->__getLastRequest(); 
  echo $client->__getLastResponse(); 
  die("Capture Transaction failed :" .$e->getMessage()); 
  } 
?> 

VB

For directions on how to set up the WSDL link and create the “token” and “client” variables, go to the Visual Basic .Net Soap How-to.

        Dim client As usaepay.usaepayService = New usaepay.usaepayService
        Dim token As usaepay.ueSecurityToken
 
        token = Me.CreateToken("714SSUxv1uohng2XkMJ7kLpETsu58G66", "1234")
 
        Dim transaction As usaepay.TransactionRequestObject = New usaepay.TransactionRequestObject
        transaction.Details = New usaepay.TransactionDetail
        transaction.Details.Amount = "11.11"
        transaction.Details.AmountSpecified = "true"
        transaction.Details.Invoice = "123456"
 
        transaction.AuthCode = "009915"
        transaction.RefNum = "46993455"
 
        Dim response As usaepay.TransactionResponse = New usaepay.TransactionResponse
 
        response = client.captureTransaction(token, transaction.RefNum, transaction.Details.Amount)
 
        If response.ResultCode = "A" Then
            MsgBox("Transaction Approved, Refnum: " & response.RefNum)
        Else
            MsgBox("Transaction Error, Reason: " & response.Error)
        End If

.NET C#

usaepay.TransactionRequestObject tran = new usaepay.TransactionRequestObject();
 
            tran.Details = new usaepay.TransactionDetail();
            tran.Details.Amount = 1.00;
            tran.Details.AmountSpecified = true;
            tran.Details.Invoice = "123456";
 
            tran.RefNum = "47001545"; 
 
            usaepay.TransactionResponse response = new usaepay.TransactionResponse();
 
            try
            {
                response = client.captureTransaction(token, tran.RefNum, tran.Details.Amount);
 
                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

<?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:captureTransaction>
<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">11ac55b0a0b59f8f028dbf85bc32266fa973dd0e</HashValue>
<Seed xsi:type="xsd:string">12678150211876663375</Seed>
<Type xsi:type="xsd:string">sha1</Type>
</PinHash>
<SourceKey xsi:type="xsd:string">HB4P7C4K2w2ZCQQQXRqrxDj6agrS2NIT</SourceKey>
</Token>
<RefNum xsi:type="xsd:integer">177635768</RefNum>
<Amount xsi:type="xsd:double">45.99</Amount>
</ns1:captureTransaction>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Java

This example uses the USAePay Java library. For directions on how to install the library and create the token/client objects, go to either the Java JAX-RPC Howto or the Java JAX-WS Howto.

try {
 
//Setting RefNum from the original transaction			
BigInteger RefNum = new BigInteger('12345678');
 
//Setting Amount to capture
Double Amount = new Double(12.34);
 
//Create Transaction Response
TransactionResponse Response;
 
Response = client.captureTransaction(token,RefNum,Amount);
 
} catch (Exception e) {
	System.out.println("Soap Exception: " + e.getMessage());
}

Change History

Version Change
1.1 Method added prior to soap-1.1
developer/soap-1.4/methods/capturetransaction.txt · Last modified: 2010/08/30 16:43 by epouchak

Page Tools