cancel
Showing results for 
Search instead for 
Did you mean: 

Null reference exception being thrown after charging a payment profile

I have a working wcf service that I have been using for several years. I recently modified this service by deleting the downloaded API project that was being used and replacing it with the Nuget package for authorize.net. (I want to use the new default payment profile flag) Worked great and compiled immediately. Tests to create customer profiles and payment profiles went great. However, when I executed a unit test to charge a customer by a payment profile, I received a null reference exception. Tthe transaction was successful and is viewable in the sandbox, and I received the email as well. Nevertheless, the exception does cause me issues obviously. I ran the same unit test against the original copy of the wcf service and it worked just fine. This leads me to believe that it must be something in the updated API.

 

Has anyone else encountered an issue with using the Nuget package to charge a customer's payment profile?

 

When I examine the request object, it has only the merchantAuthentication node and the transactionRequest node. The transactionRequest has amount, profile, and transactionType populated, everything else is null.

 

This is the exception data:

Object reference not set to an instance of an object.

   at AuthorizeNet.HttpXmlUtility.CheckForErrors(ANetApiResponse response, XmlDocument xmlDoc)
   at AuthorizeNet.HttpXmlUtility.Send(ANetApiRequest apiRequest)
   at FC_Payment.PaymentProcessor.ANetMakeRequest.MakeRequest(ANetApiRequest request) in c:\FirstCircle\Applications\Services\FC_Payment\Development\FC_Payment\PaymentProcessor\ANetMakeRequest.cs:line 58
   at FC_Payment.Payment.processPaymentByProfileId(Guid transactionGuid, CustomerPayment payment, PlanCode planCode) in c:\FirstCircle\Applications\Services\FC_Payment\Development\FC_Payment\Payment.svc.cs:line 424
   at SyncInvokeprocessPaymentByProfileId(Object , Object[] , Object[] )
   at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs)
   at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc)

 

Any help would be appreciated!

 

--Jason

 

JasonSki7475
Member
1 REPLY 1

Hi @JasonSki7475,

 

From your writeup, I'm assuming that you're intentionally only passing the profile ID and not the payment profile ID (to attempt to charge the default payment profile). Is that correct? Or, is it that you're passing the payment profile ID, and the request object isn't including it for some reason?

 

I'm also assuming that the profile ID you're using has a default payment profile associated with it (since the charge appears to actually happen).

 

Your best bet might be to open an issue on the actual project in GitHub. However, if I get a little more clarification from you, I can push it from this end as well.

Aaron
All Star