API Export Single Batch

Verifying batch details is sometimes necessary for your application to be able to determine deposit and transaction sums. The ExportBatch method is useful for extracting a summary of a specific batch or currently pending settlement break-down by card and transaction type.

Export Batch Information Request

Required Name Value Pairs

UN, PSWD, TERMS, METHOD

Optional Name Value Pairs For Export Batch Information Request

BATCHNUMBER

Sample Export Batch Information Request

‘format the request string to create a export a batch of transactions
strRequest = "un~demo123|pswd~demo123|method~exportbatch|terms~Y|"

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

Request Response

Returned Name Value Pairs

Responses elicited from an ExportBatch request will always return either one or more error messages or a response. Successful responses will always include:

BATCHNUM, WHEN, VISASALESCOUNT, VISASALESAMOUNT, VISAREFUNDCOUNT, VISAREFUNDAMOUNT, MASTERCARDSALESCOUNT, MASTERCARDSALESAMOUNT, MASTERCARDREFUNDCOUNT, MASTERCARDREFUNDAMOUNT, AMEXSALESCOUNT, AMEXSALESAMOUNT, AMEXREFUNDCOUNT, AMEXREFUNDAMOUNT, DISCOVERSALESCOUNT, DISCOVERSALESAMOUNT, DISCOVERREFUNDCOUNT, DISCOVERREFUNDAMOUNT, DINERSSALESCOUNT, DINERSSALESAMOUNT, DINERSREFUNDCOUNT, DINERSREFUNDAMOUNT, JCBSALESCOUNT, JCBSALESAMOUNT, JCBREFUNDCOUNT, JCBREFUNDAMOUNT, PRIVATESALESCOUNT, PRIVATESALESAMOUNT, PRIVATEREFUNDCOUNT, PRIVATEREFUNDAMOUNT

Example of Parsing an Export Batch Information 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
‘declare other variables that you wish to catch such as BATCHNUM, WHEN, VISASALESCOUNT

‘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)) = " BATCHNUM" Then
            Msgbox “Batch Number: ” & arrPair(1)
        ElseIf UCase(arrPair(0)) = " WHEN" Then
            Msgbox “Date/Time: ” & arrPair(1)
        ElseIf UCase(arrPair(0)) = " VISASALESCOUNT" Then
            Msgbox “Number of Visa Sales: ” & arrPair(1)
        End If 
    next
Else
    StrError = StrError  & “The response from the PayTrace API was invalid."
End if

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