Created
November 30, 2018 11:11
-
-
Save benjaminshafii/84015cb9e46813f248844c3b3df95ec9 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
<script type="module"> | |
import SimplePayment from "https://unpkg.com/[email protected]/dist/payment-components.esm.production.js"; | |
async function checkout() { | |
const response = await fetch("/pay", { method: "POST" }); | |
const data = await response.json(); | |
return { signedRequestData: data }; | |
} | |
document.addEventListener("DOMContentLoaded", function() { | |
const sp = new SimplePayment(checkout, { | |
redirectUrl: window.location.href, | |
networkId: 4 | |
}); | |
// fil in with the id of your own button | |
sp.init("#checkout-button"); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment