Reply
Highlighted
Member
Posts: 3
Registered: ‎12-03-2012
Accepted Solution

Newbie need help with the example code

[ Edited ]

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());
  }


Accepted Solutions
Solution
Accepted by topic author TetsuoVN123
‎08-21-2015 01:58 AM
Expert
Posts: 4,525
Registered: ‎03-08-2010

Re: Newbie need help with the example code


All Replies
Member
Posts: 3
Registered: ‎12-03-2012

Re: Newbie need help with the example code

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.

Solution
Accepted by topic author TetsuoVN123
‎08-21-2015 01:58 AM
Expert
Posts: 4,525
Registered: ‎03-08-2010

Re: Newbie need help with the example code

Member
Posts: 3
Registered: ‎12-03-2012

Re: Newbie need help with the example code

Thank you, I've solved it