#King Of Web Devs-Taxes
1 messages ยท Page 1 of 1 (latest)
hi tarzan
i am using laravel stripe
but i need a way to manually apply VAT on a checkout instance
this auto tax thing is abysmal
you could use the https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-line_items-tax_rates
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
do i need to set that tax rate on each individual product (line item) or can i set it globally for that checkout instance?
are you creating Checkout for subscriptions or one-off payments?
one off payments
subscriptions is fine as that pulls the taxrate via cashier
this is the code currently
in one-offs you have to pass the tax by line item unfortunately
if($currency == 'GBP'){
return $user
->allowPromotionCodes()
->checkout($OneTime, [
'automatic_tax' => [
'enabled' => true,
],
'success_url' => route('upgrade-checkout-complete') . '?session_id={CHECKOUT_SESSION_ID}',
'cancel_url' => route('upgrade-product-select'),
]);
} else {
return $user
->allowPromotionCodes()
->checkout($OneTime, [
'automatic_tax' => [
'enabled' => false,
],
'success_url' => route('upgrade-checkout-complete') . '?session_id={CHECKOUT_SESSION_ID}',
'cancel_url' => route('upgrade-product-select'),
]);
}
so i need to pass the tax with each product?
yes ๐
thanks