I have a paypal business account so that I can accept payments into my paypal account.
Using the static button generator in PayPal to create hosted buttons and links works fine. No problem with that.
On my website I display the item description and the price above the paypal button. And, obviously, the PayPal hostedbutton knows the price.
If I want to change the price I log into my paypal account and change the item price and then log into my website to change the displayed price there too so that both places shows the same price.
What I would like to do is have the page (PHP) on my website connect to paypal and read the current price from the hostedbutton. That way I will only need to change the price in PayPal and my website would automatically show the correct price.
I know how to use my paypal clientid and secret to connect to paypal and get an access_token but is it even possible to read hostedbutton data?
Thanks y’all.
6
It is not possible to read the price from hosted button data. PayPal’s hosted buttons are for simple HTML websites with no backend.
For the type of functionality you describe, use a standard PayPal integration and set the price yourself with an API call from your backend.
Alternatively to doing your own integration, there are open source/third-party shopping carts. PayPal has this partner directory as a starting point, though there are many others: https://www.paypal.com/us/business/platforms-and-marketplaces/directory
3