#MarkoBoras
1 messages ยท Page 1 of 1 (latest)
Hi there!
Can you share the ID (req_xxx) of the failing API request?
https://support.stripe.com/questions/finding-the-id-for-an-api-request
sec
req_WesncJhkxXSrsQ
req_KKp0JtHVfIw6mP
and this one
I am trying to remove predefined tax rate and set subscription again on automatic tax
So you want to migrate a Subscription from a manual tax rates to an Stripe (automatic) tax ?
yeah
why am I doing this?
- I have issue with:
- physical non-eu 25% tax rate
- legal non-eu 0% tax rate
When user is first subscribed he is physical person and that's why I set 25% tax rate.
When user sets his VAT ID I need to set automatic tax again which will set his tax rate to 0.
I am from Croatia btw, that's why I am doing this
I am doing this only to non-eu users
When user sets his VAT ID I need to set automatic tax again which will set his tax rate to 0.
You should create the Subscription from the beginning to use automatic tax or use tax rates. For each Subscription item you have a tax rated attached to ittxr_1NQ3D6GeBYlVs2NBRq6i0wuQ. You need to remove it before using automatic tax
How can I remove attached tax rate from subscription before I enable again automatic tax
Checking if that's possible without creating a new Subscription
Try updating the items' tax_rates with an empty array:
https://stripe.com/docs/api/subscriptions/update#update_subscription-items-tax_rates
await stripe.subscriptions.update(subscription.id, {
items: [
{
tax_rates: [],
},
],
});
ok
I am redeploying my webhook just a sec
await stripe.subscriptions.update(subscription.id, {
items: [
{
price: subscription.items.data[0].price.id,
tax_rates: [],
id: subscription.items.data[0].id,
},
],
});
like this?
Try that yes
kk
tnx
I'll let you know
nothing has happened but I think I made mistake
I didn't set automatix tax in request
const subscriptionItems = subscription.items.data;
console.log('subscriptionItems', subscriptionItems);
await stripe.subscriptions.update(subscription.id, {
automatic_tax: { enabled: true },
items: [
{
price: subscription.items.data[0].price.id,
tax_rates: [],
id: subscription.items.data[0].id,
},
],
});
I'll log also subscriptionItems to check
But I think every user with customer portal has only 1 active subscription currently
Hi there ๐ jumping in as my teammate needs to step away soon. Can you try passing an empty string as mentioned here to try unsetting the current tax rates?
https://stripe.com/docs/api/subscriptions/update#update_subscription-default_tax_rates
await stripe.subscriptions.update(subscription.id, {
items: [
{
price: subscription.items.data[0].price.id,
tax_rates: [''],
},
],
});
like this?
or no
on default tax rate
I think just the empty string, not wrapped in an array. Not entirely sure if that works in the node library you're using, so let me know if it doesn't.
await stripe.subscriptions.update(subscription.id, {
default_tax_rates: [''],
});
like this?
Which field are you trying to unset? That's the one you should pass an empty string to.
Currently you have [''], but I think you'll want to not wrap the empty string in an array, so like this instead ''
req_1MSPphIWB2fVBy
I am trying to achieve this
I want to remove manual tax rate from that user for all other purchases that I've created
const lineItem = !isEuropeanUnionUser
? {
price: priceId,
quantity: 1,
tax_rates: [NON_EU_TAX_RATE],
}
: {
price: priceId,
quantity: 1,
};
/** Create a subscription with the price plan */
const subscription = await stripe.subscriptions.create({
customer: customerId,
automatic_tax: { enabled: isEuropeanUnionUser ? true : false },
proration_behavior: 'always_invoice',
items: [lineItem],
});
I'll try now just with empty string and remove ['']
do you understand my issue because it is frustrating
I need to charge non-eu physical persons 25% tax rate and companies 0%
That's why I am trying to set automatic tax which will set 0% when user enters valid VAT ID in customer portal
Ok this works
req_7cTw6IctBTKKdu
Now for free plan his vat is 0%
But when he tries to use some another plan (Plus), he still has 25% tax rate
I need to update all of items?
or I can do this?
await stripe.subscriptions.update(subscription.id, {
default_tax_rates: '',
automatic_tax: { enabled: true },
});
But when he tries to use some another plan (Plus), he still has 25% tax rate
What does this mean, can you provide references to related objects so I can take a closer look at what you're referring to?
sec
/** Create a subscription with the price plan */
const subscription = await stripe.subscriptions.create({
customer: customerId,
automatic_tax: { enabled: false },
proration_behavior: 'always_invoice',
items: [
{
price: priceId,
quantity: 1,
tax_rates: [NON_EU_TAX_RATE],
},
],
});
I've done this when he registered on my site and this is my solution for physical persons (regular customers)
I am trying to undo this when he sets his VAT ID in customer portal
For the Subscription you're working with, your recent request set the default_tax_rates on the Subscription to nothing, but it doesn't look like that is where the Tax Rates had been set previously. When you created the Subscription the Tax Rates where provided in items.tax_rates. So you will need to unset it at the item level.
ok I've done that once but it was only applied to my FREE plan
but on PLUS plan he still had 25%
I need to apply that to all my available plans?
Are you talking about all of the Subscription Items that are included in the Subscription (I'm a little confused as I only see one Subscription Line Item in this Subscription)?
Because he is currently subscribed only to the free plan and that's why there is only one line item
but I want to apply that change to all his future transactions
but I think I've found solution
it has set tax to 0
now I am trying to remove that when he delets TAX ID
await stripe.customers.update(customer, {
tax_exempt: 'reverse',
});
Reverse: Reverse tax exemption is applicable in certain scenarios, typically in business-to-business (B2B) transactions. It means that the responsibility for paying taxes is shifted from the seller to the buyer. Instead of the seller charging and collecting taxes from the buyer, the buyer self-assesses and remits the taxes directly to the tax authorities.
This is what I need
if he has valid VAT ID from non-eu I need to set reverse tax exemption
when he delets TAX ID I will do
await stripe.customers.update(customer, {
tax_exempt: 'none',
});
to have again 25% default tax rate
I'll try that now
dude it works
Sweet!
do you understand now my issue
sorry for spamming
but as I told you:
- B2C 25%
- B2B 0%
I don't, you were asking about unsetting Tax Rates, now you're doing something else about changing the tax exemption status on the Customer, I've not been able to follow the challenge or what your questions were.
sorry
All good! Am I right in understanding that what you tried is now working as you'd like it to, or are their remaining questions/concerns?
๐ sounds good
tnx