Server : Apache System : Linux 145.162.205.92.host.secureserver.net 5.14.0-611.45.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Apr 1 05:56:53 EDT 2026 x86_64 User : tradze ( 1001) PHP Version : 8.1.34 Disable Function : NONE Directory : /home/tradze/public_html/public/themes/frontend/assets/payment/js/ |
var hostedFormSubmit = document.querySelector('#check-hosted-fields');
braintree.client.create({
authorization: ""
}, function (clientErr, clientInstance) {
if (clientErr) {
// Handle error in client creation
return;
}
braintree.hostedFields.create({
client: clientInstance,
styles: {
'input': {
'font-size': '14pt'
},
'input.invalid': {
'color': 'red'
},
'input.valid': {
'color': 'green'
}
},
fields: {
number: {
selector: '#card-number',
placeholder: '4111 1111 1111 1111'
},
cvv: {
selector: '#cvv',
placeholder: '123'
},
expirationDate: {
selector: '#expiration-date',
placeholder: '10/2019'
}
}
}, function (hostedFieldsErr, hostedFieldsInstance) {
if (hostedFieldsErr) {
// Handle error in Hosted Fields creation
return;
}
hostedFormSubmit.removeAttribute('disabled');
hostedFormSubmit.addEventListener('click', function (event) {
$('#hosted-form .error-payment').html('');
event.preventDefault();
hostedFieldsInstance.tokenize(function (tokenizeErr, payload) {
if (tokenizeErr) {
// Handle error in Hosted Fields tokenization
$('#hosted-form .error-payment').html(tokenizeErr.message);
// console.log(tokenizeErr);
return;
}
hostedFormSubmit.setAttribute('disabled', true);
$('#paypal-form').hide();
$('.hide-payment').hide();
// console.log(payload);
// Put `payload.nonce` into the `payment-method-nonce` input, and then
// submit the form. Alternatively, you could send the nonce to your server
// with AJAX.
document.querySelector('input[name="payment-method-nonce"]').value = payload.nonce;
$("form").submit();
});
}, false);
});
});