Created
June 15, 2020 17:20
-
-
Save Lkubok/6485f4af4d7228dfff368efa8de7fc10 to your computer and use it in GitHub Desktop.
paypal1
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="paypal-button"></div> | |
<script src="https://www.paypalobjects.com/api/checkout.js"></script> | |
<script> | |
paypal.Button.render({ | |
// Configure environment | |
env: 'sandbox', | |
client: { | |
sandbox: 'demo_sandbox_client_id', | |
production: 'demo_production_client_id' | |
}, | |
// Customize button (optional) | |
locale: 'en_US', | |
style: { | |
size: 'small', | |
color: 'gold', | |
shape: 'pill', | |
}, | |
// Enable Pay Now checkout flow (optional) | |
commit: true, | |
// Set up a payment | |
payment: function(data, actions) { | |
return actions.payment.create({ | |
transactions: [{ | |
amount: { | |
total: '0.01', | |
currency: 'USD' | |
} | |
}] | |
}); | |
}, | |
// Execute the payment | |
onAuthorize: function(data, actions) { | |
return actions.payment.execute().then(function() { | |
// Show a confirmation message to the buyer | |
window.alert('Thank you for your purchase!'); | |
}); | |
} | |
}, '#paypal-button'); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment