Reply
Member
Posts: 3
Registered: ‎01-20-2012

Error 57 Giving me trouble

I am using uniCenta, an open source solution, that integrated your JAVA SDK.  The oPOS has some 13000 users and I find it hard to believe that I am the first to use Authorize.Net  I searched the forums and did not find uniCenta mentioned.

 

When I run the software in Test mode with a developer API ID etc, I receive an email with: Response : This transaction approved.

 

When I run the software in Live mode with a real API ID and tranaction key I get error 57 Error during processing transaction. This error code is shown inside the software.

 

 

I am aware that code 57 suggests that some field is left blank. (Which ones?)

I am aware that code 57 is sent to Lightspeed POS when they have the x_market_type set wrong. (How do I find that?)
I am aware that the message suggest to contact the merchant service provide - and we have. 

 

An Auth.Net tech support agent also run a test from within your virtual terminal and the transaction was apporpriately declined suggesting that your settings match the merchant service provider. 

 

So all that said, it seems to point the POS software.

 

However, when I look at the transaction detail provided when logged in as a merchant, I do not see any missing fields.  Obviously I can not see all the required fields in that table as required in the Min Field list.

 

Below is a transaction with the error.  Can someone look at tranaction data stream and tell me what is going on?

 

Transaction ID: 4122569184
Transaction Status: General Error  (Processor error - An error occurred during authorization. If these errors persist, contact merchant service provider)
 
 
Settlement Information
Settlement Amount:USD 2.38
Settlement Date and Time:20-Jan-2012 17:27:23
Business Day:20-Jan-2012
Batch ID:179178369
Posts: 1,609
Topics: 15
Kudos: 201
Solutions: 121
Registered: ‎06-23-2011

Re: Error 57 Giving me trouble

The Response Reason Code Tool had this to say:

 

Integration Team Suggestions: This error is caused when a transaction is passed and a required field is left blank.

The Secure Source account you have set up with Wells Fargo specifies certain required information in order to process transactions. These are the required fields for credit card transactions:

First Name
Last Name
Address
City
State
Zip Code
Country
Phone OR Email

eCheck.Net® transactions require all of the above requirements, plus the following:

Bank Name
Account #
ABA Routing Code
(Driver's License # AND Driver's License State AND Date of Birth on Driver's License) OR (Customer Organization Type (I-individual B-business) AND Customer SSN)

 

The information you provided doesn't say whether you may have left any of that out or not?

Member
Posts: 3
Registered: ‎01-20-2012

Re: Error 57 Giving me trouble

[ Edited ]

Thanks TJ for the response.

 

I am very aware of the Response Reason Code's answer.

 

I do not have a Secure Source account with Wells Fargo.

 

And no, I do not supply all those fields. This is a card present account in a Retail/Restaurant environment.

 

Based on the Min Required Fields (page 13) of the Card Present Guide those fields are not required.

 

I even allowed a tech inside the company to run a transaction from within their virtual terminal that did not supply those fields either.  Their transaction passed.

 

I am seeking inside help to tell me about the data stream. This does not see to be an account settings. This seems to be a data stream of items taht are not shown in the customer records.

Posts: 1,609
Topics: 15
Kudos: 201
Solutions: 121
Registered: ‎06-23-2011

Re: Error 57 Giving me trouble

About all I can suggest is to (a) find where in the Java SDK the data is actually sent to Authorize.net, and backtrack from there until you find where things are going wrong, or (b) contact the authors of your software and get tech support from them. Never seen this particular problem before, and the chances of us being able to identify it with this amount of information are rather low.

Member
Posts: 3
Registered: ‎01-20-2012

Re: Error 57 Giving me trouble

what more info do you need.

 

I have been told that we are set up as Retail, Card Present, Resaurant

 

Here is the java code.  I am not a Java specific programmer but the code seems pretty eazy to read and compare against the Card Present specs

 

/**
 * <p>Title: AIM Java Version 1.4.1_02-b06</p>
 * <p>Description: Advanced Integration Method</p>
 * <p>Copyright: Copyright (c) 2003</p>
 * <p>Company: Authorize.Net</p>
 * @author Authorize.Net
 * @version 3.1
 */

/**
 *  Based on sample code and snipptes provided by:
 *  Patrick Phelan, phelan@choicelogic.com
 *  Roedy Green, Canadian Mind Products
 */

// Modifications by Adrian Romero & Mikel Irurita

package com.openbravo.pos.payment;

import com.openbravo.data.loader.LocalRes;
import java.io.*;
import java.net.*;
import java.text.NumberFormat;
import java.text.DecimalFormat;

import com.openbravo.pos.forms.*;
import com.openbravo.pos.util.AltEncrypter;
import java.util.HashMap;
import java.util.Map;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;

public class PaymentGatewayAuthorizeNet implements PaymentGateway {
   
    private static String ENDPOINTADDRESS;
    private static final String OPERATIONVALIDATE = "AUTH_CAPTURE";
    private static final String OPERATIONREFUND = "CREDIT";
    private static final String APPROVED = "1";
   
    private String m_sCommerceID;
    private String m_sCommercePassword;
    private boolean m_bTestMode;

    /** Creates a new instance of PaymentGatewayAuthorizeNet */
    public PaymentGatewayAuthorizeNet(AppProperties props) {
        // Grab some configuration variables
        m_sCommerceID = props.getProperty("payment.commerceid");
       
        AltEncrypter cypher = new AltEncrypter("cypherkey" + props.getProperty("payment.commerceid"));
        this.m_sCommercePassword = cypher.decrypt(props.getProperty("payment.commercepassword").substring(6));

        m_bTestMode = Boolean.valueOf(props.getProperty("payment.testmode")).booleanValue();
       
        ENDPOINTADDRESS = (m_bTestMode)
                ? "https://test.authorize.net/gateway/transact.dll"
                : "https://cardpresent.authorize.net/gateway/transact.dll";
    } 
   
    public PaymentGatewayAuthorizeNet() {
       
    }

    @Override
    public void execute(PaymentInfoMagcard payinfo) {

        StringBuffer sb = new StringBuffer();
        try {
            //test -> login:44CWBFp7wh9 / pass:43P7s8qb84CVT9Jx
            sb.append("x_cpversion=1.0");
           
            sb.append("&x_market_type=2");
           
            sb.append("&x_device_type=1");
           
            sb.append("&x_login=");       
            sb.append(URLEncoder.encode(m_sCommerceID, "UTF-8"));

            sb.append("&x_tran_key=");
            sb.append(URLEncoder.encode(m_sCommercePassword, "UTF-8"));
            
            sb.append("&x_amount=");
            NumberFormat formatter = new DecimalFormat("0000.00");
            String amount = formatter.format(Math.abs(payinfo.getTotal()));
            sb.append(URLEncoder.encode(amount.replace(',', '.'), "UTF-8"));
           
            if (payinfo.getTrack1(true) == null) {
                sb.append("&x_card_num=");
                sb.append(URLEncoder.encode(payinfo.getCardNumber(), "UTF-8"));

                sb.append("&x_exp_date=");
                String tmp = payinfo.getExpirationDate();
                sb.append(URLEncoder.encode(tmp, "UTF-8"));

                String[] cc_name = payinfo.getHolderName().split(" ");
                sb.append("&x_first_name=");
                if (cc_name.length > 0) {
                   sb.append(URLEncoder.encode(cc_name[0], "UTF-8"));
                }
                sb.append("&x_last_name=");
                if (cc_name.length > 1) {
                   sb.append(URLEncoder.encode(cc_name[1], "UTF-8"));
                }
            } else {
                // Example Track1
                // %B4111111111111111^PADILLA VISDOMINE/LUIS^0905123000000000000002212322222?5
                sb.append("&x_track1=");
                sb.append(payinfo.getTrack1(false));
                sb.append("&x_track2=");
                sb.append(payinfo.getTrack2(false));
            }
           
            sb.append("&x_method=CC");
            sb.append("&x_version=3.1");
            sb.append("&x_delim_data=TRUE");
            sb.append("&x_delim_char=|");
            sb.append("&x_relay_response=FALSE");
            sb.append("&x_test_request=");
            sb.append(m_bTestMode);
           
            //PAYMENT
            if (payinfo.getTotal() >= 0.0) {
                sb.append("&x_type=");
                sb.append(OPERATIONVALIDATE);
                //sb.append("&x_card_code=340"); //CCV
            }
            //REFUND
            else {
                sb.append("&x_type=");
                sb.append(OPERATIONREFUND);
                sb.append("&x_trans_id=");
                sb.append(payinfo.getTransactionID());
            }

            // open secure connection
            URL url = new URL(ENDPOINTADDRESS);

            URLConnection connection = url.openConnection();
            connection.setDoOutput(true);
            connection.setUseCaches(false);

            // not necessarily required but fixes a bug with some servers
            connection.setRequestProperty("Content-Type","application/x-www-form-urlencoded");

            // POST the data in the string buffer
            DataOutputStream out = new DataOutputStream(connection.getOutputStream());
            out.write(sb.toString().getBytes());
            out.flush();
            out.close();

            // process and read the gateway response
            BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
            String returned = in.readLine();
           
            in.close(); // fin
           
            AuthorizeNetParser anp = new AuthorizeNetParser(returned);
            Map props = anp.splitXML();
           
            if (anp.getResult().equals(LocalRes.getIntString("button.ok"))) {
                if (APPROVED.equals(props.get("ResponseCode"))) {
                    //Transaction approved
                    payinfo.paymentOK((String) props.get("AuthCode"), (String) props.get("TransID"), returned);
                } else {
                    StringBuilder errorLine = new StringBuilder();
                    //Transaction declined
                    if (anp.getNumErrors()>0) {
                       
                        for (int i=1; i<=anp.getNumErrors(); i++) {
                            errorLine.append(props.get("ErrorCode"+Integer.toString(i)));
                            errorLine.append(": ");
                            errorLine.append(props.get("ErrorText"+Integer.toString(i)));
                            errorLine.append("\n");
                        }
                    }
                    payinfo.paymentError(AppLocal.getIntString("message.paymenterror"), errorLine.toString());
                }
            }
            else {
                payinfo.paymentError(anp.getResult(), "");
            }
          
        } catch (UnsupportedEncodingException eUE) {
            payinfo.paymentError(AppLocal.getIntString("message.paymentexceptionservice"), eUE.getMessage());
        } catch (MalformedURLException eMURL) { 
            payinfo.paymentError(AppLocal.getIntString("message.paymentexceptionservice"), eMURL.getMessage());
        } catch(IOException e){
            payinfo.paymentError(AppLocal.getIntString("message.paymenterror"), e.getMessage());
        }
       
    }
   
    private class AuthorizeNetParser extends DefaultHandler {
   
    private SAXParser m_sp = null;
    private Map props = new HashMap();
    private String text;
    private InputStream is;
    private String result;
    private int numMessages = 0;
    private int numErrors = 0;
   
    public AuthorizeNetParser(String input) {
        is = new ByteArrayInputStream(input.getBytes());
    }
   
    public Map splitXML(){
        try {
            if (m_sp == null) {
                SAXParserFactory spf = SAXParserFactory.newInstance();
                m_sp = spf.newSAXParser();
            }
            m_sp.parse(is, this);
        } catch (ParserConfigurationException ePC) {
            result = LocalRes.getIntString("exception.parserconfig");
        } catch (SAXException eSAX) {
            result = LocalRes.getIntString("exception.xmlfile");
        } catch (IOException eIO) {
            result = LocalRes.getIntString("exception.iofile");
        }
        result = LocalRes.getIntString("button.ok");
        return props;
    }
     
    @Override
    public void endElement(String uri, String localName, String qName) throws SAXException {
        try {
            if (qName.equals("ResponseCode")) {
                props.put("ResponseCode", URLDecoder.decode(text, "UTF-8"));
                text="";
            } else if (qName.equals("ErrorCode")){
                numErrors++;
                props.put("ErrorCode"+Integer.toString(numErrors), URLDecoder.decode(text, "UTF-8"));
                text = "";
            } else if (qName.equals("ErrorText")) {
                props.put("ErrorText"+Integer.toString(numErrors), URLDecoder.decode(text, "UTF-8"));
                text="";
            } else if (qName.equals("Code")) {
                numMessages++;
                props.put("Code"+Integer.toString(numMessages), URLDecoder.decode(text, "UTF-8"));
                text = "";
            } else if (qName.equals("Description")) {
                props.put("Description"+Integer.toString(numMessages), URLDecoder.decode(text, "UTF-8"));
                text="";
            } else if (qName.equals("AuthCode")) {
                props.put("AuthCode", URLDecoder.decode(text, "UTF-8"));
                text="";
            } else if (qName.equals("AVSResultCode")) {
                props.put("AVSResultCode", URLDecoder.decode(text, "UTF-8"));
                text="";
            } else if (qName.equals("CVVResultCode")) {
                props.put("CVVResultCode", URLDecoder.decode(text, "UTF-8"));
                text="";
            } else if (qName.equals("TransID")) {
                props.put("TransID", URLDecoder.decode(text, "UTF-8"));
                text="";
            } else if (qName.equals("RefTransID")) {
                props.put("RefTransID", URLDecoder.decode(text, "UTF-8"));
                text="";
            } else if (qName.equals("TransHash")) {
                props.put("TransHash", URLDecoder.decode(text, "UTF-8"));
                text="";
            } else if (qName.equals("TestMode")) {
                props.put("TestMode", URLDecoder.decode(text, "UTF-8"));
                text="";
            } else if (qName.equals("UserRef")) {
                props.put("UserRef", URLDecoder.decode(text, "UTF-8"));
                text="";
            }
        }
        catch(UnsupportedEncodingException eUE){
            result = eUE.getMessage();
        }
    }
   
    @Override
    public void startDocument() throws SAXException {
        text = new String();
    }

    @Override
    public void endDocument() throws SAXException {
    }
   
    @Override
    public void characters(char[] ch, int start, int length) throws SAXException {
        if (text!=null) {
            text = new String(ch, start, length);
        }
    }
   
    public String getResult(){
        return this.result;
    }
   
    public int getNumErrors(){
        return numErrors;
    }
   
    public int getNumMessages(){
        return numMessages;
    }
   
 }

}

Posts: 1,609
Topics: 15
Kudos: 201
Solutions: 121
Registered: ‎06-23-2011

Re: Error 57 Giving me trouble

I could be wrong, as I'm not familiar with Java integration, but this doesn't look like it's using a recent version of the Java SDK. It's constructing a raw query string to pass to Authorize.net and then XML parsing the response. Can you run a transaction through and print out the contents of sb just before this line?

out.write(sb.toString().getBytes());

And then both the XML and the split result from this:

Map props = anp.splitXML();

This will make it a lot easier to verify if something is missing or improperly formatted or whatever.

Administrator Administrator
Administrator
Posts: 563
Registered: ‎08-03-2011

Re: Error 57 Giving me trouble

Hi,

 

This error is caused on Global Card Present merchants if the merchant's POS software submits an x_device_type value of 1 (unknown).  The reason that this occurs, is that Global does not actually accept this value.  If the POS software provider changes that value to something different, such as 2 (unattended terminal), or 5 (PC based terminal), it should be fine.  A list of these values can be found on pages 15 and 16 of the CP Integration guide. Please note that Global is the type of processor used on this account based on the transaction ID provided on the thread.

 

Thanks,

Joy

Posts: 1,609
Topics: 15
Kudos: 201
Solutions: 121
Registered: ‎06-23-2011

Re: Error 57 Giving me trouble

[ Edited ]

I'm thinking that the vast majority of posts on this forum could be solved simply by having more complete lists of what error codes could actually mean in the Response Reason Code Tool.

Member
Posts: 2
Registered: ‎07-29-2013

Re: Error 57 Giving me trouble (error 30 & 82)

Sorry to resurrect an old thread on my first post, but this is why I came here.  Authorize.net is passing the transaction to MSI, but it's denied.  So far the information I have either gathered myself, or been given to by reps of both Authorize.net and MSI, is the following....

 

Payment transaction error!

30: Configuration with processor is invalid.  Call Merchant Service provider.

 

82: Cashback not approved.  Cashback limit exceeded.

 

CVV invalid

 

VAR sheet has been given to us and verified with Authorize.net as being correct.  The card used for testing was not used as a debit card, as there is no option for it in uniCenta I've yet seen.  No requests for cashback were made.  The openbravo/unicenta EMS & oPOS projects have Authorize.net listed as a supported gateway.  It was the openbravo faq that I found the link to the test account. https://developer.authorize.net/testaccount/  The test account worked fine in unicenta, but not the account we just set up with Authorize.net.

Member
Posts: 2
Registered: ‎07-29-2013

Re: Error 57 Giving me trouble

Joy,

 

Does this x_device_type value issue not exist with other processors?  If not, could you suggest a merchant?