javascriptpaypalpaypal-subscriptionspaypal-buttons

PayPal smart button switch to subscription / recurring donation


I've managed to get the PayPal smart button working, but would like to know if it's possible to switch the payment button to a subscription programmatically after it's been rendered? And what the best way to do this is?

My plan is to use the smart button for accepting donations on an assignment website I'm working on. The form will have a select box for a recurring donation with options for "No, thanks", "Monthly", and "Annually".


Solution

  • You cannot switch a one-time payment button to a subscribe button. You can hide its container and show a subscribe button's container instead.

    A difference you will notice is that to be able to render the subscribe button, the SDK line must have &vault=true. Only load the SDK once per page, before rendering any buttons.