We already have pre-written order pages here: https://wyday.com/limelm/help/how-to-generate-product-keys-after-order/
They're for PHP, C#, and VB.NET. Since you're using wordpress you know you're using PHP, and thus the PHP example is where you should start.