Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Aug 2004
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation Random cart 'card declined' error but still charges card

    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.





    Code:
    <!-- Above this is the DB connection include, and a card # validation routine-->
    
     
    
    Set xobj = CreateObject("SOFTWING.ASPtear")
    
    cpost="x_Version='3.0'&x_Login='*******'&x_Password='******'&x_Trans_ID="&hour(now())&minute(now())&second(now())&"&"
    
    cpost=cpost&"x_Card_Num='"&ccnumber&"'&x_Exp_Date='"&ccdate&"'&x_Address='"&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'"
    
    ' Request to AuthorizeNet
    
    strRetval = xobj.Retrieve(https://*****.*****.com/secure/gateway/URL/, 1, cpost, "", "")
    
    'response.write strRetval
    
    if left(strRetVal,1)=1 then
    
    success=1
    
    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
    
    else
    
     
    
    <!-- Below this is the order's entry into the DB, &the templates for the invoice/order copies & mail function -->

  • #2
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,047
    Thanks
    0
    Thanked 251 Times in 247 Posts
    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.
    Code:
    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

  • #3
    Regular Coder
    Join Date
    Jul 2002
    Location
    Las Vegas, NV - USA
    Posts
    104
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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...
    Steven Sommers (blog)
    Shift4 Corporation -- www.shift4.com

    Creators of $$$ ON THE NET(tm) payment processing services.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •