Showing results for 
Search instead for 
Did you mean: 

C# GetSettledBatchList error "Object reference not set to an instance of an object."



I am having a problem getting the GetSettledBatchList method to work in C#. I'm using the sample code provided on the Dev site.


I've enabled the API on the sandbox website and tried both "ServiceMode.Test" and "ServiceMode.Live".


The GetTransactionList works just fine for me, so I know my login credentials are good.


I can't think of anything else to try. Any help would be greatly appreciated.




Unfortunately, that error isn't particularly helpful in determining what has gone wrong in the code. Can you tell me specifically which sample code are you using?

Administrator Administrator

Dear Trevor,

i just downloaded the latest SDK and Quick start sample.


By using the Quick Start sample, I submitted a CardPresentAuthorizeAndCaptureRequest and return ok.

When i try to run the sample reporting porject, i get the error "Object reference not set to an instance of an object.",

where batches.batchList is null.


I am using the C# version of the sample project.


gate.GetTransactionDetails works, but GetSettledBatchList & GetTransactionList error out on "Object reference not set..."


I know that I am running a test account and there will no settled batch, but it shouldnt error out. 

It looks like this may be an error in the SDK. We've reported it to our developers for their review.





Developer Community Manager

Hi there.  I'm receiving the "Object reference not set to an instance of an object" while using the C# API that is currently available for download from the download page.


I am able to successfully instantiate the ReportingGateway object with my client's keys for their account.  The error occurs on the next line when attempting to call the GetSettledBatchList function.


I am using the compiled binaries that are available for download; my code is in 2010.


Any thoughts on this would be great.  It looks like there are several different threads about this problem, and I see that there are posts that state that there has been a fix deployed, but given that I (believe I) have the latest version of the API, it appears that either I'm doing something wrong or that the fix in not in place.


Any help would be really appreciated.  My client wants to go live Thursday, and I've been pushing this off because I thought it was something in my code that I could fix later...


Thank you.

Can you provide the exact line that is causing the error, and maybe the lines before where you create the gateway object?

Has this bug been fixed?  I am getting the same issue when calling GetSettledBatchList.  The error occurs any time I specify dates that return no results.  If results exist, the function works.  Any information to resolve this would be appreciated.

No, unfortunately this has not yet been fixed. I was unable to reproduce the error in my own tests, but I did my testing for dates that contained transactions. You mentioned that this happens for date ranges that do not return any results and that is likely what I was missing. I'll do some additional testing and report it to our SDK developers to hopefully get it fixed.

is this fixed yet?





Hello @planet4379 


Yes, this issue should be corrected.  You can obtain the latest version from Github: