You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I do not know if I am doing anything wrong, but I can not get tax to work on subscriptions (checkout) without changing the package.
With the original code i get this error: Received unknown parameter: default_tax_rates
But if i follow stripe docs and change the package to include the default_tax_rates in subscription_data it works perfectly.
// SubscriptionBuilder.phppublicfunctioncheckout(array$sessionOptions = [], array$customerOptions = [])
{
if (! $this->skipTrial && $this->trialExpires) {
// Checkout Sessions are active for 24 hours after their creation and within that time frame the customer// can complete the payment at any time. Stripe requires the trial end at least 48 hours in the future// so that there is still at least a one day trial if your customer pays at the end of the 24 hours.$minimumTrialPeriod = Carbon::now()->addHours(48);
$trialEnd = $this->trialExpires->gt($minimumTrialPeriod) ? $this->trialExpires : $minimumTrialPeriod;
} else {
$trialEnd = null;
}
returnCheckout::create($this->owner, array_merge([
'mode' => 'subscription',
'line_items' => collect($this->items)->values()->all(),
'allow_promotion_codes' => $this->allowPromotionCodes,
'discounts' => [
'coupon' => $this->coupon,
],
// 'default_tax_rates' => $this->getTaxRatesForPayload(), <---- Remove this, causing Received unknown parameter: default_tax_rates'subscription_data' => [
'default_tax_rates' => $this->getTaxRatesForPayload(), // <---- add this referring to the docs https://stripe.com/docs/billing/subscriptions/taxes#adding-tax-rates-to-checkout'trial_end' => $trialEnd ? $trialEnd->getTimestamp() : null,
'metadata' => array_merge($this->metadata, ['name' => $this->name]),
],
], $sessionOptions), $customerOptions);
}
Description:
I do not know if I am doing anything wrong, but I can not get tax to work on subscriptions (checkout) without changing the package.
With the original code i get this error:
Received unknown parameter: default_tax_rates
But if i follow stripe docs and change the package to include the
default_tax_rates
insubscription_data
it works perfectly.Alternative solution
taxRates()
from your 'billable' modelThe text was updated successfully, but these errors were encountered: