SomeRandomDev
SomeRandomDev

Reputation: 127

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".

Upvotes: 0

Views: 204

Answers (2)

ahmaxed
ahmaxed

Reputation: 181

That could be done using the Paypal script loader.

Here is a similar issue on the papal-js repo: here

Upvotes: 2

Preston PHX
Preston PHX

Reputation: 30359

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.

Upvotes: 1

Related Questions