cancel
Showing results for 
Search instead for 
Did you mean: 

Newbie need help with the example code

I integrate the example code into my java class and run it on the localhost server, there's an error when debugging at line Transaction authCaptureTransaction = merchant.createAIMTransaction(TransactionType.AUTH_CAPTURE, new BigDecimal(1.99)); The error says java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory . Please help me, i'm very new to authorize.net.

 

private static final String API_LOGIN_ID = "xxx";
  private static final String TRANSACTION_KEY = "xxx";

public static void checkout() {
    Merchant merchant = Merchant.createMerchant(Environment.SANDBOX, API_LOGIN_ID, TRANSACTION_KEY);

    CreditCard creditCard = CreditCard.createCreditCard();
    creditCard.setCreditCardNumber("4111 1111 1111 1111");
    creditCard.setExpirationMonth("12");
    creditCard.setExpirationYear("2015");

    // Create AUTH transaction
    Transaction authCaptureTransaction = merchant.createAIMTransaction(TransactionType.AUTH_CAPTURE, new BigDecimal(1.99));
    authCaptureTransaction.setCreditCard(creditCard);

    Result<Transaction> result = (Result<Transaction>) merchant.postTransaction(authCaptureTransaction);

    System.out.println(result.getTarget().getTransactionId());
    System.out.println("responseCode = " + result.getResponseCode());
    System.out.println("responseText = " + result.getResponseText());
    System.out.println("reasonResponseCode = " + result.getReasonResponseCode());
  }

TetsuoVN123
Member
1 ACCEPTED SOLUTION

Accepted Solutions

3 REPLIES 3

I've been missing a few lib files in the sdk, but now there's another error "Transactions of this market type cannot be processed on this system." Anyone who knows please help.

TetsuoVN123
Member

Thank you, I've solved it