plugins – How do I allow a user to purchase an expiring passcode to access part of my website, from my online store, similar to pay-per-view?

I am trying to add functionality to a website I am starting to create, which is a bit like a pay-per-view video channel, where a user (without registering) would go onto my online store and purchase a product, which in this case would be an automatically-generated passcode.

The user would receive the passcode via email and then use it to gain access to a specific (hidden/private) part of the website. The passcode would automatically expire a certain amount of time after it is first used, such as a few days.

I have done a bit of research and come across various membership plugins, such as MemberPress and Restrict Content Pro. However, these do not do what I require. I don’t want the user to create an online account; I simply want a passcode to be generated when paid for through the online store.

Is this possible? Could someone point me in the right direction for a plugin, or even a tutorial that explains how to do this? Thanks!