You can't pre-purchase, but it's relatively simple to purchase a package once you are onboard. If you sign up for internet before midnight the first day, you will get a 50MB package for free. Once you've used that up, you can then purchase a package that fits your usage. It's all done through your phone, tablet, or computer. Be sure to turn off all auto-updates or those can use up all your data in the blink of an eye. If you need help with that, go to the Connect@Sea desk onboard. The representative there can check your device's settings to make sure there's nothing that will inadvertently use your data.
I can get away with just the 50MB package on 3 and 4 day cruises. On 7 night cruises, I tend to purchase the 100MB package for $19 after I use up the 50MB free package. That's usually just about right for checking email and some light web surfing. I usually wait to upload photos and check social media until we are somewhere in port with free wifi access.