JSFiddle - React, Tailwind, and code Playground
by Brock Whittaker
HTML
<script src="https://js.stripe.com/v3/"></script>
<button type="button" id="start">
Pay now
</button>
JavaScript
var stripe = Stripe('pk_test_ey86Im2tpgrexbs80IiegbpC');
var paymentRequest = stripe.paymentRequest({
country: 'US',
currency: 'usd',
total: {
label: 'Demo total',
amount: 1000,
},
});
// Check the availability of the Payment Request API first.
paymentRequest.canMakePayment().then(function(result) {
console.log(result);
});