Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[9.0] Do not update card in createAsStripeCustomer method #588

Merged
merged 1 commit into from Dec 12, 2018

Conversation

@driesvints
Copy link
Member

commented Dec 11, 2018

At the moment when using the createAsStripeCustomer method on a Billable entity, it could be that the creation of the customer succeeds but the updating of the card fails. When this happens it's impossible to know which customer was created in Stripe and therefor also impossible to remove this record again when the card update fails.

It seems that the updateCard method shouldn't be in the createAsStripeCustomer method as this couples these two API calls too much. If we remove the call from the createAsStripeCustomer method it can be used just for the purpose that it states. This will always return a Customer object and allow the developer to remove it again if the updateCard method after that fails.

This is a breaking change which will require developers to call the updateCard method manually after they call createAsStripeCustomer. I've already adjusted the behavior of the getStripeCustomer call in the SubscriptionBuilder so there's no breaking changes there.

You might notice that at the moment the same problem exists for the getStripeCustomer call but at least with these changes the developers have full control to first create the customer and then do a try/catch check around the updateCard method and revert the customer creation if they want.

This will require changes to the docs as well which I'll send in as soon as this PR is merged.

Fixes #575

Do not update card in createAsStripeCustomer method
At the moment when using the createAsStripeCustomer method on a Billable entity, it could be that the creation of the customer succeeds but the updating of the card fails. When this happens it's impossible to know which customer was created in Stripe and therefor also impossible to remove this record again when the card update fails.

It seems that the updateCard method shouldn't be in the createAsStripeCustomer method as this couples these two API calls too much. If we remove the call from the createAsStripeCustomer method it can be used just for the purpose that it's states. This will always return a Customer object and allow the developer to remove it again if the updateCard method after that fails.

This is a breaking change which will require developers to call the updateCard method manually after call the createAsStripeCustomer. I've already adjusted the behavior of the getStripeCustomer call in the SubscriptionBuilder so there's no breaking changes there.

You might notice that at the moment the same problem exists for the getStripeCustomer call but at least with these changes the developers have full control to first create the customer and then do a try/catch check around the updateCard method and revert the customer creation if they want.

This will require changes to the docs as well which I'll send in as soon as this PR is merged.

Fixes #575

@driesvints driesvints force-pushed the update-customer-methods branch from 6d25e2a to 0a0af7c Dec 11, 2018

@taylorotwell taylorotwell merged commit 2089f97 into master Dec 12, 2018

3 checks passed

continuous-integration/styleci/pr The analysis has passed
Details
continuous-integration/styleci/push The analysis has passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details

@driesvints driesvints deleted the update-customer-methods branch Dec 12, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.