#Nyxi

1 messages · Page 1 of 1 (latest)

slender flintBOT
gentle ice
#

Ah, it's for 0 euro. That's why. Never mind. Due to changed behavior of pending_invoice_items_behavior.
Nice solve. Anything else you are looking in to at the moment?

chilly coral
#

No thank you. But you probably should have defaulted the behavior to include instead of exclude? Would have avoided this breaking change

#

I'm sure there's a reason why you didn't though

#

Seems I can invert the flow now though and create the invoice first, then add the items to it

gentle ice
#

I don't know the decision behind this one specifically but I think in general when we create a new API version, we do it to introduce breaking changes, so we also use that as a time to switch the default behaviors to things we think make more sense.

Personally I also agree it is a bit weird, especially because we forgot to update some sample code so a couple docs broke 😬 . But like you said I'm sure there is a reason.

chilly coral
#

Alright

#

Thanks

#

Is it true that I could not do invoice first, then add item previously?

#

Because my current code creates invoice items first, then an invoice after that's supposed to "capture pending invoice items" which just doesn't make any sense if I can just create a blank invoice and then add invoice items to it directly

#

All it does is introduce the ability to capture a wrong invoice item

#

I think I used to get a "no pending invoice items" error if I tried that

#

@gentle ice You still here?

gentle ice
#

Yes I am, sorry just getting back to this. I thought you could still do that.

chilly coral
#

I'm fairly certain I could not, because I would never have written the code this way if I could

#

But just to clarify; I can do this now?

gentle ice
#

Oh whoops I completely misread that question.

#

But yes, you can do that now

chilly coral
#

Great

gentle ice
#

That is the recommended path to create the invoice first then add the items. I am bouncing around a couple threads but will check in to how that worked before in a bit

chilly coral
#

I'll rewrite this code as I make the API change

#

Yeah that makes a lot more sense also, I'm just 90% sure I would get a "no pending invoice items" back when I tried to do this

gentle ice
#

So we added pending_invoice_items_behavior in March. That was an addative change so you can use it in previous API versions. We just didn't change the default behavior until now.

So you are right, your exact same code would have errored back then. But if you specified pending_invoice_items_behavior=exclude you would have been able to create an empty invoice.
https://stripe.com/docs/changelog#march-1,-2022

chilly coral
#

Yeah this was before march 2022

#

So that's why