- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am trying to update certain parameters of a subscription in C# .net MVC, as opposed to all, I am wondering if the following code approach is correct, and will leave other parameters (specified in the original subscription) unchanged. For instance, I am not specifying (or wanting to change) start date or remaning number of cycles. Would those remain unchanged, or am I approaching this wrong:
public string UpdateCCSubscription( SubscriptionGateway gate, string subscriptionId, string customerId, string email, string subscriptionName, decimal amount, string cardNumber, int cardMonth, int cardYear, string billToFirst, string billToLast, string billToState, bool isMonthly ) { ISubscriptionRequest subscription; if (isMonthly) subscription = SubscriptionRequest.CreateMonthly( email, subscriptionName, amount ); else subscription = SubscriptionRequest.CreateAnnual( email, subscriptionName, amount ); subscription.SubscriptionID = subscriptionId; subscription.CardNumber = cardNumber; subscription.CardExpirationMonth = cardMonth; subscription.CardExpirationYear = cardYear; subscription.CustomerID = customerId; AuthorizeNet.Address billToAddress = new AuthorizeNet.Address(); billToAddress.First = billToFirst; billToAddress.Last = billToLast; billToAddress.State = billToState; subscription.BillingAddress = billToAddress; try { gate.UpdateSubscription( subscription ); return "Updated"; } catch( Exception e ) { string s = e.Message; Console.WriteLine( "Failed to update SUB: " + e.ToString() ); return null; } }
Solved! Go to Solution.
โ01-07-2015 07:06 AM
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Look comparable to the sdks test
https://github.com/AuthorizeNet/sdk-dotnet/blob/master/AuthorizeNETtest/SubscriptionGatewayTest.cs
You can also test it with a test account
โ01-07-2015 07:16 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Look comparable to the sdks test
https://github.com/AuthorizeNet/sdk-dotnet/blob/master/AuthorizeNETtest/SubscriptionGatewayTest.cs
You can also test it with a test account
โ01-07-2015 07:16 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Okay the examples seem to show just required change fields being specified, I'll try to run some tests but it looks like it will not overwright fields that are not specified/changed.
โ01-07-2015 07:35 AM

