Hi,
I’m working on an MVP customer-facing mobile app, that uses the OpenAI API. I came up with an architecture to manage their credits, trial, and monthly subscriptions, and looking for feedback.
The user’s consumption is based on credits. Adding a trial or subscription increases the user’s credits. Calling OpenAI endpoints deducts credits.
In order to allow the user to interact with the app without having to register, I added support for device uuids. When the user calls for the first time an endpoint that uses the OpenAI API, I automatically create a trial user, with some free credits. The trial finishes simply when the user consumes all their credits. Noting that these trials don’t use RevenueCat.
When the user subscribes, it goes through RevenueCat and ultimately, in the webhook call, my backend creates/upgrades the user with the subscription credits.
The user, optionally, can at any time register, which will authenticate them via JWT/email. When they do this, I migrate their UUID-based account in the backend.
Side note, in case it’s relevant: most of the user’s data is stored locally on the device. The backend is currently used only to manage the subscription data.
Generally speaking, is this a sound architecture? I have some concern about the security of the trials, e.g. users can uninstall the app when they’re running out of trials to reset the user UUID. There are measures to alleviate this. But I wonder whether e.g. using RevenueCat’s trials would be more effective. On the other side, I’m not sure whether they allow a smooth start, where the user can start using the app right away. Any feedback welcome, thank you.
