There are two general ways to add a paywall to your site.
Client-side or server-side.
The code for a server-side paywall is implemented on the website’s server, the computer that the website is hosted on. This would use whatever coding applies to the server and site, PHP, Python, Ruby, C#, NodeJS, etc.
Your site remains easily crawlable by search engines. Every paywalled page can be fully crawled and indexed, so there are no worries about your rankings being negatively impacted.
And a Disadvantage…
But just to mention this: server-side paywalls also have their mix of advantages and disadvantages.
The setup is more complex and SEO is more complicated. A poor implementation can destroy rankings.
But if you want to keep some or all of your content out of search engines and away from unauthorized eyes, server-side is the way to go.
Can I Use SwG and Secure Content like a Server-Side Paywall?
Let’s cover that here: How to use SwG & Register Users in WordPress.