#JCrags-tax

1 messages ยท Page 1 of 1 (latest)

inland jackal
#

why not just use the upcoming invoice endpoint? I don't see why you have to actually create a draft invoice.

frail tundra
#

An invoice might not exist for the customer yet

#

You can't create an invoice without having line items, and you require the invoice to with items to retrieve the tax_rate (percentage)

frail tundra
#

Without it Stripe doesn't create an "Tax Rate" item.

inland jackal
#

fair enough! In any case our answer here is to use Checkout or Invoices for the payment directly, the workaround you suggest here to "get" the details of the tax we would automatically apply and then separately apply it to a one-off PaymentIntent seems like it works but it's not something we'd officially support or consider.

frail tundra
#

Let's asume I would call this:

#
params := &stripe.InvoiceParams{
  Customer: stripe.String("cus_L77dLKb0SIUWOh"),
}
in, _ := invoice.GetNext(params)
#

would this return me with a "Tax Rate" ID or object too? Because all I need to get is the "tax percentage" on the front-end, with only the customer being logged in. The customer might not even purchase anything really. Only need to display good prices/tax rates based on the logged in user.

#

The point here is that I believe there is no tax automatically calculated by Stripe unless you add a line item to an invoice. But correct me if I am wrong about that.

inland jackal
#

I'm pretty sure you can use the upcoming invoice endpoint in the way I mentioned, the preview invoice returned should calculate tax. If it doesn't then creating a draft invoice + deleting it kind of works but I would investigate if the upcoming invoice endpoints works for you needs

#

to be clear, you can pass items to that endpoint to see what a hypothetical invoice would be, which really feels like your use case

frail tundra
#

Thanks, I will give this endpoint a try and see if it works too. ๐Ÿ™‚

#

Hmm I wish I knew about this sooner. I just tested it and it works perfectly fine. Thanks for this suggestion ๐Ÿ˜„