I have never tried to build a Drupal application with paid membership. Both Ubercart and Drupal Commerce provide membership subscription feature. This example is a proof of concept on implementing paid membership on Ubercart.
1. Enable the Roles module in Ubercart.
4. Add a new product for membership subscription.
9. If the user purchase the memebership again before the role is expired, the new subscription period will be added to the expiration date. Moreover, the removal of role after expiration is done by Drupal Cron. So make sure the cron job runs properly.
If you prefer working with Drupal Commerce, you can refer to the following 2 modules.
- StackOverflow – Paid membership for Drupal 7 [closed]
- Drupal Community – Selling site access (roles)