Showing results for 
Search instead for 
Did you mean: 

CIM AuthorizeAndCapture Invalid Response on Sandbox



I have just started using and I am using the CIM to create simple profiles, add credit cards, etc. The primary goal is to use a stored credit card for transaction purposes. I am using C#/.Net 4.5 and the SDK.  Please note, I need to actually test that CIM payment profile based transaction work BEFORE I can move to production.


When using test mode, the following line of code DOES NOT return what the SDK assumes it should.  If we look at CustomerGateway.cs and AuthorizeAndCapture method:


public IGatewayResponse AuthorizeAndCapture(Order order)...


It assumes the result will be populated with a "directResponse" property:


var response = (createCustomerProfileTransactionResponse)_gateway.Send(req);
return new GatewayResponse(response.directResponse.Split(','));


Stepping through the code the response seems to have NOTHING but the ANetApiResponse property "messages" populated and that simply has a result of "OK" or "Error" with a string message of "Successful" or the error code.


This is unacceptable because I expect this to work like other IGatewayResponse methods in the SDK (setting the Approved property, and parsing the directResponse) and I have no idea what the production result will be.  Is this just an issue on Test? How am I supposed to test this?  Has anyone else seen this with the CustomerGateway? I am using the newest code from NuGet/.Net package manager


<?xml version="1.0" encoding="utf-8"?>
<package id="AuthorizeNet" version="1.8.3" targetFramework="net45" />


And the HttpXmlUtility for test seems to be pointing to the standard url:


public const string TEST_URL = "";


I have hit a brick wall here.  Can anyone shed some light on this?  AIM and AuthenticationRequests via the SDK work complete fine as well.



Accepted Solutions

I wound up just using the SOAP web service directly.  You could do the same with the XML end point as well.  I am not going to touch the C# SDK code since I think it needs quite a bit of work and I can't dedicate any time to updating it via proper channels (fork of github, communicate with the creators, etc).  I'd be more inclined to try to clean up an SDK after the JSON based services are available. I read somewhere they are still in BETA.  I'd like a much cleaner web api to begin with.

View solution in original post


Debug and post the raw response from

var response = (createCustomerProfileTransactionResponse)_gateway.Send(req);


Personally, I would just use the CIM webservice. from the CIM soap doc


Hello and thanks for the reply.  It appears the CIM SDK for IGatewayResponse is broken or I'm missing something here.


If I do something I expect to be wrong (i.e. -> enter an amount for a transaction I know will be too high for the sandbox, enter an invalid profile and paymentprofileId) I see only this as the raw response you asked about:


"ErrorE00027The transaction amount submitted was greater than the maximum amount allowed."


The remaining properties I would expect to be populated are all their initialized values only, all string empty, all false, etc.


When I successfully do a transaction I can see on the sandbox the transaction detail or it worked correctly. The raw response is simply:




I am wondering if the issue is the actual web service and the method it is consuming OR that the SDK is expecting the response to be similiar to that of AIM responses so it tries to return a IGatewayresponse parsed and build off of a property which never comes back...


Either way, I'm sort of stuck here...

The problem is with the EXXXXX error, it do not return directResponse.

I use VS and it so much easier just to use the web service call, check the code, if it I00001, do this ..., if EXXXX do something else.



"OkI00001Successful" should be more if you doing an transaction.

OK, well there is definately a problem with the C# SDK.  As a test I used your suggestion of hitting the "test" SOAP end point directly.  I used the same test credentials, nothing at all is different besides using the SOAP end point and then "wrapping the result" so I get back the same IGatewayResponse I need.  I have a few interfaces I've build for the SDK so I need the proper object to come back.


var profile = new net.authorize.apitest.ProfileTransAuthCaptureType
customerProfileId = 30825860,
customerPaymentProfileId = 27922978,
amount = 334.00M,
order = new net.authorize.apitest.OrderExType {invoiceNumber = "inv-" + DateTime.Now.Ticks}
var trans = new net.authorize.apitest.ProfileTransactionType {Item = profile};
var response = new net.authorize.apitest.Service().CreateCustomerProfileTransaction(auth, trans, null);

var hackedGatewayResponse = new GatewayResponse(response.directResponse.Split(','));



So as you can see the direct SOAP method actually populates the .directResponse object unlike the SDK method. Then I generate my own GatewayResponse from it.  I assume this is easily re-produced by someone. The SDK uses the following url for test (XML end point), and something is broken there (no directResponse property is returned).

Yep something is broken

Look like it in HttpXmlUtility.cs


void CheckForErrors(ANetApiResponse response)

in there it check for

if (response.GetType() == typeof(createCustomerProfileTransactionResponse))

they mess up there, directResponse had the right info, but in the code they loop thru the response and get the wrong node. ??? Did they ran into problem for some scenario?

I have narrowed down the problem is definately with the SDK but I didn't get as far as you have yet :), to track down where it goes wrong. One issue I have with using the SOAP method directly, unless I don't see it, is I would like to add LineItems to the "Order" object, similar to how I can do it via the SDK version.  However, using the SOAP serialized classes, it appears the request wants an OrderExType and I don't see any way to include an array of LineItem...


So now I am at the point where the SDK lets me craft a request how I need it, but the response is broken.  The SOAP web service calls allow to create a standard response, but I can't include line items in the request.

I appreciate your help. What would your suggestion be?

OK, yes I just looked at the same area you mentioned. I don't understand the point of this CheckErrors method at all :). Yes, it looks like they purposely mangle this response type and never set it back. So the directResponse is set to null and it's never "re-assigned" in the for loop check of child nodes..gross.I'm also not a fan of the "else" in this statement, the check for messages length and then if the an error response code, throwing an invalidexception.


I am hesitant to update the source and even attempt to do a real pull or fork request, since I don't really understand the full intent of this code.

LineItem is not in Order is in the transaction


    var order = new AuthorizeNet.Order(profileID, paymentProfileID, "");
    order.Amount = 10;

    var req = new createCustomerProfileTransactionRequest();

    var trans = new profileTransAuthOnlyType();
    trans.lineItems = new lineItemType[1];

Is there any update on this yet. Even I'm facing the same issue for transactions using CIM.