API Sale

Swiped Sale

Required Name Value Pairs

UN, PSWD, TERMS, METHOD, TRANXTYPE, AMOUNT, SWIPE

Please note that Encrypted Card Readers will often use ‘|’ characters to delimit data in the swiped value, and we use these same values to delimit our API requests. So, your application will want to replace the pipe "|" characters in the swipe value with three asterisks "***" in each instance in order to relay that request accurately.

Please note that swiped data from a card reader needs to be URL encoded before passing to our API.

Key Entered Sale

Required Name Value Pairs

UN, PSWD, TERMS, METHOD, TRANXTYPE, AMOUNT, CC, EXPMNTH, EXPYR

Customer ID (Token) Processing

Required Name Value Pairs

UN, PSWD, TERMS, METHOD, TRANXTYPE, AMOUNT, CUSTID

Optional Name Value Pairs For Any Sale Request

BNAME, BADDRESS, BADDRESS2, BCITY, BSTATE, BZIP, BCOUNTRY, SNAME, SADDRESS, SADDRESS2, SCITY, SCOUNTY, SSTATE, SZIP, SCOUNTRY, EMAIL, CSC, INVOICE, DESCRIPTION, TAX, CUSTREF, RETURNCLR, CUSTOMDBA, ENABLEPARTIALAUTH, DISCRETIONARY DATA

Referenced Sale Transaction Processing

Required Name Value Pairs

UN, PSWD, TERMS, METHOD, TRANXTYPE, AMOUNT, TRANXID

Optional Name Value Pairs For Any Referenced Sale Transaction Request

BNAME, BADDRESS, BADDRESS2, BCITY, BSTATE, BZIP, BCOUNTRY, SNAME, SADDRESS, SADDRESS2, SCITY, SCOUNTY, SSTATE, SZIP, SCOUNTRY, EMAIL, CSC, INVOICE, DESCRIPTION, TAX, CUSTREF, AMOUNT, RETURNCLR, CUSTOMDBA, ENABLEPARTIALAUTH, DISCRETIONARY DATA

Sample of a Sale Request

‘format the request string to process a sale for $1.00
strRequest = “UN~demo123|PSWD~demo123|TERMS~Y|METHOD~ProcessTranx|”
strRequest = strRequest & “TRANXTYPE~Sale|CC~4012881888818888|EXPMNTH~12|EXPYR~12|”
strRequest = strRequest & “AMOUNT~1.00|CSC~999|BADDRESS~1234|BZIP~83852|INVOICE~8888|”

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

Request Response

Returned Name Value Pairs

RESPONSE, TRANSACTIONID, APPCODE, APPMSG, AVSRESPONSE, CSCRESPONSE,

  • PARTIALAMOUNT, BALANCEAMOUNT are only returned if the ENABLEPARTIALAUTH parameter is set to Y and a transaction is partially approved or a balance response is provided by the issuer.

Example of Parsing a Sale 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
Dim strAppCode As String
Dim strAppMsg As String
Dim strAVSResponse As String
Dim strCSCResponse 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)
        ElseIf UCase(arrPair(0)) = "APPCODE" Then
            strAppCode = arrPair(1)
ElseIf UCase(arrPair(0)) = "APPMSG" Then
            strAppMsg = arrPair(1)    
        ElseIf UCase(arrPair(0)) = "AVSRESPONSE" Then
            strAVSResponse = arrPair(1)    
        ElseIf UCase(arrPair(0)) = "CSCRESPONSE" Then
            strCSCResponse = 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
    If strAppCode <> “” then
        MsgBox “Transaction was APPROVED: ” & strResponseMessage    
    Else
        MsgBox “Transaction was NOT approved: ” & strResponseMessage
    End if
End if