cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Null Response from Sandbox in Java

I can use visa to do purchase with production api login id and transaction key by using real credit card data in java. Yet when I do sandbox test in java, it fails. Response is null. The detail error message is "sun.reflect.annotation.TypeNotPresentExceptionProxy". For sandbox test, I use Sandbox api login id and transaction key. Is Sandbox connected? The codes are as below:

 

ApiOperationBase.setEnvironment(Environment.SANDBOX);

MerchantAuthenticationType merchantAuthenticationType = new MerchantAuthenticationType() ;
merchantAuthenticationType.setName("sandbox_api_login_id");
merchantAuthenticationType.setTransactionKey("sandbox_transaction_key");
ApiOperationBase.setMerchantAuthentication(merchantAuthenticationType);

// Populate the payment data
net.authorize.api.contract.v1.PaymentType paymentType =
new net.authorize.api.contract.v1.PaymentType();
CreditCardType creditCard = new CreditCardType();
creditCard.setCardNumber("4111111111111111>");
creditCard.setExpirationDate("0822");
paymentType.setCreditCard(creditCard);

// Create the payment transaction request
TransactionRequestType txnRequest = new TransactionRequestType();
txnRequest.setTransactionType(TransactionTypeEnum.AUTH_CAPTURE_TRANSACTION.value());
txnRequest.setPayment(paymentType);
txnRequest.setAmount(new BigDecimal(500.00));

// Make the API Request
CreateTransactionRequest apiRequest = new CreateTransactionRequest();
apiRequest.setTransactionRequest(txnRequest);
CreateTransactionController controller = new CreateTransactionController(apiRequest);
controller.execute();

CreateTransactionResponse response = controller.getApiResponse();

janet
Member
2 REPLIES 2

Dear @janet

 

 

Are you running your application via a TLS 1.2 connection?

Powered by NexWebSites.com -
Certified Authorize.net developers
NexusSoftware
Trusted Contributor

Yes. I am using TSL 1.2.