Collect.js Digital Wallet Setup
Collect.js supports Apple Pay and Google Pay for frictionless checkout.
Prerequisites
- Site served over HTTPS
- For Apple Pay: domain must be registered with Apple (contact CyoGate support)
Enabling Digital Wallets
CollectJS.configure({
variant: 'inline',
googlePay: true,
applePay: true,
paymentRequest: {
requiredBillingContactFields: ['postalAddress', 'name', 'email'],
total: { label: 'Your Business Name', amount: { currency: 'USD', value: '29.99' } },
},
fields: { ccnumber: { selector: '#ccnumber' }, ccexp: { selector: '#ccexp' }, cvv: { selector: '#cvv' } },
callback: function(token) {
console.log('Wallet:', token.wallet); // 'applePay', 'googlePay', or null
submitPayment(token.token);
},
});
Dynamic Amount Updates
function updateTotal(newAmount) {
CollectJS.updatePaymentRequest({
total: { label: 'Order Total', amount: { currency: 'USD', value: newAmount.toFixed(2) } },
});
}
Apple Pay buttons only appear in Safari on Apple devices. Google Pay buttons appear in Chrome and other supporting browsers.