cancel
Showing results for 
Search instead for 
Did you mean: 

Updating a Subscription errors out on unchanged subscription amount - C# API

Hello, 

 

I would like to update a subscription's expiration date and billing info.  These are the ONLY fields I need to update.  When I create my request using the C# API:

 

 

var subscriptionType = new ARBSubscriptionType
{
    billTo = addressInfo,
    payment = cc
};

var request = new ARBUpdateSubscriptionRequest
{
    subscription = subscriptionType, 
    subscriptionId = updateModel.AuthNetSubId.ToString()
};

var controller = new  ARBUpdateSubscriptionController(request);

controller.Execute();

var xml = AuthorizeNet.Util.XmlUtility.GetXml(request);

var response = controller.GetApiResponse();

I get the following error message via the controller's error messages: 

 

  • Error: E00003 The 'AnetApi/xml/v1/schema/AnetApiSchema.xsd:amount' element is invalid - The value '0' is invalid according to its datatype 'Decimal' - The MinInclusive constraint failed.

 

Even though I did NOT specify an amount, when I view the XML, I get the following:

<?xml version=\"1.0\" encoding=\"utf-8\"?>
<ARBUpdateSubscriptionRequest
    xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"
    xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"
    xmlns=\"AnetApi/xml/v1/schema/AnetApiSchema.xsd\">
    <merchantAuthentication> 
        <name>6Cr7vYe4LM</name>
        <transactionKey>4N62cdy6Zn92DK7F</transactionKey> 
    </merchantAuthentication>
    <subscriptionId>3044281</subscriptionId>
    <subscription>
        <amount>0</amount>   
        <trialAmount>0</trialAmount>  
        <payment>
            <creditCard>        
                <cardNumber>4111111111111111</cardNumber>    
                <expirationDate>1017</expirationDate>      
            </creditCard>
        </payment>    
        <billTo>      
            <firstName>SomeFirstName</firstName> 
            <lastName>SomeLastName</lastName>      
            <address>SomeAddress</address>      
            <city>SomeCity</city>      
            <zip>91234</zip>    
        </billTo>  
    </subscription>
</ARBUpdateSubscriptionRequest>

As you can see, even though I did not specify an amount or trial amount, they are still showing up in the XML.  I even tried setting:

request.subscription.amountSpecified = false;
request.subscription.trialAmountSpecified = false;

It was my understanding, via reading the documentation and posts on this site, that during a subscription update, one only needed to include the fields that were changing.  Is this no longer the case?  Or am I doing something else incorrectly that's causing the error message above?

 

-K

 

ksanchezssmci1
Contributor
3 REPLIES 3

I would just like to add that if  I examine the request object BEFORE the controller.Execute() line, the amountSpecified and trialAmountSpecified are both false.  They both change to true once the controller.Execute() line is run.

 

-K 

ksanchezssmci1
Contributor