Reply
Member
Posts: 1
Registered: ‎02-07-2017

ARBECreateSubscriptionResponse is Null C#

I am trying to create a subscription, but the response comes back nul.  Here is my code:

 

paymentScheduleTypeInterval interval = new paymentScheduleTypeInterval();
interval.length = 12;
interval.unit = ARBSubscriptionUnitEnum.months;

paymentScheduleType schedule = new paymentScheduleType
{
interval = interval,
startDate = DateTime.Now.AddDays(1),
totalOccurrences = 9999,

};
ARBSubscriptionType subscriptionType = new ARBSubscriptionType
{
amount = Price,
paymentSchedule = schedule,
payment = paymentType,
billTo = billingAddress


};
var subscriptionRequest = new ARBCreateSubscriptionRequest { subscription = subscriptionType };

var subscriptionController = new ARBCreateSubscriptionController(subscriptionRequest);
subscriptionController.Execute();

ARBCreateSubscriptionResponse subscriptionResponse = subscriptionController.GetApiResponse();
if (subscriptionResponse != null && subscriptionResponse.messages.resultCode == messageTypeEnum.Ok)
{
success = true;

}
else if (subscriptionResponse != null)
{
success = false;
}

 

All variables do have value, but response is null.  If a drill down through the controller object I see Error E00045 "The root node does not reference a valid XML namespace.", but I am not using XML and my payment transactions process with no problem using the same credentials.  Any assistance is greatly appreciated!

Administrator
Posts: 209
Registered: ‎11-03-2016

Re: ARBECreateSubscriptionResponse is Null C#

Hi @DevQueen,

 

While your code is interacting with the SDK, the SDK is building a request to be sent to our API endpoint out of the information that you're passing it. That request that's actually sent to our servers is formatted as XML. So, when our server is responding with an XML parsing error, that's some indication that it's not recognizing the request as sent.

 

Would it be possible for you to post the actual API request that the SDK is creating? The SDK will log that request, although I'm not sure if logging is on by default.

-Aaron

Aaron Wright
Developer Evangelist - Authorize.Net

Follow Authorize.Net developer news on Twitter!