How to use the WP REST API to give access
You can add Leaky Paywall user meta to the WP REST API user endpoint. When enabled, this gives you access to the following data:
- level_id
- subscriber_id
- price
- plan
- created
- expires
- has_access
- payment_gateway
- payment_status
Under Leaky Paywall > Settings > General you can choose to enable the REST API setting. When enabled, this will automatically add the Leaky Paywall meta data to the WP REST API user endpoint.
Here is an example of the returned data.
How To Use The WP REST API to Give Access
1. You can search for a user via their email address. e.g. https://example.com/wp-json/wp/v2/users/[email protected]
2. Once you have accessed the user, you can use the "has access" value to know if the subscriber has access or not.