public static void customerProfileIdType(customerProfileIdType argument) { if (null != argument) { } }
public static ANetApiResponse Run(string ApiLoginID, string ApiTransactionKey, string subscriptionId) { Console.WriteLine("Update Subscription Sample"); ApiOperationBase<ANetApiRequest, ANetApiResponse>.RunEnvironment = AuthorizeNet.Environment.SANDBOX; ApiOperationBase<ANetApiRequest, ANetApiResponse>.MerchantAuthentication = new merchantAuthenticationType() { name = ApiLoginID, ItemElementName = ItemChoiceType.transactionKey, Item = ApiTransactionKey, }; paymentScheduleType schedule = new paymentScheduleType { startDate = DateTime.Now.AddDays(1), // start date should be tomorrow totalOccurrences = 9999 // 999 indicates no end date }; #region Payment Information var creditCard = new creditCardType { cardNumber = "4111111111111111", expirationDate = "0718" }; //standard api call to retrieve response paymentType cc = new paymentType { Item = creditCard }; #endregion nameAndAddressType addressInfo = new nameAndAddressType() { firstName = "Calvin", lastName = "Brown" }; customerProfileIdType customerProfile = new customerProfileIdType() { customerProfileId = "1232312", customerPaymentProfileId = "2132132", customerAddressId = "1233432" }; ARBSubscriptionType subscriptionType = new ARBSubscriptionType() { amount = 35.55m, paymentSchedule = schedule, billTo = addressInfo, payment = cc //You can pass a profile to update subscription //,profile = customerProfile }; //Please change the subscriptionId according to your request var request = new ARBUpdateSubscriptionRequest { subscription = subscriptionType, subscriptionId = subscriptionId }; var controller = new ARBUpdateSubscriptionController(request); controller.Execute(); ARBUpdateSubscriptionResponse response = controller.GetApiResponse(); //validate if (response != null && response.messages.resultCode == messageTypeEnum.Ok) { if (response != null && response.messages.message != null) { Console.WriteLine("Success, RefID Code : " + response.refId); } } else if(response != null) { Console.WriteLine("Error: " + response.messages.message[0].code + " " + response.messages.message[0].text); } return response; }
public static ANetApiResponse Run(String ApiLoginID, String ApiTransactionKey, short intervalLength, string customerProfileId, string customerPaymentProfileId, string customerAddressId) { Console.WriteLine("Create Subscription Sample"); ApiOperationBase<ANetApiRequest, ANetApiResponse>.RunEnvironment = AuthorizeNet.Environment.SANDBOX; ApiOperationBase<ANetApiRequest, ANetApiResponse>.MerchantAuthentication = new merchantAuthenticationType() { name = ApiLoginID, ItemElementName = ItemChoiceType.transactionKey, Item = ApiTransactionKey }; paymentScheduleTypeInterval interval = new paymentScheduleTypeInterval(); interval.length = intervalLength; // months can be indicated between 1 and 12 interval.unit = ARBSubscriptionUnitEnum.days; paymentScheduleType schedule = new paymentScheduleType { interval = interval, startDate = DateTime.Now.AddDays(1), // start date should be tomorrow totalOccurrences = 9999, // 999 indicates no end date trialOccurrences = 3 }; #region Payment Information var creditCard = new creditCardType { cardNumber = "4111111111111111", expirationDate = "0718" }; //standard api call to retrieve response paymentType cc = new paymentType { Item = creditCard }; #endregion customerProfileIdType customerProfile = new customerProfileIdType() { customerProfileId = customerProfileId, customerPaymentProfileId = customerPaymentProfileId, customerAddressId = customerAddressId }; ARBSubscriptionType subscriptionType = new ARBSubscriptionType() { amount = 35.55m, trialAmount = 0.00m, paymentSchedule = schedule, profile = customerProfile }; var request = new ARBCreateSubscriptionRequest {subscription = subscriptionType }; var controller = new ARBCreateSubscriptionController(request); // instantiate the contoller that will call the service controller.Execute(); ARBCreateSubscriptionResponse response = controller.GetApiResponse(); // get the response from the service (errors contained if any) //validate if (response != null && response.messages.resultCode == messageTypeEnum.Ok) { if (response != null && response.messages.message != null) { Console.WriteLine("Success, Subscription ID : " + response.subscriptionId.ToString()); } } else if(response != null) { Console.WriteLine("Error: " + response.messages.message[0].code + " " + response.messages.message[0].text); } return response; }