Error when using CustomerAttributes to create a subscription

Oct 18, 2012 at 3:13 PM
Edited Oct 18, 2012 at 3:14 PM

When I try to create a subscription using the CustomerAttributes is fails.  But if I try to create a customer first and then a subscription using the customer (using the EXACT same info) it works.

Fails:

 

 ICustomerAttributes customer = new CustomerAttributes(model.Agent.FirstName, model.Agent.LastName, model.Agent.Email, "", Guid.NewGuid().ToString());
            customer.ShippingAddress = model.Agent.Address.Line1 + " " + model.Agent.Address.Line2;
            customer.ShippingCity = model.Agent.Address.City;
            customer.ShippingCountry = "United States";
            customer.ShippingState = "ND";
            customer.ShippingZip = model.Agent.Address.ZipCode;

            ICreditCardAttributes paymentInfo = new CreditCardAttributes();
            paymentInfo.FirstName = customer.FirstName;
            paymentInfo.LastName = customer.LastName;
            paymentInfo.ExpirationMonth = Convert.ToInt32(model.ExpireMonth);
            paymentInfo.ExpirationYear = Convert.ToInt32(model.ExpireYear);
            paymentInfo.FullNumber = model.CardNumber;
            paymentInfo.CVV = model.Cvv;
            paymentInfo.BillingAddress = customer.ShippingAddress;
            paymentInfo.BillingCity = customer.ShippingCity;
            paymentInfo.BillingCountry = customer.ShippingCountry;
            paymentInfo.BillingState = customer.ShippingState;
            paymentInfo.BillingZip = customer.ShippingZip;

ISubscription newSubscription = chargify.CreateSubscription("premium", customer, paymentInfo);

 

Succeeds:

 

 ICustomer customer = new Customer(model.Agent.FirstName, model.Agent.LastName, model.Agent.Email, "", Guid.NewGuid().ToString());
            customer.ShippingAddress = model.Agent.Address.Line1 + " " + model.Agent.Address.Line2;
            customer.ShippingCity = model.Agent.Address.City;
            customer.ShippingCountry = "United States";
            customer.ShippingState = "ND";
            customer.ShippingZip = model.Agent.Address.ZipCode;

            ICreditCardAttributes paymentInfo = new CreditCardAttributes();
            paymentInfo.FirstName = customer.FirstName;
            paymentInfo.LastName = customer.LastName;
            paymentInfo.ExpirationMonth = Convert.ToInt32(model.ExpireMonth);
            paymentInfo.ExpirationYear = Convert.ToInt32(model.ExpireYear);
            paymentInfo.FullNumber = model.CardNumber;
            paymentInfo.CVV = model.Cvv;
            paymentInfo.BillingAddress = customer.ShippingAddress;
            paymentInfo.BillingCity = customer.ShippingCity;
            paymentInfo.BillingCountry = customer.ShippingCountry;
            paymentInfo.BillingState = customer.ShippingState;
            paymentInfo.BillingZip = customer.ShippingZip;

ICustomer newCustomer = chargify.CreateCustomer(customer);
ISubscription newSubscription = chargify.CreateSubscription("premium", newCustomer, paymentInfo);

 

The problem I have here is that I don't want to create a new customer in Chargify if the subscription fails, for instance due to a bad credit card.  And we currently can't delete a customer via the APIs, so I can't go back in and clean up in the case of failure.

Thoughts?  I really don't have the time to make my own webservice call, but I guess I can if I need to.

Coordinator
Dec 18, 2012 at 3:28 PM

The first method should work. What's the error coming back?

Dec 18, 2012 at 3:38 PM
I believe this issue was already fixed in a previous ticket.

Paul Bourdeaux

Director of Mobile Strategy


e. pbourdeaux@sycorr.com

p. 701.212.1155 ext. 7003
m.
701.261.5559

w. sycorr.com




On Tue, Dec 18, 2012 at 10:28 AM, djbyter <notifications@codeplex.com> wrote:

From: djbyter

The first method should work. What's the error coming back?

Read the full discussion online.

To add a post to this discussion, reply to this email (chargify@discussions.codeplex.com)

To start a new discussion for this project, email chargify@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on CodePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at CodePlex.com


Coordinator
Dec 18, 2012 at 3:41 PM

Oh! Hey Paul! :)

I was just going through the discussions in case I missed anything.