-
Notifications
You must be signed in to change notification settings - Fork 1
/
example.html
75 lines (69 loc) · 1.94 KB
/
example.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<!DOCTYPE html>
<html>
<head>
<script src="./dist/walletjs.js"></script>
<script>
// Googlepay
new walletjs.GooglePay({
container: "#gcontainer",
merchantName: "Example Merchant",
gatewayMerchantId: "<PUBLIC_API_KEY>",
allowedCardNetworks: ["VISA"],
allowedCardAuthMethods: ["PAN_ONLY"],
transactionInfo: {
countryCode: "US",
currencyCode: "USD",
totalPrice: "1.23"
},
onGooglePaymentButtonClicked: paymentDataRequest => {
paymentDataRequest
.then(paymentData => {
// Get the token.
const token =
paymentData.paymentMethodData.tokenizationData.token;
// Send the token to your backend server, which will
// then call our API to create a new transaction with
// the token set as the payment method.
})
.catch(err => {
console.log(err);
});
}
});
// Applepay
const ap = new walletjs.ApplePay({
key: "myKey0123456789",
domain: "sandbox.fluidpay.com",
payment: {
merchantCapabilities: [
"supports3DS",
"supportsCredit",
"supportsDebit"
],
supportedNetworks: ["visa", "masterCard", "discover"],
countryCode: "US",
version: 3,
merchantIdentifier: "my.merchant.id.app"
},
details: {
total: {
label: "Total Amount",
amount: { currency: "USD", value: "10.61" }
}
},
options: {
requestShipping: false
}
});
function submitApplePay() {
ap.submit();
}
</script>
</head>
<body>
<div id="gcontainer"></div>
<div id="acontainer">
<button type="button" onclick="submitApplePay()">Apple Pay Button</button>
</div>
</body>
</html>