Posts: 8
Registered: ‎11-28-2013

CIM createPaymentProfile expiration date invalid


Im using MVC 4 and CIM api to store the details of credit card on server. The expiration date to be entered by the user. i have a view from where user can enter the date but when i attempt to store it on server i recive an error that a required value is missing. Below is the code that converts the date variable into string i debugged and checked the values are same in the date string.


DateTime year = Convert.ToDateTime(form["date"]);
            DateTime month = Convert.ToDateTime(form["date"]);
            String.Format("{0:mm}", month);
            String date = year.ToString("yyyy").Trim() + "-".Trim() + month.ToString("MM").Trim();
            CreditCardType new_card = new CreditCardType();
            new_card.cardNumber = form["cardno"];//"4111111111111111";
            new_card.expirationDate = date;// "2016-10"; 

 If i enter the commented string i can store the details but cant do it using the variable

Posts: 8
Registered: ‎11-28-2013

Re: CIM createPaymentProfile expiration date invalid


String date = year.ToString("yyyy-MM")

instead of converting and merging mannually. but still dint get the answer why it wasnt working previously.