I have a web application (written in PHP) that offers 3 subscription types in order to use the web application. The subscription types are: Monthly, 6 Months and Yearly. All the users that utilize the demo version (similar to a trial period) of my web application must sign up, so I have their name and they are assigned an ID, which is stored in a session variable and on the db. After the "trial" period is up, they have an option to either subscribe or their demo account is automatically deleted by the system.
I have tried to use the PayPal "Smart Buttons", and they did work. The problem was that I have no idea which user subscribed and which subscription plan they chose. I can look it up directly on PayPal but that doesn't do me any good because I need that information to be stored in my db. I read about the implementing webhooks for the subscription but that has me so lost. So I decided to write my own API using PHP to communicate with PayPal.
It retrieves the access token using my sandbox credentials. Then I create the product (which is one of the subscription types) and get the product_id. I then create the subscription plan which sets the billing cycles and amount of the plan. Each request works. I have the activate subscription and capture authorized payment Api's set up. The activate subscription and the capture authorized payment I presume are used after the user has subscribed.
My Question: How do I create the PayPal buttons that display the PayPal, Venmo, and Credit Card buttons (without using the PayPal Smart Buttons) and have them link to the product and subscription plan using the API that I had started? And how do I pass along the Users ID so that I may track which subscription they have chosen? I know next to nothing about javascript, so using the javascript SDK or the NODE JS is really out of the question for me.
Everything I have found is always directing me to the PayPal site and creating the "Smart Buttons". That is all nice and dandy, but I have no way of telling which of my users had created the subscription. Much less getting real time subscription information as the process is happening.
I'm new to all this API stuff and I'm trying to figure it all out. Perhaps my workflow is wrong?
This is what I currently have for a work flow:
A guest user can go to the subscription page where they have the 3 options for subscriptions. They click on the monthly plan. It takes them to my "checkOut" page. On this page is where the "PayPal" buttons should be. Or a "Subscribe Now" button? How do I make the buttons that have the 3 different payment options so that the PayPal window pops up for the user to complete the transaction?
I know I'm missing something to make this all work, but I don't even really know what to ask to find what I'm missing. If that makes any sense.
UPDATE I have found https://stackoverflow.com/questions/63899329/paypal-smart-subscribe-server-side this but I am not following what they are talking about.