API Email Receipt

Through the PayTrace API, requests may be made to have transaction receipts emailed to a specific email address for any transaction processed through the PayTrace Payment Gateway.

Emailing a Receipt Request

Required Name Value Pairs

UN, PSWD, TERMS, METHOD, TRANXID, EMAIL

Emailing a Check Receipt Request

Required Name Value Pairs

UN, PSWD, TERMS, METHOD, CHECKID, EMAIL

Optional Name Value Pairs For Any Email Receipt Request

No optional name / value pairs are applicable for requests to email receipts.

Sample Email Receipt Request

‘format the request string to email a receipt  for transaction ID 1498 to support@paytrace.com
strRequest = “UN~demo123|PSWD~demo123|TERMS~Y|METHOD~EmailReceipt|”
strRequest = strRequest & “TRANXID~4620420|EMAIL~support@paytrace.com|”

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

Request Response

Returned Name Value Pairs

Responses elicited from an EmailReceipt request will always return either one or more error messages or a RESPONSE message.

Example of Parsing a Email Receipt 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

‘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)
        End If 
    next
Else
    StrError = StrError  & “The response from the PayTrace API was invalid."
End if 

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