1 import com.jcommercesql.gateway.authorizenet.AuthorizeNetCC; 2 3 4 public class Sample2 { 5 6 public static void main(String [] args) { 7 8 try { 9 10 AuthorizeNetCC anetcc = new AuthorizeNetCC("config.prop"); 11 anetcc.addOptionalField("x_Address","123 Main St."); anetcc.addOptionalField("x_Zip","10101"); anetcc.setTransaction("1234123412341234","11/09","100.00","AUTH_CAPTURE"); 14 anetcc.addMerchantDefinedField("m_Comment", "Basic Example 2"); 15 anetcc.submit(); 16 17 if (anetcc.getResponseCode().equals("1")) { 18 System.out.println("Your transaction was approved!"); 19 } else { 20 System.out.println("Your transaction was declined! " + anetcc.getResponseReasonText()); 21 } 22 } catch(Exception e) { 23 System.out.println("System Error! " + e); 24 } 25 26 } } | Popular Tags |