Reply
Highlighted
Member
Posts: 8
Registered: ‎11-28-2013

CIM createPaymentProfile expiration date invalid

Hi,

Im using asp.net MVC 4 and CIM api to store the details of credit card on authorize.net 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 authorize.net 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"]);
            String.Format("{0:yyyy}",year);
            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

Highlighted
Member
Posts: 8
Registered: ‎11-28-2013

Re: CIM createPaymentProfile expiration date invalid

used 

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

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