How to Add Paypal Pay in 4 Message to product pages

How to Add Paypal Pay in 4 Message to product pages

abaik_solutions
Visitor
2 0 0

Hi, 

 Does anyone know how to add PayPal pay in 4 messages to products pages. PayPal provides the JS SDK code, but that is not working. I have used their code, but it only creates the space for the message, but the message is not displaying. 

Thanks 

Replies 2 (2)

HashtagDesign
Shopify Partner
8 0 2

You code should look something like the below.

In fact if you add your ID in this code should render something close to what you're after.

 

<script src="https://www.paypal.com/sdk/js?client-id=YOUR_CLIENT_ID&components=messages,buttons&disable-funding=c...">
</script>
<!-- this renders the message -->
<div
data-pp-message
data-pp-amount="119.00"
data-pp-style-text-align="center"
data-pp-style-text-size="14">
</div>

<!-- this renders the buttons-->
<div id="paypal-button-container"></div>

<script>
paypal.Buttons({
createOrder: function(data, actions) {
return actions.order.create({
purchase_units: [{
amount: {
value: '119.00'
}
}]
});
},
style: {
layout: 'horizontal',
shape: 'rect',
label: false,
tagline: false
}
}).render('#paypal-button-container');
</script>

fawwadmirza
New Member
5 0 0

How can I get current product price automatically in data-pp-amount?