Wix has released an official solution for this problem, a Wix app called Paid Plans. You can check it out here: https://www.wix.com/app-market/paid-plans/overview. Since it is much better in terms of installation, usability and features, I can only recommend using that one over my project. I'm leaving my project up for educational purposes (or if anyone does not want to use the official solution for some reason).
Edit: the code and tutorial are now available at https://github.com/mollie/wix-paid-membership
I have developed a Wix Code solution to support paid membership on any Wix site. You can check out a bare-bones demo of this functionality on my demo-site. The site is in test-mode so purchasing a membership subscription won't cost you any real money.
In the following 1-2 weeks I will finish up a first version and publish it as an open-source project on GitHub. I will include a comprehensive tutorial with instructions on how to create the correct source files, database collections and front-end elements. If you get stuck somewhere, don't hesitate to send me a message so I can help out. For a fee, I can also personally do the implementation on your site myself. I can also be contacted to implement further feature requests, or review and merge pull requests on the repo when it's published.
I am supported in this project by the payment service provider Mollie. They have a developer-friendly API and a competitive pricing model. As developer of this solution, I receive a percentage of the transaction fee from any transaction that goes through this paid membership system. As user of the solution, you of course don't pay extra for this in any way, and it's an assurance on your part that I take this project seriously since I benefit as well from successful adoption.
Any questions, support tickets, feature requests or ideas you can post in this thread (or in the future, on the repo). Like or follow this post (top right settings button -> follow post) to get updates and a final release date when I have one.