Reputation:
I am upgrading my stripe js version from v1 to v3 But I am getting an error that Stripe.setPublishableKey is not a function??
What is the solution for this??
Upvotes: 8
Views: 8823
Reputation: 25562
Stripe.setPublishableKey
was the function available in v1 and v2. The function changed for v3 and this is covered in details in the documentation here: https://stripe.com/docs/stripe-js/reference#stripe-function
The code should now be:
var stripe = Stripe('pk_test_XXXX');
The rest of the code would change completely too so you should look at the migration guide: https://stripe.com/docs/stripe-js/elements/migrating
Upvotes: 11