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

Bug 1585 - Tax ID collection requires updating business name on the customer #1586

Merged
merged 2 commits into from
Oct 25, 2023

Conversation

stevebauman
Copy link
Contributor

@stevebauman stevebauman commented Oct 25, 2023

Closes #1585

This PR resolves an issue that appears to have been introduced from a Stripe 2023-10-16 API update, where only the existence of the tax_id_collection.enabled parameter requires the addition of the customer_update parameters, rather than being able to set it to false as it was previously, resulting in the exception:

Stripe\Exception\InvalidRequestException

Tax ID collection requires updating business name on the customer. To enable tax ID collection for an existing customer, please set `customer_update[name]` to `auto`.

The tax_id_collection collection parameter will now be completely omitted when auto-calculation of taxes is disabled.

@@ -85,7 +85,7 @@ public static function create($owner, array $sessionOptions = [], array $custome
}

// Make sure to collect address and name when Tax ID collection is enabled...
if (isset($data['customer']) && $data['tax_id_collection']['enabled'] ?? false) {
if (isset($data['customer']) && ($data['tax_id_collection']['enabled'] ?? false)) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discovered that this condition previously didn't evaluate correctly without parenthesis, as the null coalescing operator ?? has a lower precedence than the && operator, so the condition is equivalent to:

(isset($data['customer']) && $data['tax_id_collection']['enabled']) ?? false

This was referenced Oct 25, 2023
@taylorotwell taylorotwell merged commit 297d2f0 into laravel:14.x Oct 25, 2023
8 checks passed
@driesvints
Copy link
Member

Thanks @stevebauman!

@maskeynihal
Copy link

Thanks @stevebauman for the fix.

@novaylt123
Copy link

This should've been in an announcement. I wasn't aware some of my projects were broken on Stripe side of things.
But thanks for the fix team.

@driesvints
Copy link
Member

driesvints commented Oct 26, 2023

@novaylt123 I still need to do a more thorough investigation but I'm not sure why things suddenly broke at all. Cashier right now doesn't supports 2023-10-16 as it's pinned to 2022-11-15: https://github.com/laravel/cashier-stripe/blob/14.x/src/Cashier.php#L28

So I want to know why and how this API update affects Cashier at all.

@driesvints
Copy link
Member

So Stripe got back to me and confirmed this was a breaking change in test mode only as they were trying some things out. Nothing got broken in production and they've reverted the change since.

@stevebauman
Copy link
Contributor Author

Thanks for getting to the bottom of it @driesvints! 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tax ID collection requires updating business name on the customer.
5 participants