It’s generated automatically by Envato. You won’t actually know the purchase codes unless the buyer provides them to you, such as over e-mail or as a part of product activation.
This is something you’ll need to implement on your own. I do something similar with my item – during installation it asks them to enter a purchase code or sign in with their account. The installer communicates with my own API, which maintains a database of activations and then communicates with the Envato API.
But actually limiting the number of installations, especially for something on CodeCanyon, isn’t technically possible. Your source code should be editable by your buyers, thus they can remove any such limitation. In my case, I simply persuade them with automatic updates as an activation perk.
3 installations is more than enough for most buyers, but do keep in mind that some may go over this in exceptional cases while still having legitimate reasons. I’ve had a few customers who installed my script more than 5 times over the years, but they were just rebranding or moving to new servers.