Authorize.net API to charge credit card taking over 20 seconds

99 views Asked by At

This has been an issue for a few months now. Authorize.net claims that the bottleneck is NOT on their end. I get the same slow response from our production server as well as when I run locally in my development environment. I'm also getting the slow response whether I use Authorize.net's .NET SDK or if I call their Web API with an HttpClient.

Checking the elapsed time when running the code it is taking about 22 seconds when I execute the createTransactionController using their .NET SDK:

var controller = new createTransactionController(request);

controller.Execute(); // This takes about 22 seconds.

var response = controller.GetApiResponse(); // This takes less than a second.

I get similar performance when using HttpClient to call their API:

    // This takes about 22 seconds.    
    HttpResponseMessage? response = await _httpClient.PostAsJsonAsync<CreditCardTransactionRequest>(_httpClient.BaseAddress!.ToString(), request);

    // This takes less than a second:
    createTransactionResponse? createResponse = await response.Content.ReadFromJsonAsync<createTransactionResponse>();

Any tips on where to look or what might be slowing things down will be very much appreciated.

1

There are 1 answers

3
ChrisRoss On

This is certainly an abnormal behavior. A normal Card transaction takes 1-3 seconds for authorization and it is unlikely that the delay is on their side.

There are a couple things you can try to help trouble shoot.

The first is your environment/network. You say you already tried this on Production and in dev. Have you tried it from your local computer? Is this computer on the same network? You may try connecting to an outside network, mobile hotspot, etc. to eliminate any network issues. We had an issue once with our outbound connections being routed through our WAF that was causing a very similar issue.

The second thing could possibly have to do with the code. To test this, you can try using a tool such as postman and calling the REST endpoint directly. If that goes through without issue, then you have pinpointed the issue to your code implementation.