Showing results for 
Search instead for 
Did you mean: 

C# Api getCustomerProfileRequest null response

I'm trying to test the getCustomerProfileRequest in the C# api but my response is always null. This is what i have so far:


ApiOperationBase<ANetApiRequest, ANetApiResponse>.RunEnvironment = AuthorizeNet.Environment.SANDBOX;
      ApiOperationBase<ANetApiRequest, ANetApiResponse>.MerchantAuthentication = new merchantAuthenticationType()
        name = _credentials.LoginId,
        ItemElementName = ItemChoiceType.transactionKey,
        Item = _credentials.ApiKey

      var request = new getCustomerProfileRequest { customerProfileId = customerProfileId.Value };

      var controller = new getCustomerProfileController(request);

      var response = controller.GetApiResponse();

Is there any reason this would be null? It's not invalid credentials or anything like that. Always null. If I put in invalid credentials the result will be an error saying invalid credentials. I know for a fact there is a customer profile for the given customerProfileId because results are returned by the soap requests.


I found out the issue. The API key was wrong. However, the api key I was sending through was too long for what the API key expects (which I found by using the "try it" section of the website). It turns out that error is not handled in the api controller and just returns null as a result.


Is there any way this can be noted as a future change/fix for the api?


Hello @Devin


I would suggest logging an issue in GitHub to notify the development team and get a response when completed.


You are also welcome in the future to go ahead and log issues right there too. You can even submit your fix for our review and inclusion: