Hi Rares,
When you "retrieve" an upcoming invoice, you are getting a preview
into what the invoice will look like when it is created at the end of
the billing period. However, the invoice that you're looking at does
not yet exist -- it's just a preview -- so there's no ID for it, and
it cannot be closed.
If you would like to close an invoice before it is billed, I would
recommend listening to our `invoice.created` webhook and closing the
invoice off of that. We wait one hour between successful delivery of
the `invoice.created` webhook and our first payment attempt on the
invoice. We do that for this exact reason -- so that people can
implement any custom logic they want including adding items to
invoices, or closing them before payment is attempted.
Hope this helps, though sorry for the trouble here.
Best,
Jim
> --
> You received this message because you are subscribed to the Google Groups
> "Stripe API Discussion" group.
> To post to this group, send email to
api-d...@lists.stripe.com.
> Visit this group at
>
http://groups.google.com/a/lists.stripe.com/group/api-discuss/.
>
> To unsubscribe from this group and stop receiving emails from it, send an
> email to
api-discuss...@lists.stripe.com.