API Exporting Recurring Transactions
This method may be used to export details of a single recurring payment or all recurring payments for a specific customer.
Export Recurring Transactions Request
Required Name Value Pairs
UN, PSWD, TERMS, METHOD, RECURID or UN, PSWD, TERMS, METHOD, CUSTID
Optional Name Value Pairs For Exporting Recurring Transactions Request
The PayTrace API does not allow any optional name / value pairs for exporting recurring payments request.
Sample Export Recurring Transactions Request
‘format the request string to export a recurring transaction for the demo account
strRequest = "un~demo123|pswd~demo123|method~ExportRecur|terms~Y|"
strRequest = strRequest & "CUSTID~Support@PayTrace.com|"
strResponse = SendPayTraceAPIRequest(strRequest) ‘defined in Referencing the API Page
Request Response
Returned Name Value Pairs
Responses elicited from an ExportRecur request will always return either one or more error messages or one or more recurring payment records.
Example of Parsing an Export Recurring Payments 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
Dim arrSUBResponse() as String
Dim arrSUBPair() as String
Dim SUBCounter as Integer
‘declare the tools to store the values of the appropriate responses
Dim strError As String
‘…declare all of the individual fields (i.e. RECURID, AMOUNT, etc) that you wish to catch.
‘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)) = "RECURRINGPAYMENT" Then
arrSUBResponse = split(arrPair(1), “+”)
for SUBCounter = 0 to uBound(arrSUBResponse)-1
arrSUBPair = split(arrResponse(SUBCounter), “~”)
If UCase(arrSUBPair (0)) = " RECURID" Then
Msgbox “Recurring Payment ID = “ & arrSUBPair (1)
ElseIf UCase(arrSUBPair (0)) = " AMOUNT" Then
Msgbox “Recurring Amount = “ & arrSUBPair (1)
End If
next
End If
next
Else
StrError = StrError & “The response from the PayTrace API was invalid."
End if
If StrError <> “” then
MsgBox “Recurring export was not successful per the following error: ” & StrError
Else
MsgBox “Recurring export was successful”
End if
page revision: 2, last edited: 04 Oct 2011 20:02