#Allan (EN-GB)-taxrates

1 messages · Page 1 of 1 (latest)

full dagger
#

@main vector could you share the sub_xxx you're working with? I expect that passing a new array replaces the old rate too and it works that way when I tested so I'd like to see your example.

    customer: customer.id,
    default_payment_method : pm.id,
    items: [
        {
            plan: "plan_DQYe83yUGgx1LE",
        },
    ],
    expand : ["latest_invoice"],
    default_tax_rates:["txr_1FAIYjJoUivz182DQxeoiySi"] // 8%
}); 
await stripe.subscriptions.update(subscription.id, {
   default_tax_rates:["txr_1D4tgRJoUivz182D8rc9JwQ4"] // 42%
})
main vector
#

Oh, right. Interesting.
The sub I'm working with is: sub_1Jezx0FeaQNDDEj5wD11yRB7

#

I wonder if it's a currency thing. It'll only replace the one of the same code?
I've just noticed, I'm creating a new french tax rate each time I test this and it's replacing the FR one but leaving the GB one in place.

full dagger
#

oh it's because you set a rate at the item level when creating the subscription

main vector
#

Ahhh

subscription = await this.stripe.subscriptions.create({
        customer: customer.id,
        items: [{
          price: planPrice.id,
          tax_rates: [taxRate.id]
        }]
      })
#

Yes, I am.

#

Needs to be a level up I guess.

full dagger
#

so that persists unless you explicitly replace it on that item with update(sub,id, {items:[id:item.id, tax_rates:[...]]})

main vector
#

Changed the sub creation to:

subscription = await this.stripe.subscriptions.create({
        customer: customer.id,
        default_tax_rates: [taxRate.id],
        items: [{
          price: planPrice.id
        }]
      })
#

That should sort it too I think.

Thanks very much for your speedy response 🙂

full dagger
#

no worries

main vector
#

Confirmed. Works perfectly. Thanks again.