Embeddable javscript widget to ask for Credit Card information and submit it directly to SportsPay.
You'll need to include the widget's javascript.
<script src="https://pairshaped.github.io/sportspaycc/prod.min.js"></script>
<div id="sportspaycc"></div>
It's important that the ID here is the same used in the next step.
The widget is embedded using Javascript, which is how web browsers can enhance a site's functionality.
<script>
var sportspaycc = Elm.SportspayCC.init(
{
node: document.getElementById("sportspaycc"), // Must be the same as the div id above.
flags: {
sportspayHost: "https://replaceme", // Host comes from Sportspay API call.
sportspayApiKey: "replaceme", // API key comes from Sportspay API call.
transactionAmount: "$100.00", // For display purposes only, but should match your total sale with tax.
transactionUrl: "https://replaceme", // This is where to submit the resulting one time token in order to complete the payment.
cancelUrl: "https://replaceme" // This is where to send the user if they cancel the transaction.
}
}
)
</script>
We use elm and elm-live for development. You can install these via npm.
npm install
Copy dev.html.example to dev.html:
cp dev.html.example dev.html
Edit dev.html and configure the flags (parameters) for your environment. Then run it:
npm start
Make sure you have uglify-js installed to compress the production js.
npm install -g uglify-js
Compile and optimize for production using:
./prod.sh
We are using the following third party libraries: