Link to home
Start Free TrialLog in
Avatar of binaryjunky
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.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?
ASKER CERTIFIED SOLUTION
Avatar of amit_g
amit_g
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial