API Create Recurring Transaction

Recurring transactions may be created and updated through the PayTrace API. All recurring transactions must be referenced to an existing customer profile, and they will be processed per the specified frequency until the transaction has been processed the same number of times as the specified total count.

Create Recurring Payment Request

Required Name Value Pairs

UN, PSWD, TERMS, METHOD, CUSTID, FREQUENCY, START, TOTALCOUNT, AMOUNT, TRANXTYPE

Optional Name Value Pairs For Create Recurring Payment Request

DESCRIPTION, CUSTRECEIPT, RECURTYPE

Sample Create Recurring Payment Request

‘format the request string to create a recurring transaction for the demo account
strRequest = "un~demo123|pswd~demo123|method~createrecur|terms~Y|"
strRequest = Request & "start~3/26/2012|amount~1.00|totalcount~03|frequency~1|"
strRequest = strRequest & "custid~testcustomer|tranxtype~SALE|custreceipt~N|"

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

Request Response

Returned Name Value Pairs

RESPONSE, RECURID

Example of Parsing a Create Recurring Payment 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 strRecurID 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)) = "RECURID" Then
            strRecurID = arrPair(1)
        End If 
    next
Else 
    StrError = StrError  & “The response from the PayTrace API was invalid."
End if 

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