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: https://sylius-devs.slack.com/archives/C3EGDG9LY/p1629450823267200?thread_ts=1629408236.264300&cid=C3EGDG9LY)

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.