How to add a 30 day free trial of app

How would I go about offering a 30 day free trial for my app?

Onboard the user (create an account on the server).
Set a flag in the account record as paid or free.
Set an expiration date (regardless of paid or free).
Allow whatever interactions you want (different levels for paid and free).
At each interaction, check if account has expired and if so, prompt for payment.

I’ll give it a try.