Usage of the order id and tokenValue for some after checkout completion actions

Hi everybody,

I would like to generate some custom PDF after the checkout complete step and have implemented some custom service and controller for this. For generating this PDF I use some data of the order. Is it a good practice to use the order id and order tokenValue to retrieve the specific order data? What’s the idea of this order tokenValue? Will this token stay in the database or will it be reset/removed some time later?

Thanks for your inputs!

Slack answer from StephaneDecock (message:

Rule of thumb: Never use ID on public pages. As it would be quite easy to guess it. Natively, it is used to generate payment URL /order/{tokenValue}/pay ie.
It is never removed and can safely be used for your PDFs.