PayPal example 4

My first example--called "10" like BASIC lines were numbered--has all of the setup details.

The goal in this example is a variable price. In this case, it's a user-entered price, but now that I have the variable working, the price can be varied in a number of ways. Enter a price, hit "Checkout," and the PayPal button appears. When you go to PayPay sandbox and log in or "pay with ... card," the price you entered should appear.

This brings up the question of what happens if the user changes the price. I am pretty darn sure that deleting the contents of the PayPal container div and then re-running the render will work. Other additions are to disable / readonly the price button, hide "checkout," give an instruction to hit the PayPal button, etc. Perhaps I'll do all that in future examples.

If the user changed the price and hit checkout, a second PayPal button would appear. So, yes, clearing the div and hitting "checkout" will now result in one button with the latest price. I am leaving the previous paragraph because there are still more potential to-dos.