0

I getting Environment Not Set error with Authorize.Net Java SDK Version 2.0.1

"Environment not set. Set environment using setter or use overloaded method to pass appropriate environment"

Following line throws error :

CreateTransactionController transactionController = new CreateTransactionController(apiRequest)

Although I confirmed using debug point that environment was set properly.

ApiOperationBase.setEnvironment(Environment.SANDBOX);

Strangely enough, this happened when I copied the implementation code to Microservice from earlier Monolith implementation of my project. ( Same code is working on previous application)

You can also find the reported bug below for same issue back in 2015. Although it was closed as the person who raised it used an alternative solution.

https://github.com/AuthorizeNet/sdk-java/issues/74

Anyone have any clue?

Aditya T
  • 1,566
  • 2
  • 13
  • 26

2 Answers2

1

Reverting to back to version 2.0.0 worked. I upgraded back to 2.0.1 to confirm if this was specific to version but more strangely it started working with 2.0.1 version.

Tanay Sen
  • 11
  • 4
0

I was also getting the same error.

In my case, the error was not actually with setting environment.

Please find my answer in the below link!

Authorize.net Environment not set issue

Kanagalingam
  • 2,096
  • 5
  • 23
  • 40