tenfourfox/webapprt/test/chrome/mozpay.html
Cameron Kaiser c9b2922b70 hello FPR
2017-04-19 00:56:45 -07:00

54 lines
2.1 KiB
HTML

<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<script>
// Payload
// {
// "aud": "mockpayprovider.phpfogapp.com",
// "iss": "Enter you app key here!",
// "request": {
// "name": "Piece of Cake",
// "price": "10.50",
// "priceTier": 1,
// "productdata": "transaction_id=86",
// "currencyCode": "USD",
// "description": "Virtual chocolate cake to fill your virtual tummy"
// },
// "exp": 1352232792,
// "iat": 1352229192,
// "typ": "mock/payments/inapp/v1"
// }
var jwt = "eyJhbGciOiAiSFMyNTYiLCAidHlwIjogIkpXVCJ9.eyJhdWQiOiAibW9j" +
"a3BheXByb3ZpZGVyLnBocGZvZ2FwcC5jb20iLCAiaXNzIjogIkVudGVyI" +
"HlvdSBhcHAga2V5IGhlcmUhIiwgInJlcXVlc3QiOiB7Im5hbWUiOiAiUG" +
"llY2Ugb2YgQ2FrZSIsICJwcmljZSI6ICIxMC41MCIsICJwcmljZVRpZXI" +
"iOiAxLCAicHJvZHVjdGRhdGEiOiAidHJhbnNhY3Rpb25faWQ9ODYiLCAi" +
"Y3VycmVuY3lDb2RlIjogIlVTRCIsICJkZXNjcmlwdGlvbiI6ICJWaXJ0d" +
"WFsIGNob2NvbGF0ZSBjYWtlIHRvIGZpbGwgeW91ciB2aXJ0dWFsIHR1bW" +
"15In0sICJleHAiOiAxMzUyMjMyNzkyLCAiaWF0IjogMTM1MjIyOTE5Miw" +
"gInR5cCI6ICJtb2NrL3BheW1lbnRzL2luYXBwL3YxIn0.QZxc62USCy4U" +
"IyKIC1TKelVhNklvk-Ou1l_daKntaFI";
// mozPay is currently disabled in the desktop runtime, so we check
// that the property is set to null on the navigator object.
window.addEventListener("load", function() {
document.getElementById("msg").textContent =
(navigator.mozPay === null) ? "Success." : "navigator.mozPay defined";
}, false);
// This is the old code for checking the behavior of the API when enabled:
// var request = navigator.mozPay(jwt);
// request.onsuccess = function onsuccess() {
// document.getElementById("msg").textContent = "Success.";
// };
// request.onerror = function onerror() {
// document.getElementById("msg").textContent = request.error.name;
// };
</script>
<p id="msg">Webapp waiting to be paid...</p>
</body>
</html>