I was able to overcome the problem. First of all, I was using Vue.js I solved the issue by using Vue.$nextTick() and then rendering the buttons in the promise that is returned. Original (broken) code: mounted() {
paypal.Buttons({
createOrder: this.createOrder,
onApprove: this.onApprove,
style: {
color: 'gold',
shape: 'rect',
size: 'small',
label: 'checkout',
layout: 'horizontal',
tagline: false,
}
}).render(this.$refs['products-house']);
} Working code: mounted() {
this.$nextTick()
.then(() => {
paypal.Buttons({
createOrder: this.createOrder,
onApprove: this.onApprove,
style: {
color: 'gold',
shape: 'rect',
size: 'small',
label: 'checkout',
layout: 'horizontal',
tagline: false,
}
}).render(this.$refs['products-house']);
});
}
... View more