public void DoSampleCode()
        {
            ChargifyConnect chargify = new ChargifyConnect();
            chargify.apiKey = ConfigurationManager.AppSettings["CHARGIFY_API_KEY"];
            chargify.Password = ConfigurationManager.AppSettings["CHARGIFY_API_PASSWORD"];
            chargify.URL = ConfigurationManager.AppSettings["CHARGIFY_URL"];
            chargify.UseJSON = true;

            // This could perhaps be read from the gateway?
            ICustomerAttributes charlie = new CustomerAttributes("Charlie", "Guy", "*****@*****.**", "YourCompany", Guid.NewGuid().ToString());

            // This as well, I'm assuming ...
            IPaymentProfileAttributes existingProfile = new PaymentProfileAttributes("12345", "67890", VaultType.AuthorizeNET, 2020, 12, CardType.Visa, "1111");

            // Now create the subscription importing from the vault
            ISubscription charlieSubscription = chargify.CreateSubscription("basic", charlie, DateTime.Now, existingProfile);
        }
Ejemplo n.º 2
0
        public void DoSampleCode()
        {
            ChargifyConnect chargify = new ChargifyConnect();

            chargify.apiKey   = ConfigurationManager.AppSettings["CHARGIFY_API_KEY"];
            chargify.Password = ConfigurationManager.AppSettings["CHARGIFY_API_PASSWORD"];
            chargify.URL      = ConfigurationManager.AppSettings["CHARGIFY_URL"];
            chargify.UseJSON  = true;

            // This could perhaps be read from the gateway?
            ICustomerAttributes charlie = new CustomerAttributes("Charlie", "Guy", "*****@*****.**", "YourCompany", Guid.NewGuid().ToString());

            // This as well, I'm assuming ...
            IPaymentProfileAttributes existingProfile = new PaymentProfileAttributes("12345", "67890", VaultType.AuthorizeNET, 2020, 12, CardType.Visa, "1111");

            // Now create the subscription importing from the vault
            ISubscription charlieSubscription = chargify.CreateSubscription("basic", charlie, DateTime.Now, existingProfile);
        }
Ejemplo n.º 3
0
        public ActionResult Subscribe(TestProject.Models.Subscribe subscribe, string confirmKey)
        {
            ChargifyConnect chargify = ChargifyTools.Chargify;
            string          plan     = subscribe.plan;
            bool            isCredit = subscribe.hasCreditCard || subscribe.creditcard.requireCredit;//ChargifyTools.RequireCreditCard(subscribe.plan);

            try
            {
                if (ChargifyTools.IsChargifyProduct(subscribe.plan))
                {
                    ViewBag.confirmKey = confirmKey;
                    ViewBag.plan       = subscribe.plan;
                    if (ValidatePassword(subscribe.password) == false)
                    {
                        //ViewBag.contactGenderId = new SelectList(db.contactGender.ToList(), "contactGenderId", "name");
                        ViewBag.Message = "Error password, you need a format that contains capital letters and numbers, example: Michael7.";
                        ViewBag.plan    = subscribe.plan;

                        return(View(subscribe));
                    }

                    userLogin user = new userLogin();
                    contact   cont = new contact();
                    tenant    tnt  = new tenant();
                    //----------------------------------------------------------------------------------------------------------------
                    //----------------------------------------------------------------------------------------------------------------
                    //----------------------------------------------------------------------------------------------------------------

                    tnt.tenantSubscriptionPlanId = (from pl in db.tenantSubscriptionPlan
                                                    where pl.code.ToLower().Equals(plan.ToLower())
                                                    select pl.tenantSubscriptionPlanId).FirstOrDefault();
                    tnt.active           = true;
                    tnt.allocatedUsers   = 1; //cantidad de usuarios asignados
                    tnt.billingRefNumber = Guid.NewGuid().ToString();
                    tnt.companyName      = subscribe.company;
                    tnt.companyURL       = "N/A";
                    tnt.database         = "TestProject";
                    tnt.tenantStatusId   = 2;
                    tnt.tenantSourceId   = 2;
                    if (isCredit)
                    {
                        tnt.tenentBillingTypeId = 1;
                    }
                    else
                    {
                        tnt.tenentBillingTypeId = 2;
                    }

                    /****** Valores quemados de campos auditoria*****/
                    tnt.updatedById    = 0;
                    tnt.createdById    = TntIdTestProject; // Id tenant TestProject
                    tnt.modifyDateTime = new DateTime(1900, 1, 1, 0, 0, 0);
                    tnt.insertDateTime = DateTime.Now;
                    /****** Valores quemados de campos auditoria*****/

                    db.tenant.Add(tnt);
                    db.SaveChanges();



                    var city = db.genCity
                               .Include(x => x.genState.genContry)
                               .SingleOrDefault(x => x.genCityId == Convert.ToInt32(subscribe.genCityId));
                    if (isCredit)
                    {
                        contactPhone phone = new contactPhone
                        {
                            active             = true,
                            number             = subscribe.phoneNumber,
                            contactId          = cont.contactId,
                            contactPhoneTypeId = 1,
                            tenantId           = tnt.tenantId,
                            updatedById        = 0,
                            createdById        = TntIdTestProject, // Id tenant TestProject
                            modifyDateTime     = new DateTime(1900, 1, 1, 0, 0, 0),
                            insertDateTime     = DateTime.Now
                        };

                        db.contactPhone.Add(phone);
                        db.SaveChanges();

                        cont.preferredBillAddressId = address.contactAddressId;
                        cont.preferredPhoneId       = phone.contactPhoneId;
                        db.Entry(cont).State        = EntityState.Modified;
                        db.SaveChanges();
                    }



                    /*** cosas de chargify!!!*/
                    CustomerAttributes customerInformation = new CustomerAttributes();
                    customerInformation.FirstName    = subscribe.firstName;
                    customerInformation.LastName     = subscribe.lastName;
                    customerInformation.Organization = subscribe.company;
                    customerInformation.Email        = subscribe.email;
                    // Create a new guid, this would be the Membership UserID if we were creating a new user simultaneously
                    customerInformation.SystemID = tnt.billingRefNumber;


                    ISubscription newSubscription = null;
                    string        productHandle   = plan;

                    if (isCredit)
                    {
                        CreditCardAttributes creditCardInfo = new CreditCardAttributes();

                        creditCardInfo.FullNumber      = subscribe.creditcard.creditCardNumber;
                        creditCardInfo.CVV             = subscribe.creditcard.cvv;
                        creditCardInfo.ExpirationMonth = subscribe.creditcard.ExpireMonth;
                        creditCardInfo.ExpirationYear  = subscribe.creditcard.ExpireYear;

                        creditCardInfo.BillingAddress = subscribe.street;
                        creditCardInfo.BillingCity    = city.City;//subscribe.city;
                        creditCardInfo.BillingState   = city.genState.State;
                        creditCardInfo.BillingZip     = subscribe.postalCode;
                        creditCardInfo.BillingCountry = city.genState.genContry.contry;

                        newSubscription = chargify.CreateSubscription(productHandle, customerInformation, creditCardInfo);
                    }
                    else
                    {
                        newSubscription = chargify.CreateSubscription(productHandle, customerInformation);
                    }
                }
            }
            catch (DbEntityValidationException e)
            {
                foreach (var eve in e.EntityValidationErrors)
                {
                    System.Diagnostics.Debug.WriteLine("Entity of type \"{0}\" in state \"{1}\" has the following validation errors:",
                                                       eve.Entry.Entity.GetType().Name, eve.Entry.State);
                    foreach (var ve in eve.ValidationErrors)
                    {
                        System.Diagnostics.Debug.WriteLine("- Property: \"{0}\", Error: \"{1}\"",
                                                           ve.PropertyName, ve.ErrorMessage);
                    }
                }
                throw;
            }
            catch (Exception e)
            {
                return(View(subscribe));
            }


            return(View(subscribe));
        }
Ejemplo n.º 4
0
        public void DoSampleCode()
        {
            ChargifyConnect chargify = new ChargifyConnect();
            chargify.apiKey = ConfigurationManager.AppSettings["CHARGIFY_API_KEY"];
            chargify.Password = ConfigurationManager.AppSettings["CHARGIFY_API_PASSWORD"];
            chargify.URL = ConfigurationManager.AppSettings["CHARGIFY_URL"];

            // Create a new customer and a subscription for him
            ICustomerAttributes scottPilgrim = new CustomerAttributes("Scott", "Pilgrim", "*****@*****.**", "Chargify", Guid.NewGuid().ToString());
            
            ICreditCardAttributes scottsPaymentInfo = new CreditCardAttributes();
            scottsPaymentInfo.FirstName = scottPilgrim.FirstName;
            scottsPaymentInfo.LastName = scottPilgrim.LastName;
            scottsPaymentInfo.ExpirationMonth = 1;
            scottsPaymentInfo.ExpirationYear = 2020;
            scottsPaymentInfo.FullNumber = "1";
            scottsPaymentInfo.CVV = "123";
            scottsPaymentInfo.BillingAddress = "123 Main St.";
            scottsPaymentInfo.BillingCity = "New York";
            scottsPaymentInfo.BillingCountry = "US";
            scottsPaymentInfo.BillingState = "New York";
            scottsPaymentInfo.BillingZip = "10001";

            ISubscription newSubscription = chargify.CreateSubscription("basic", scottPilgrim, scottsPaymentInfo);
            if (newSubscription != null)
            {
                // subscription success.
                Console.WriteLine("Subscription succeeded.");
            }
            else
            {
                // subscription failure.
                Console.WriteLine("Update customer failed with response: ", chargify.LastResponse.ToString());
            }

            ICharge oneTimeChargeResults = chargify.CreateCharge(newSubscription.SubscriptionID, 123.45m, "Testing One-Time Charge");
            if (oneTimeChargeResults != null)
            {
                // one-time charge success.
                Console.WriteLine(string.Format("Charge succeeded: {0}", oneTimeChargeResults.Success.ToString()));
            }
            else
            {
                // one time charge failure.
                Console.WriteLine("One-time charge failed with response: ", chargify.LastResponse.ToString());
            }

            IDictionary<int, ITransaction> transactions = chargify.GetTransactionsForSubscription(newSubscription.SubscriptionID, new List<TransactionType>() { TransactionType.Payment });
            // Grab the last payment transaction, which we will refund (will be the one-time charge we just assessed)
            ITransaction firstTransaction = transactions.First().Value;
            IRefund chargeRefund = chargify.CreateRefund(newSubscription.SubscriptionID, firstTransaction.ID, firstTransaction.AmountInCents, "Test Refund");

            if (chargeRefund != null)
            {
                Console.WriteLine("Refund was: " + (chargeRefund.Success ? "successful" : "unsuccessful"));
            }

            bool result = chargify.DeleteSubscription(newSubscription.SubscriptionID, "Testing Reactivation");
            if (result)
            {
                ISubscription reactivatedSubscription = chargify.ReactivateSubscription(newSubscription.SubscriptionID);
                if (reactivatedSubscription != null)
                {
                    Console.WriteLine("Reactivation succeeded!");
                }
                else
                {
                    Console.WriteLine("Reactivation failed with response: ", chargify.LastResponse.ToString());
                }

                // Currently a bug if you say "true" for the last two parameters. Being worked on.
                reactivatedSubscription = chargify.MigrateSubscriptionProduct(reactivatedSubscription.SubscriptionID, "ultimate", true, true);
                if (reactivatedSubscription != null)
                {
                    Console.WriteLine("Migration succeeded!");
                }
                else
                {

                }
            }
            else
            {
                Console.WriteLine("Cancellation failed with response: ", chargify.LastResponse.ToString());
            }

            //IDictionary<int, ITransaction> transactions = chargify.GetTransactionsForSubscription(newSubscription.SubscriptionID);
            //if ((transactions != null) && (transactions.Count > 0))
            //{
            //    foreach (ITransaction transaction in transactions.Values)
            //    {
            //        Console.WriteLine(string.Format("Date: {0}, Who: {1}, Type: {2}, Memo: {3}, Amount: {4}", transaction.CreatedAt, transaction.SubscriptionID, transaction.ProductID, transaction.Memo, transaction.Amount));
            //    }
            //}
        }
Ejemplo n.º 5
0
        public void DoSampleCode()
        {
            ChargifyConnect chargify = new ChargifyConnect();

            chargify.apiKey   = ConfigurationManager.AppSettings["CHARGIFY_API_KEY"];
            chargify.Password = ConfigurationManager.AppSettings["CHARGIFY_API_PASSWORD"];
            chargify.URL      = ConfigurationManager.AppSettings["CHARGIFY_URL"];

            // Create a new customer and a subscription for him
            ICustomerAttributes scottPilgrim = new CustomerAttributes("Scott", "Pilgrim", "*****@*****.**", "Chargify", Guid.NewGuid().ToString());

            ICreditCardAttributes scottsPaymentInfo = new CreditCardAttributes();

            scottsPaymentInfo.FirstName       = scottPilgrim.FirstName;
            scottsPaymentInfo.LastName        = scottPilgrim.LastName;
            scottsPaymentInfo.ExpirationMonth = 1;
            scottsPaymentInfo.ExpirationYear  = 2020;
            scottsPaymentInfo.FullNumber      = "1";
            scottsPaymentInfo.CVV             = "123";
            scottsPaymentInfo.BillingAddress  = "123 Main St.";
            scottsPaymentInfo.BillingCity     = "New York";
            scottsPaymentInfo.BillingCountry  = "US";
            scottsPaymentInfo.BillingState    = "New York";
            scottsPaymentInfo.BillingZip      = "10001";

            ISubscription newSubscription = chargify.CreateSubscription("basic", scottPilgrim, scottsPaymentInfo);

            if (newSubscription != null)
            {
                // subscription success.
                Console.WriteLine("Subscription succeeded.");
            }
            else
            {
                // subscription failure.
                Console.WriteLine("Update customer failed with response: ", chargify.LastResponse.ToString());
            }

            ICharge oneTimeChargeResults = chargify.CreateCharge(newSubscription.SubscriptionID, 123.45m, "Testing One-Time Charge");

            if (oneTimeChargeResults != null)
            {
                // one-time charge success.
                Console.WriteLine(string.Format("Charge succeeded: {0}", oneTimeChargeResults.Success.ToString()));
            }
            else
            {
                // one time charge failure.
                Console.WriteLine("One-time charge failed with response: ", chargify.LastResponse.ToString());
            }

            IDictionary <int, ITransaction> transactions = chargify.GetTransactionsForSubscription(newSubscription.SubscriptionID, new List <TransactionType>()
            {
                TransactionType.Payment
            });
            // Grab the last payment transaction, which we will refund (will be the one-time charge we just assessed)
            ITransaction firstTransaction = transactions.First().Value;
            IRefund      chargeRefund     = chargify.CreateRefund(newSubscription.SubscriptionID, firstTransaction.ID, firstTransaction.AmountInCents, "Test Refund");

            if (chargeRefund != null)
            {
                Console.WriteLine("Refund was: " + (chargeRefund.Success ? "successful" : "unsuccessful"));
            }

            bool result = chargify.DeleteSubscription(newSubscription.SubscriptionID, "Testing Reactivation");

            if (result)
            {
                ISubscription reactivatedSubscription = chargify.ReactivateSubscription(newSubscription.SubscriptionID);
                if (reactivatedSubscription != null)
                {
                    Console.WriteLine("Reactivation succeeded!");
                }
                else
                {
                    Console.WriteLine("Reactivation failed with response: ", chargify.LastResponse.ToString());
                }

                // Currently a bug if you say "true" for the last two parameters. Being worked on.
                reactivatedSubscription = chargify.MigrateSubscriptionProduct(reactivatedSubscription.SubscriptionID, "ultimate", true, true);
                if (reactivatedSubscription != null)
                {
                    Console.WriteLine("Migration succeeded!");
                }
                else
                {
                }
            }
            else
            {
                Console.WriteLine("Cancellation failed with response: ", chargify.LastResponse.ToString());
            }

            //IDictionary<int, ITransaction> transactions = chargify.GetTransactionsForSubscription(newSubscription.SubscriptionID);
            //if ((transactions != null) && (transactions.Count > 0))
            //{
            //    foreach (ITransaction transaction in transactions.Values)
            //    {
            //        Console.WriteLine(string.Format("Date: {0}, Who: {1}, Type: {2}, Memo: {3}, Amount: {4}", transaction.CreatedAt, transaction.SubscriptionID, transaction.ProductID, transaction.Memo, transaction.Amount));
            //    }
            //}
        }
Ejemplo n.º 6
0
        public bool PostOrder(int orderId)
        {
            bool  result    = false;
            Order orderItem = new OrderManager().GetBatchProcessOrder(orderId);


            orderItem.LoadAttributeValues();
            ChargifyConnect chargify = new ChargifyConnect();

            chargify.apiKey   = config.Attributes["APIKey"].Value;
            chargify.Password = config.Attributes["Password"].Value;
            chargify.URL      = config.Attributes["site"].Value;

            // Retrieve a list of all your products
            //IDictionary<int, IProduct> products = chargify.GetProductList();

            // Create a new customer
            ICustomer newCustomer = chargify.CreateCustomer(orderItem.CustomerInfo.ShippingAddress.FirstName, orderItem.CustomerInfo.ShippingAddress.LastName, orderItem.Email, "ConversionSystems", "CS_" + "DC_" + orderItem.OrderId.ToString());

            newCustomer.Email           = orderItem.Email;
            newCustomer.ShippingAddress = orderItem.CustomerInfo.ShippingAddress.Address1 + "," + orderItem.CustomerInfo.ShippingAddress.Address2;
            newCustomer.ShippingCity    = orderItem.CustomerInfo.ShippingAddress.City;
            newCustomer.ShippingCountry = orderItem.CustomerInfo.ShippingAddress.CountryCode;
            newCustomer.ShippingState   = orderItem.CustomerInfo.ShippingAddress.StateProvinceName;
            newCustomer.ShippingZip     = orderItem.CustomerInfo.ShippingAddress.ZipPostalCode;


            // Create a new customer and subscription
            //ICustomerAttributes charlie = new CustomerAttributes(orderItem.CustomerInfo.BillingAddress.FirstName, orderItem.CustomerInfo.BillingAddress.LastName, orderItem.Email, "", "CS_" + "DC_" + orderItem.OrderId.ToString());
            //charlie.ShippingAddress = orderItem.CustomerInfo.ShippingAddress.Address1 + "," + orderItem.CustomerInfo.ShippingAddress.Address2;
            //charlie.ShippingCity = orderItem.CustomerInfo.ShippingAddress.City;
            //charlie.ShippingCountry = orderItem.CustomerInfo.ShippingAddress.CountryCode;
            //charlie.ShippingState = orderItem.CustomerInfo.ShippingAddress.StateProvinceName;
            //charlie.ShippingZip = orderItem.CustomerInfo.ShippingAddress.ZipPostalCode;

            ICreditCardAttributes charliesPaymentInfo = new CreditCardAttributes();

            charliesPaymentInfo.FirstName       = orderItem.CustomerInfo.BillingAddress.FirstName;
            charliesPaymentInfo.LastName        = orderItem.CustomerInfo.BillingAddress.LastName;
            charliesPaymentInfo.ExpirationMonth = Convert.ToInt32(orderItem.CreditInfo.CreditCardExpired.ToString("MM"));
            charliesPaymentInfo.ExpirationYear  = Convert.ToInt32(orderItem.CreditInfo.CreditCardExpired.ToString("yyyy"));
            charliesPaymentInfo.FullNumber      = orderItem.CreditInfo.CreditCardNumber;
            charliesPaymentInfo.CVV             = orderItem.CreditInfo.CreditCardCSC;
            charliesPaymentInfo.BillingAddress  = orderItem.CustomerInfo.BillingAddress.Address1 + "," + orderItem.CustomerInfo.BillingAddress.Address2;
            charliesPaymentInfo.BillingCity     = orderItem.CustomerInfo.BillingAddress.City;
            charliesPaymentInfo.BillingCountry  = orderItem.CustomerInfo.BillingAddress.CountryCode;
            charliesPaymentInfo.BillingState    = orderItem.CustomerInfo.BillingAddress.StateProvinceName;
            charliesPaymentInfo.BillingZip      = orderItem.CustomerInfo.BillingAddress.ZipPostalCode;
            ISubscription newSubscription;
            Dictionary <string, AttributeValue> orderAttributes = new Dictionary <string, AttributeValue>();

            foreach (Sku Item in orderItem.SkuItems)
            {
                try
                {
                    newSubscription = chargify.CreateSubscription(Item.SkuCode.ToLower(), newCustomer.ChargifyID, charliesPaymentInfo);
                    if (newSubscription == null)
                    {
                        orderAttributes.Add("ChargifyCustomerId", new CSBusiness.Attributes.AttributeValue(newCustomer.ChargifyID.ToString()));
                        orderAttributes.Add("ChargifySubscriptionId", new CSBusiness.Attributes.AttributeValue(newSubscription.SubscriptionID.ToString()));
                        result = true;
                    }
                    else
                    {
                        result = false;
                    }
                }
                catch { }
            }

            if (result)
            {
                CSResolve.Resolve <IOrderService>().UpdateOrderAttributes(orderId, orderAttributes, 2);
            }
            else
            {
                CSResolve.Resolve <IOrderService>().UpdateOrderAttributes(orderId, orderAttributes, 7);
            }

            return(result);
        }
Ejemplo n.º 7
0
        public static bool RegisterCreditCard(ChargifyConnect chargify, Guid OrgId, Guid InstId, string OrgName, string InstName, string UserEmail, string UserFirstName, string UserLastName, string CardNumber, string CardExprMonth, string CardExprYear, int GraceDays, out string errorMessage)
        {
            errorMessage = string.Empty;
            string _CustSystemId = OrgId.ToString() + "," + InstId.ToString();

            ICustomer     _cust   = chargify.LoadCustomer(_CustSystemId);
            ISubscription _subscr = null;

            try
            {
                if (_cust == null)
                {
                    errorMessage       = "Can't create Chargify Customer!";
                    _cust              = new Customer();
                    _cust.SystemID     = _CustSystemId;
                    _cust.Organization = OrgName + " " + InstName;
                    _cust.Email        = UserEmail;
                    _cust.FirstName    = UserFirstName;
                    _cust.LastName     = UserLastName;
                    _cust              = chargify.CreateCustomer(_cust);
                }
                else if (_cust.Organization != OrgName + " " + InstName || _cust.Email != UserEmail || _cust.FirstName != UserFirstName || _cust.LastName != UserLastName)
                {
                    errorMessage       = "Can't update Chargify Customer!";
                    _cust.Organization = OrgName + " " + InstName;
                    _cust.Email        = UserEmail;
                    _cust.FirstName    = UserFirstName;
                    _cust.LastName     = UserLastName;
                    _cust        = chargify.UpdateCustomer(_cust);
                    errorMessage = "Can't get Chargify Customer Substriction!";
                    _subscr      = ChargifyProvider.GetCustomerSubscription(chargify, _cust.ChargifyID);
                }
                else
                {
                    errorMessage = "Can't get Chargify Customer Substriction!";
                    _subscr      = ChargifyProvider.GetCustomerSubscription(chargify, _cust.ChargifyID);
                }
            }
            catch (ChargifyException cex)
            {
                if ((int)cex.StatusCode != 422)
                {
                    errorMessage += " " + cex.Message;
                }
                return(false);
            }
            catch (Exception ex)
            {
                errorMessage += " " + ex.Message;
                return(false);
            }

            errorMessage = string.Empty;

            if (CardNumber.Contains("XXXX"))
            {
                if (_subscr != null && _subscr.CreditCard != null && _subscr.State != SubscriptionState.Active)
                {
                    try
                    {
                        chargify.ReactivateSubscription(_subscr.SubscriptionID);
                    }
                    catch (Exception ex)
                    {
                        errorMessage = "Can't reactivate Customer Subscription! " + ex.Message;
                        return(false);
                    }
                    return(true);
                }
                errorMessage = "Invalid Credit Card Information!";
                return(false);
            }

            CreditCardAttributes _ccattr = new CreditCardAttributes(_cust.FirstName, _cust.LastName, CardNumber, 2000 + int.Parse(CardExprYear), int.Parse(CardExprMonth), string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty);

            try
            {
                if (_subscr == null)
                {
                    errorMessage = "Can't create Chargify Subscription!";
                    _subscr      = chargify.CreateSubscription(ChargifyProvider.GetProductHandle(), _cust.ChargifyID, _ccattr);
                    chargify.UpdateBillingDateForSubscription(_subscr.SubscriptionID, DateTime.UtcNow.AddDays(GraceDays));
                }
                else
                {
                    errorMessage = "Can't update Chargify Subscription!";
                    chargify.UpdateSubscriptionCreditCard(_subscr, _ccattr);
                    if (_subscr.State != SubscriptionState.Active)
                    {
                        chargify.ReactivateSubscription(_subscr.SubscriptionID);
                    }
                }
            }
            catch (ChargifyException cex)
            {
                if ((int)cex.StatusCode == 422)
                {
                    errorMessage += " Invalid Credit Card Information!";
                }
                else
                {
                    errorMessage += " " + cex.Message;
                }
                return(false);
            }
            catch (Exception ex)
            {
                errorMessage += " " + ex.Message;
                return(false);
            }

            errorMessage = string.Empty;
            return(true);
        }