-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpartial_4_apple_pay_implementation.js
More file actions
29 lines (29 loc) · 1.38 KB
/
partial_4_apple_pay_implementation.js
File metadata and controls
29 lines (29 loc) · 1.38 KB
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
/**
* Create Apple Pay button
* @param {ComgateCheckout} checkoutInstance instance Comgate checkout
*/
function demo_createApplePay(checkoutInstance) {
checkoutInstance
.createApplePay({ // alternative functional notation for createApplePay({}), createApplePay()
// a complete list of parameters is available at https://apidoc.comgate.cz/?lang=en#definition-of-components-api
style: {
// values according to Apple Pay documentation
style: "black", // (optional, default: black, options: black, white, white-outline) button style
type: "pay", // (optional, default: pay, options: plain, buy, book, donate, ...) button type
width: "400px", // default: 100%
height: "45px" // default: 100%
},
locale: "cs-CZ" // (optional, default: cs-CZ, options: en-US, de-DE, sk-SK, ...) UI language
})
.then(async (applepayInstance) => {
const res = await applepayInstance.canMakePayment();
if (res.result === true) {
applepayInstance.mount("#apple-pay-button-box");
} else {
console.log("Comgate Checkout: Apple Pay is not available on this device");
}
})
.catch((error) => {
console.log("Comgate Checkout: Error creating Apple Pay button.");
});
}