binaryjunky
asked on
Authorize.net Silent post page VB script/ASP
Hi, I'm looking for a spot of help with creating a silent post page that will take returning vaules from authorize.net and then plug them into a microsoft access database. I'll comment out what I can to explain what we're trying to do here.
This code was working then my boss editing something and now it's not, can anyone tell me whats up with it?
<%@ Language=VBScript%>
<%
dim ADOConn, AdoCmd, Qty, x_amount, x_Trans_ID, x_Tax, Price, x_Qty
set AdoConn = CreateObject("adodb.connec tion")
AdoConn.Open("provider=Mic rosoft.Jet .OLEDB.4.0 ;Data Source=C:\data\ourdatabase .mdb")
Set ADOCmd = CreateObject("adodb.comman d")
ADOCmd.ActiveConnection = AdoConn
//fields from authorize.net we want
x_Trans_ID = Request.Form("x_trans_id") + ""
x_amount = Request.Form("x_amount") + 0
x_Tax = Request.Form("x_tax")
x_Name = Request.Form("x_first_name ") + " " + Request.Form("x_last_name" )
if x_Trans_ID = "" then x_Trans_ID = now()
Price = x_amount + 0
if x_Tax <> "" then Price = x_amount - x_tax
//I know this is a bit weird but it actually did work, this is basically taking the price and figuring out the quantity of our //product the customer ordered based only off the total price.
x_Qty = 1
if Price > 0 then
if (price / 199.99) = (price \ 199.99) then x_Qty = (price \ 199.99)
if (price / 99.99) = (price \ 99.99) then x_Qty = (price \ 99.99)
if (price / 75.00) = (price \ 75.00) then x_Qty = (price \ 75.00)
end if
//Here we are taking the variables and actually plugging them into our database
'AdoCmd.CommandText = "Insert into ourtable (ID, History) values ('" + x_Trans_ID + "','" + Request.Form + "')"
AdoCmd.CommandText = "Insert into ourtable (ID, Name1, LastDate1, MaintExpires, Features, RegCount, History) values ('" + CStr(x_Trans_ID) + "','" + x_Name + "',Now(),Now()," + Cstr(price) + "," + CStr(x_Qty) + ",'" + Request.Form + "');"
AdoCmd.Execute
%>
also, how do I test this through the browser.......say I type in http://www.ourdomain.com/Web/AuthNet.asp
how could i put fields into the URL that I could test this on without actually submitting an actual order?
This code was working then my boss editing something and now it's not, can anyone tell me whats up with it?
<%@ Language=VBScript%>
<%
dim ADOConn, AdoCmd, Qty, x_amount, x_Trans_ID, x_Tax, Price, x_Qty
set AdoConn = CreateObject("adodb.connec
AdoConn.Open("provider=Mic
Set ADOCmd = CreateObject("adodb.comman
ADOCmd.ActiveConnection = AdoConn
//fields from authorize.net we want
x_Trans_ID = Request.Form("x_trans_id")
x_amount = Request.Form("x_amount") + 0
x_Tax = Request.Form("x_tax")
x_Name = Request.Form("x_first_name
if x_Trans_ID = "" then x_Trans_ID = now()
Price = x_amount + 0
if x_Tax <> "" then Price = x_amount - x_tax
//I know this is a bit weird but it actually did work, this is basically taking the price and figuring out the quantity of our //product the customer ordered based only off the total price.
x_Qty = 1
if Price > 0 then
if (price / 199.99) = (price \ 199.99) then x_Qty = (price \ 199.99)
if (price / 99.99) = (price \ 99.99) then x_Qty = (price \ 99.99)
if (price / 75.00) = (price \ 75.00) then x_Qty = (price \ 75.00)
end if
//Here we are taking the variables and actually plugging them into our database
'AdoCmd.CommandText = "Insert into ourtable (ID, History) values ('" + x_Trans_ID + "','" + Request.Form + "')"
AdoCmd.CommandText = "Insert into ourtable (ID, Name1, LastDate1, MaintExpires, Features, RegCount, History) values ('" + CStr(x_Trans_ID) + "','" + x_Name + "',Now(),Now()," + Cstr(price) + "," + CStr(x_Qty) + ",'" + Request.Form + "');"
AdoCmd.Execute
%>
also, how do I test this through the browser.......say I type in http://www.ourdomain.com/Web/AuthNet.asp
how could i put fields into the URL that I could test this on without actually submitting an actual order?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.