My goal is to create a shiny app that use Auth0 for authentication and Stripe for billing and payment in order to have a subscription based business model.
Background
Hello RStudio Community I am fairly new to Shiny and R technologies (well, web development in general). With that said, I am developing a Shiny App application which will offer paid subscription models. I plan to use shinyapps.io's implementation of this system as an example.
I have read about Stripe and how it can help me with this implementation. Furthermore, I am using Auth0 for my user authentication. All of this is running of a EC2 server using Shiny Server.
I went ahead and did the setup process for each service and technology, no issues here. The problem comes when I try to integrate said technologies with one another.
Main Issues
The first issue here has to do with Auth0, I have to know which registered user bought a subscription of mine. To do this, I have read that I can use an ID or Access Token; but I cannot find a way to access said token in a shiny app.
The second issue has to do with Stripe, I need a way to identify the user on Stripe. I was planning to use metadata (which both Auth0 and Stripe support) but in order to do that I need to solve the Auth0 issue first.
Tech Stack
R
** shiny
** shiny-server
** shiny-auth0 (R package)
I will really appreciate any help, feedback and references. If you know a stack or use of tech which can help me out solve my issues; or any of you need further context or clarification please let me know.
Hi,
concerning the main issue, it might be easier to use users emails as an identifier (you will need to make it as a required field if you are using social login too).
Otherwise, you can use the unique user identifier returned by the auth0 API, called sub. And pass it to Stripe metadata when creating the customer (the challenge here is that Stripe API doesn't support search by metadata fields).
If all users are suppposed to pay, then it might be possible to do the inverse too, create the Stripe customer, and use the ID to create the auth0 account.
The general process is the following:
the user login using auth0 API.
when login is OK, you search this customer on Stripe and get his Stripe ID.
you check if this customer has a valid subscription using Stripe API.