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

Dynamic Tax Rates for Subscriptions #1653

Closed
ybert opened this issue Feb 21, 2024 · 4 comments
Closed

Dynamic Tax Rates for Subscriptions #1653

ybert opened this issue Feb 21, 2024 · 4 comments

Comments

@ybert
Copy link
Contributor

ybert commented Feb 21, 2024

As mentioned here : https://docs.stripe.com/billing/taxes/collect-taxes?tax-calculation=tax-rates

One strategy to calculate taxes if we don't have information about the customer location and if we don't want to use Stripe Tax and its additional cost is to use dynamic_tax_rates for each line item of the subscription.

The actual API of Cashier does not permit it :

       $user
            ->newSubscription('default',   ['price_yearly'])
            ->allowPromotionCodes()
            ->checkout([
                'billing_address_collection' => 'required',
                'success_url' => I18nWebUrlHelper::getUrl('stripe_checkout_success'),
                'cancel_url' => I18nWebUrlHelper::getUrl('stripe_checkout_cancel'),
            ], [
                'preferred_locales' => [$user->preferredLocale()],
            ]);

It could be great if we can do :

        $user
            ->newSubscription('default',   [
                [
                    'price'  => 'price_yearly',
                    'quantity' => 1,
                    'dynamic_tax_rates'  => [ 'txr_be', 'txr_fr', 'txr_uk', 'txr_de']
                ]
            ])
            ->allowPromotionCodes()
            ->checkout([
                'billing_address_collection' => 'required',
                'success_url' => I18nWebUrlHelper::getUrl('stripe_checkout_success'),
                'cancel_url' => I18nWebUrlHelper::getUrl('stripe_checkout_cancel'),
            ], [
                'preferred_locales' => [$user->preferredLocale()],
            ]);

We can already do this for the one time purchase checkout.

@driesvints
Copy link
Member

driesvints commented Feb 22, 2024

I don't see a mention of dynamic_tax_rates on the page you linked to or can find it in the Stripe API docs. Could you clarify?

@ybert
Copy link
Contributor Author

ybert commented Feb 22, 2024

@driesvints
Copy link
Member

@ybert are you sure you cannot already do what you want to do? Judging from the code this already seems possible to me.

@ybert
Copy link
Contributor Author

ybert commented Feb 22, 2024

Ok, it seems that I have something on my side that does not work properly.
I think you-re right and it is already possible

Thanks for the help.

@ybert ybert closed this as completed Feb 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants