We help IT Professionals succeed at work.
Get Started

Authorize.net Silent post page VB script/ASP

2,425 Views
Last Modified: 2013-11-29
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.connection")
  AdoConn.Open("provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\data\ourdatabase.mdb")

  Set ADOCmd = CreateObject("adodb.command")
  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?
Comment
Watch Question
CERTIFIED EXPERT
Top Expert 2006
Commented:
This problem has been solved!
Unlock 1 Answer and 1 Comment.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE