Issues while creating a new subscription

Jun 4, 2010 at 6:11 AM

I was trying to create a new subscription using these codes:

ICustomer objCustomer = new Customer();
objCustomer = _objChargifyConnect.CreateCustomer(objChargify.UserFirstName, objChargify.UserLastName,objChargify.UserEmail, objChargify.UserOrganization, objChargify.UserSystemId);

ICreditCardAttributes objCreditCardAttrib = new CreditCardAttributes
(objChargify.CardFirstName, objChargify.CardLastName,objChargify.CardFullName, objChargify.CardExpYear , objChargify.CardExpMonth,objChargify.CardCVV,objChargify.CardBillingAddress, objChargify.CardBillingCity, objChargify.CardBillingState, objChargify.CardBillingZip, objChargify.CardBillingCountry);

CreditCardNumber = objChargify.CreditCardNumber;

ISubscription objSubscription = _objChargifyConnect.CreateSubscription(strProductHandle, objCustomer.ChargifyID, objCreditCardAttrib);


No value is null. When I execute this code, i am getting a "ChargifyNET.ChargifyException"

Error Message: The server returned 'Unprocessable Entity' with the status code 422 (422).

Stack trace:    at ChargifyNET.ChargifyConnect.DoRequest(String methodString, HttpRequestMethod requestMethod, String postData)
   at ChargifyNET.ChargifyConnect.CreateSubscription(String ProductHandle, Int32 ChargifyID, String FullNumber, Int32 ExpirationMonth, Int32 ExpirationYear, String CVV, String BillingAddress, String BillingCity, String BillingState, String BillingZip, String BillingCountry, String CouponCode)
   at ChargifyNET.ChargifyConnect.CreateSubscription(String ProductHandle, Int32 ChargifyID, ICreditCardAttributes CreditCardAttributes)
   at LeaveMaster.Chargify.ChargifyComm.addNewSubscription(ChargifyComm objChargify, String strProductHandle) in F:\..............\LeaveMaster.Chargify\ChargifyComm.cs:line 441

Can you tell me why its so? Whats the reason I am getting this exception. I also tried to pass ICustomerAttributes parameter also. Still I was getting the same exception. When passing null values I was getting another exception.


Thanks & Regards,

Vipin menon


Jun 4, 2010 at 6:36 AM


Issue is fixed. It was my mistake. i was FullName value to FullNumber value of Credicard Attribute.


Jun 7, 2010 at 1:30 PM

No worries. :)