View Full Version : Random cart 'card declined' error but still charges card

08-02-2004, 08:06 PM
I'm hoping someone can suggest what to check here because Im driving myself crazy and spending alot of money to have this fixed and no one can seem to do it. My website processes a transaction through the Authorize.net gateway. Seemingly at random, users will get a "0" string returned after the cart sends the information to the gateway, which will display the card declined msg. If the cart gets a "1", it displays no error, and will send orders and invoices via email. Authorize.net shows no issues or declinations in their records, and the card is charged, but somehow the cart still gets the declined string, and breaks function, thereby not emailing an order copy to user, not sending me an invoice, and not entering the transation as a sale. The charge then needs to be voided since there is no record of the sale or way to contact the user. This usually results in a lost sale. I have included the code that belive to be troublesome, but one thing that makes no sense is that it happens sporadically & randomly, but once it happens once it seems to STAY broken until I re-upload a copy of the file..... even though there have been no changes to the live files. Has anyone else had code gnomes screw with them? I am going CRAZY and losing $$... can someone offer some ways to pin this down? If there is any info I neglected to include, post what I missed and I'll try and post it back.

<!-- Above this is the DB connection include, and a card # validation routine-->

Set xobj = CreateObject("SOFTWING.ASPtear")




' Request to AuthorizeNet

strRetval = xobj.Retrieve(https://*****.*****.com/secure/gateway/URL/, 1, cpost, "", "")

'response.write strRetval

if left(strRetVal,1)=1 then


end if

if success = 0 then

msg=server.urlencode("Your credit card was declined. If you feel this is an error, please call us Toll Free at....")

response.redirect "checkoutc.asp?msg="&msg


<!-- Below this is the order's entry into the DB, &the templates for the invoice/order copies & mail function -->

08-03-2004, 09:23 AM
You don't need the single quotes in the post data and you have to url-encode them especially if you're expecting it to have special characters.

cpost = "x_Version=3.0&x_Login=" & server.urlencode('*******') & "&x_Password=" & server.urlencode('******') & "&x_Trans_ID=" & hour(now()) & minute(now()) & second(now())
cpost = cpost & "&x_Card_Num=" & ccnumber & "&x_Exp_Date=" & server.urlencode(ccdate) & "&x_Address=" & server.urlencode(basic_rs.fields("address1")) & "&x_Zip=" & basic_rs.fields("zip")
cpost = cpost & "&x_Amount=" & request.form("grandtotal") & "&x_Test_Request=FALSE&x_ADC_Delim_Data=TRUE&x_ADC_URL=FALSE"

response.write cpost & "<br />" 'debug

08-04-2004, 01:14 AM
My guess is that the communication link is being broken sometime after the request gets received by the AN host. You may be able to tweak your logic to check for a specific string in the results to see if you received a response at all -- like a true decline. Right now your logic appears to assume "declined" if anything other than approved is returned. Add some logic to also specifically check for decline and assume communication error if not approved or declined.

Hope this helps. If you really get stuck... :rolleyes: