Processing a refund through the PayTrace API may be accomplished by providing a new customer’s swiped credit card information, providing a new customer’s key entered credit card information, providing the customer ID of an existing customer, or providing the transaction ID of the original transaction that should be refunded.
Swiped Refund
Required Name Value Pairs
UN, PSWD, TERMS, METHOD, TRANXTYPE, AMOUNT, SWIPE
Key Entered Refund
Required Name Value Pairs
UN, PSWD, TERMS, METHOD, TRANXTYPE, AMOUNT, CC, EXPMNTH, EXPYR
Customer ID (Token) Refund Processing
Required Name Value Pairs
UN, PSWD, TERMS, METHOD, TRANXTYPE, AMOUNT, CUSTID
Referenced Refund Processing
Required Name Value Pairs
UN, PSWD, TERMS, METHOD, TRANXTYPE,TRANXID
Optional Name Value Pairs For Some Refund Requests Based Upon Type
BNAME, BADDRESS, BADDRESS2, BCITY, BSTATE, BZIP, BCOUNTRY, SNAME, SADDRESS, SADDRESS2, SCITY, SCOUNTY, SSTATE, SZIP, SCOUNTRY, EMAIL, CSC, INVOICE, DESCRIPTION, TAX, CUSTREF, AMOUNT, DISCRETIONARY DATA
Sample of a Refund Request
‘format the request string to process a refund for $1.00
strRequest = “UN~demo123|PSWD~demo123|TERMS~Y|METHOD~ProcessTranx|”
strRequest = strRequest & “TRANXTYPE~Refund|CC~4012881888818888|EXPMNTH~12|”
strRequest = strRequest & “EXPYR~12|AMOUNT~1.00|”
strResponse = SendPayTraceAPIRequest(strRequest) ‘defined in Referencing the API Page
Request Response
Returned Name Value Pairs
RESPONSE, TRANSACTIONID
Example of Parsing a Refund 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
next
Else
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
Else
MsgBox “Transaction was successful: ” & strResponseMessage
End if