#alejandro-g_docs

1 messages · Page 1 of 1 (latest)

north cometBOT
#

👋 Welcome to your new thread!

⏲️ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

🔗 This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1324444107220844544

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

severe wing
#

Hi 👋

This preview API is a tool you can use to generate a preview of the API responses. However, it does not currently support passing in the manual taxes per line item.

How are you presenting the data to your customers? If you have the preview Invoice as well as the custom tax amounts, couldn't you use that data in a custom view for your customers?

north cometBOT
surreal geode
#

Hi 👋

Thank you for the clarification.

Currently, we pass the taxes as line_items for both preview and draft invoices. However, we’re updating our process to use the tax_amounts option instead. While this works fine for draft invoices, we were hoping it would function similarly for preview invoices as well.

Is there any possibility for this to be supported in the future?

Thanks again for your help!

severe wing
#

Have you tested passing your tax amounts as their own line items?

surreal geode
#

yeah that's what we do right now. We pass the taxes as their own line_items for both preview and draft invoices

severe wing
#

And does that not work?

surreal geode
#

It works, but it has its limitations—for example, the subtotal before tax and the total appear identical, so that is why we are updating to use the tax amounts instead, as this will generate the invoice properly with taxes separated from line items

severe wing
#

How are you presenting the data to your customers? Could you do that math yourself in your integration?

surreal geode
#

We can implement a few workarounds, but we were hoping to leverage the tax_amounts functionality directly for a cleaner solution.
Any chance tax_amounts will be supported for preview invoices in the future?

broken wagon
#

Hi there 👋 jumping in as my teammate needs to step away soon. Can you tell me more about what steps you're trying to to take with these preview invoices that isn't working as you're expecting?

Are you creating the Preview Invoice, and then trying to make a request to update its Invoice Line Items? If so, can you share examples of those requests so I can take a closer look at the behavior you're seeing?

surreal geode
#

so here is an example of the payload I was trying to pass to Stripe::Invoice.upcoming
{
:customer=>nil,
:discounts=>nil,
:invoice_items=>[], │
:subscription_details=>
{
:proration_behavior=>"none",
:billing_cycle_anchor=>"now",
:items=> [
{:plan=>"plan_mame_1", :discounts=>"", :quantity=>5, :tax_amounts=>[{:amount=>2500, :inclusive=>false}]},
{:plan=>"plan_name_2", :discounts=>"", :quantity=>5, :tax_amounts=>[{:amount=>1500, :inclusive=>false}]}
]
},
:expand=>["lines.data.discounts", "lines.data.discount_amounts.discount"]
}

And that would give me:
Stripe::InvalidRequestError: Received unknown parameter: subscription_details[items][0][tax_amounts]. Did you mean tax_rates?

broken wagon
#

Sorry, let's take a step back.

Are you retrieving an upcoming Invoice, as you show in your code:
https://docs.stripe.com/api/invoices/upcoming

Or are you creating a preview Invoice like you linked to in your initial message:
https://docs.stripe.com/api/invoices/create_preview

Looking at the guide you shared, I'm not surprised that this doesn't work with the upcoming invoice endpoint, as you seem to need to generate Invoice Line Items and then update those.

I think this might work with the preview invoice endpoint you referenced initially, since that creates an Invoice object and by extension Invoice Line Items that I think you may be able to update. I'm not entirely sure on that though, I have not tried to combine those approaches before.

surreal geode
#

oh my bad I was just testing and playing with upcoming, create_preview will return the same message Stripe::InvalidRequestError: Received unknown parameter: subscription_details[items][0][tax_amounts]. Did you mean tax_rates?

broken wagon
#

Yes, that also seems expected during the creation request, as that doesn't align with the instructions in the guide that you shared and the creation endpoint doesn't support the parameters you're trying to use.

The server is getting busy, so I don't have a chance to step through this flow to test it right this second, but I would suggest trying the following.

That's the approach that seems to best align with the instructions provided in the guide:
https://docs.stripe.com/invoicing/taxes/manual-tax-amounts#update-invoice-with-tax-amounts

I'm still not certain this will work as you're hoping, but I do believe this approach is the only chance at having it work.

north cometBOT
surreal geode
#

Thanks for your help Toby! I'll give it a try. bye!