Making the website from scratch to do this may be a little daunting (at least for me): shopping cart system, account info, payment, digital download capability, etc. There are some ready made web apps that can do this.
I set OSCommerce up for a while in my sandbox and it worked pretty well. Essentially, you have a storefront for products (in this case digital downloads - eBooks) with a module tied to your PayPal account (they also support several other payment methods including coupons and electronic gift cards - so you can support multiple payment types).
A user goes to your site and adds an ebook to their shopping cart. When checking out they select the method of payment. They login, or establish an account, pay and the ebook now appears as part of their account. You can also configure how many times they can download it or set it not to expire so essentially they have an online bookshelf with your site.
OSCommerce is Open Source software (free - except for your time and effort) and they have quite a few modules that can be added as well as a pretty responsive and in-depth forum. Requires PHP and MySQL.
www.oscommerce.org
If you get a chance, please visit my site
www.myeclectica.com and give me some feedback on what you think. Trying to set up an eBook Device reader comments, ratings & review site. Will add some advertising (already added an aStore) later on to help pay for hosting it.
Thanks.