Created
June 22, 2021 19:17
-
-
Save tiarebalbi/f610a14f0463478521fd398c24a23569 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="smart-button-container"> | |
<div style="text-align: center;"> | |
<div id="paypal-button-container"></div> | |
</div> | |
</div> | |
<script src="https://www.paypal.com/sdk/js?client-id=AQWLz3vKbMe_IgBuGxCM6oJeQ40-n9nzBL5M47ITCEjY3oMtWqqaGuCIUU5XJj-piDPXvuZXOAi0awWg¤cy=BRL" data-sdk-integration-source="button-factory"></script> | |
<script> | |
function initPayPalButton() { | |
paypal.Buttons({ | |
style: { | |
shape: 'rect', | |
color: 'gold', | |
layout: 'vertical', | |
label: 'paypal', | |
}, | |
createOrder: function(data, actions) { | |
return actions.order.create({ | |
purchase_units: [{"amount":{"currency_code":"BRL","value":350}}] | |
}); | |
}, | |
onApprove: function(data, actions) { | |
return actions.order.capture().then(function(details) { | |
alert('Transaction completed by ' + details.payer.name.given_name + '!'); | |
}); | |
}, | |
onError: function(err) { | |
console.log(err); | |
} | |
}).render('#paypal-button-container'); | |
} | |
initPayPalButton(); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment