API Capture

Capturing a transaction updates an approved authorization to a pending settlement status that will initiate a transfer of funds. Processing a capture through the PayTrace API may only be accomplished by providing the transaction ID of the unsettled transaction that should be settled.

Capture Transaction Request

Required Name Value Pairs


Optional Name Value Pairs for Capture Request

The only optional name value pair when capturing a transaction is AMOUNT which must be less than or equal to the original authorization amount.

Sample of Capture Transaction Request

‘format the request string to capture transaction ID 1539 for settlement
strRequest = “UN~demo123|PSWD~demo123|TERMS~Y|METHOD~ProcessTranx|”
strRequest = strRequest & “TRANXTYPE~Capture|TRANXID~1539|”

strResponse = SendPayTraceAPIRequest(strRequest) ‘defined in Referencing the API Page

Request Response

Returned Name Value Pairs


Example of Parsing a Capture Response

‘declare tools to loop through the response and store the current name / value pair
Dim arrResponse() as String
Dim arrPair() as String
Dim Counter as Integer

‘declare the tools to store the values of the appropriate responses
Dim strError As String
Dim strResponseMessage As String
Dim strTransactionID As String

‘check to make sure the response was not empty/invalid
if strResponse <> “” and inStr(strResponse,”|”) > 0 and inStr(strResponse,”~”) > 0 then
    arrResponse = split(strResponse, “|”) ‘split the response into an array of name/value pairs

    for Counter = 0 to uBound(arrResponse)-1
        arrPair = split(arrResponse(Counter), “~”)
        If UCase(arrPair(0)) = "ERROR" Then
            StrError = strError & arrPair(1)
        ElseIf UCase(arrPair(0)) = "RESPONSE" Then
            strResponseMessage = arrPair(1)
        ElseIf UCase(arrPair(0)) = "TRANSACTIONID" Then
            strTransactionID = arrPair(1)
        End If 
    StrError = StrError  & “The response from the PayTrace API was invalid."
End if 

If StrError <> “” then
    MsgBox “Transaction was not successful per the following error: ” & StrError
    MsgBox “Transaction was successful: ” & strResponseMessage    
End if