I'd create a database table for all your invoices. Then use webhooks to be notified of events and watch for invoice.created
events. Store the invoice details in your database table, and you can internally use the automatically incremented primary key as your invoice ID, which will be in chronological order.
Cheers, Larry
PS I work on Support at Stripe.