cancel
Showing results for 
Search instead for 
Did you mean: 

.NET API endpoint

In using the .NET compiled .dll from NuGet it seems the endpoint is hard coded in. Is there a method to passin the endpoint?  Such as from an appsettings key?  Thx

glerler
Contributor
3 REPLIES 3

@glerler

 

Are you trying to set the environment, sandbox or production?

 

https://github.com/AuthorizeNet/sdk-dotnet#switching-between-the-sandbox-environment-and-the-product...

 

Richard

RichardH
Administrator Administrator
Administrator

Yes

What is was asking is there a method to pass the EndPoint URL string in?

It looks to be hard coded in.

Thx

G

string baseUrl = "YOUR_BASE_URL";
string xmlBaseUrl = "YOUR_XML_BASE_URL";
AuthorizeNet.Environment.createEnvironment(baseUrl, xmlBaseUrl);

 As @RichardH referenced, Sandbox and Production URLs are already declared in Environment.cs 

  public class Environment {
        public static readonly Environment SANDBOX = new Environment("https://test.authorize.net", "https://apitest.authorize.net", "https://test.authorize.net");
        public static readonly Environment PRODUCTION = new Environment("https://secure2.authorize.net","https://api2.authorize.net","https://cardpresent.authorize.net");

So just by changing  

ApiOperationBase<ANetApiRequest, ANetApiResponse>.RunEnvironment = AuthorizeNet.Environment.SANDBOX;

to  

ApiOperationBase<ANetApiRequest, ANetApiResponse>.RunEnvironment = AuthorizeNet.Environment.PRODUCTION;

you are effectively passing in the alternate URL.

 

Powered by NexWebSites.com -
Certified Authorize.net developers