Note: This guide assumes you're in Illinois, and already have a valid FOID. To avoid any hangups in the process, ensure your ID/Driver's License, your FOID, and your credit/debit card all have the same names and addresses. A difference in any of them can lead to automated systems rejecting sales, or an FFL refusing to complete the transfer.
Purchasing a gun online is much less complicated than you might think, and buying online opens the way to very large discounts and a wider selection of both new and used firearms. After you complete your first purchase, you'll be comfortable with the process - this is the only way I purchase firearms nowadays.
Most of the shopping and buying process is simple, much like any other online purchase. You'll add something to cart, check out, enter credit card info, and all that. The differences start when you get to the shipping address - there is a template to enter your FFL (Federal Firearms License) dealer info, since they'll be the ones receiving the shipment on your behalf.
Finding an FFL
With some exceptions, you can't purchase a firearm and have it sent to your home in the USA. An FFL is someone that is licensed by the federal government to send and receive firearms across state lines. FFLs charge a fee for this service, typically in the range of $30-$50, but it can range higher. Before you can complete the purchase of a firearm, you'll need to find an FFL - a good place to start is https://www.gunbroker.com/ffl/index.
Any gun store near you will do an FFL transfer, but they often charge higher fees to discourage shopping online and encourage you to buy from their existing inventory. You can also find smaller independent FFLs, which will usually be one or two people running a transfer shop out of a garage or rented space. As weird as it might feel to show up to someone's garage, this is a normal part of purchasing a gun, and buyers usually find an FFL they like and stick with that person.
For your first purchase with a new FFL, you should call or email them before completing the purchase to make sure they're still active and taking transfers. Sometimes lists and websites can be out of date, and FFLs have retired or changed their hours. After you confirm they're active the first time, though, they won't need or necessarily even want a heads up when you purchase online - you can just select that FFL and have the item shipped to them, assuming they'll get in touch with you when they receive it. When I'm having something sent to my usual FFL, I shoot him a text saying I've got a gun coming in, and he should let me know when I can come in and do the paperwork.
Completing the Purchase
Back to the online purchase. You've entered in all of your info and found your FFL and have all of their info handy. The website will simply have you enter the relevant information for the FFL, and it will ship to them. Some larger retailers like Brownells make it even easier than this, and have a network of affiliates that you can select through a drop down menu during checkout.
Once your FFL has received the firearm, they'll contact you to come in and complete the form 4473. It's at this time that you'll pay their transfer fee. If the cooldown period is satisfied, congratulations, you own a gun! If not, your FFL will tell you when to come back to pick it up.
There is some variation between how FFLs interpret the start and end of the cooldown - whether it begins when the purchase is made, or when you complete the 4473. Since PICA, it has become more common for FFLs to consider the cooldown period as starting when the 4473 is completed, so you may need to factor two trips into your calculations.
Getting Good Deals
Gun Deals is your new best friend. This is a website that searches across a list of community-vetted stores for the best prices on a specific gun, including shipping and other costs. The community vetting process doesn't eliminate all risk, though, so make sure to Google a store and confirm it's legit before making the purchase.
To search on Gun Deals, you'll need to need to figure out which gun you want to purchase. If that gun has multiple variants, figuring out the SKU of the specific model you want is helpful. For example, a Glock 19 Gen 5 with 10 round mags may have a different SKU than one with 15. Entering the SKU or model in the search will list all of the websites on which the gun is available, along with prices. You can also set up Gun Deals to send you an email notification whenever it sees the price drop to a certain point, which allows you to watch for sales.
Conclusion
Hopefully this demystifies the online purchase process quite a bit, and helps you find better deals than you would otherwise. Happy hunting!