import com.jcommercesql.gateway.authorizenet.AuthorizeNetCC; /* In this example the AuthorizeNetCC class is initialized without a prop file. The 5 required connect variables (host, port, path, loginid and trankey) are set manually. */ public class Sample { public static void main(String[] args) { AuthorizeNetCC anetcc = new AuthorizeNetCC(); anetcc.setURL("secure.authorize.net",443,"/gateway/transact.dll"); anetcc.setMerchantInfo("ant481302xxx","w75ZC3eDo2gfTeXN"); anetcc.addOptionalField("x_Address","123 Main St."); // if needed for AVS anetcc.addOptionalField("x_Zip","10101"); // if needed for AVS anetcc.addMerchantDefinedField("m_Comment", "Basic Example 1"); anetcc.setTransaction("373223011111111","11/09","100.00","AUTH_CAPTURE"); try { anetcc.submit(); // System.out.println("getResponseCode: " + anetcc.getResponseCode()); if (anetcc.getResponseCode().equals("1")) { System.out.println("Your transaction was approved!"); } else { System.out.println("Your transaction was declined! " + anetcc.getResponseReasonText()); } } catch(Exception e) { System.out.println("System Error! " + e); } } // end main } // end class