There are a few problems with the sample code posted, but I think the main issue was that it was loading the PayPal JS code in a way that the library is not initialized before the rest of the code on the page tries to use the 'paypal' variable. There were some other errors, as it seems the "description" input box had been cut from the code, and hence that was undefined. Thus, that was solved by adding these few lines. Of course, another way to solve would have been to not refer to the description in the function(s) passed to PayPal in the call backs: To get the script to fully load before the "paypal" variable is used, you can solve that a few ways. One way is to force the page to wait for the library to load, as is described in the marked answer on this stack overflow question: https://stackoverflow.com/questions/66307168/paypal-not-defined-when-customizing-own-src-for-script-tag Another way would be to load it on a page that comes before checkout. Aside from those things, and some re-formatting, that really is all that was needed. But I also want to explain how these problems can be troubleshot. In my experience, when a page doesn't load everything you expect, it is almost always because of a problem, such as an undefined object referenced. You can open your browser's developer tools to view the console, which will give you some clues. In this case, amongst the stack dump that is logged, I saw mentions of "Paypal is undefined". Once that was fixed, the page still didn't load, but now it was mentioning "description is undefined". Once that was fixed, the sample page worked. Without the dev tools, I'd just be guessing -- and probably blaming PayPal's side. LOL. Note, I was trying to post updated code, using the code tags, but apparently these forums do not allow HTML code. If that is the case, it makes this forum virtually useless. I get that it is because people post and try to embed malicious links, but that isn't what I was doing. The board software should know to escape the embedded HTML so it doesn't actually run in the viewers browser.
... View more
... View more