<% '========================================================== ' VARIABLES TO BE SET BEFORE USING THIS SCRIPT '========================================================== rMethod = "SSR2" rPSID = "DEM" 'rPSID must be set to DEM while using this script for testing!! TransactionType = "NA" OrderId = "" '(optional) If you need to set a defined order id, enter it here CustomerName = request.form("Name") CustomerAddress = request.form("Address") CustomerCity = request.form("City") CustomerState = request.form("State") 'CustomerState MUST be 2 letter abbreviation!! CustomerZip = request.form("Zip") CustomerAccount = request.form("Account") 'Customer's credit card number CustomerExpDate = request.form("ExpDate") 'Customer's credit card expiration date CustomerCVV = request.form("CVV") 'Customer's card verification value (optional) CustomerEmail = request.form("Email") 'Customer's email address (optional) TransactionDescription = request.form("Description") 'Description of the purchase (optional) TransactionAmount = request.form("Amount") 'Total amount to be billed to credit card '========================================================== ' THE FOLLOWING LINES CAN REMAIN UNCHANGED AS LONG AS YOU ' DID NOT CHANGE THE VARIABLE NAMES ABOVE '========================================================== ReqBody = "rMethod=" & rMethod & "&rPSID=" & rPSID & "&TranType=" & TransactionType & "&OrderId=" & server.urlencode(OrderId) ReqBody = ReqBody & "&CustomerName=" & server.urlencode(CustomerName) & "&CustomerAddress=" & server.urlencode(CustomerAddress) ReqBody = ReqBody & "&CustomerCity=" & server.urlencode(CustomerCity) & "&CustomerState=" & CustomerState ReqBody = ReqBody & "&CustomerZip=" & server.urlencode(CustomerZip) & "&CustomerAccount=" & CustomerAccount ReqBody = ReqBody & "&CustomerExpDate=" & CustomerExpDate & "&CustomerEmail=" & server.urlencode(CustomerEmail) ReqBody = ReqBody & "&CustomerCVV=" & CustomerCVV & "&TransactionDescription=" & server.urlencode(TransactionDescription) ReqBody = ReqBody & "&TransactionAmount=" & TransactionAmount '============================================== ' SEND THE TRANSACTION TO THE PAYSTREAM GATEWAY ' NO NEED TO CHANGE ANY OF THIS... '============================================== Dim objHTTP Set objHTTP = Server.CreateObject("Mabry.HttpXCtl") objHTTP.Blocking = True objHTTP.BlockingMode = 1 objHTTP.URL = "https://secure.paystream.net/v2/process/process.asp?" objHTTP.Request.Headers("Content-Type") = "application/x-www-form-urlencoded" objHTTP.Request.Body = ReqBody objHTTP.Post '========================================== 'RETRIEVE THE RESPONSE AND SET TO VARIABLES '========================================== strResp = objHTTP.Response.Body aryResponse = Split(strResp,",") if UBound(aryResponse) = 8 then ResponseCode = aryResponse(0) ResponseText = aryResponse(1) AVSCode = aryResponse(2) ApprovalCode = aryResponse(3) ReturnedOrderId = aryResponse(4) SequenceNumber = aryResponse(5) BatchNumber = aryResponse(6) TransactionTime = aryResponse(7) TransactionDate = aryResponse(8) else ResponseCode = "XX" ResponseText = "An error has occurred while processing your request. Please try again later." end if aryResponse = "" set objHTTP = nothing '======================================================== ' DISPLAY THE RESULTS OF THE TRANSACTION ' ResponseCode = 00 is Approved, all else is Declined '======================================================== %> ResponseCode= <%= ResponseCode %>
ResponseText= <%= ResponseText %>
AVSCode= <%= AVSCode %>
ApprovalCode= <%= ApprovalCode %>
ReturnedOrderId= <%= ReturnedOrderId %>
SequenceNumber= <%= SequenceNumber %>
BatchNumber= <%= BatchNumber %>
TransactionTime= <%= TransactionTime %>
TransactionDate= <%= TransactionDate %>
*** END SAMPLE CODE ***