#Nyxi
1 messages · Page 1 of 1 (latest)
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?
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
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.
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?
Yes I am, sorry just getting back to this. I thought you could still do that.
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?
Great
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
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
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