I am building a custom Wordpress theme and I have a Donate page that that contains multiple donation types - one-time payments and automatic monthly payments (subscriptions). When the user clicks the Continue button for a donation type, it calls one of the two javascript functions specific to that payment type and then renders the appropriate PayPal buttons to complete the payment process. The issue I'm running into is that I need to use two different PayPal SDK scripts depending on the payment type: https://www.paypal.com/sdk/js?client-id=ID-OMITTED¤cy=USD&commit=false&debug=true or https://www.paypal.com/sdk/js?client-id=ID-OMITTED&vault=true&intent=subscription Since the one-time payment button is the first on the page, when I call the function to render the paypal buttons it works as expected. The problem comes in when I try to test the subscription option. Since the one-time SDK was loaded first, it will call that and the PayPal buttons won't render. I am trying to figure out how to choose which script to load. I have tried appending the correct SDK src to the head after an onclick event and even though I can see that it's there it still give me a "paypal is not defined" error. I am hoping someone has come across this and can make some suggestions. I'm using PHP and Javascript and I can provide code examples if necessary, thanks.
... View more