Skip to content
Advertisement

Toggle between PayPal Order and PayPal subscription

I’ve been working on a paypal checkout and am having difficulties, my company is offering services that can be purchased one time, or on a recurring basis, and I have the checkout page designed and using dropdowns they can choose the level of service and the frequency, well I now noticed while implementing paypal, I have to use “intent=subscription” to do subscription’s, but if I have that then a normal order can’t be placed, and if I have both scripts included then i get a 500 error during checkout. Is there anyway i can unload/reload the scripts that i need when the buttons change, this is what i have to change the buttons

JavaScript

Advertisement

Answer

You can use a helper function such as the following to load/reload the SDK dynamically:

JavaScript

(Your callback can of course be a named function such as your paypalsingle rather than an anonymous one as in the above usage example)

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement