我有一个结帐页面,当用户检查收音机并稍后单击“付款请求”按钮时,我在“收音机”按钮中具有运输选项,因此希望默认情况下将“付款请求”按钮保持为禁用状态。
我正在使用Stripe付款网关并正在使用Codeigniter
var paymentRequest = stripe.paymentRequest({
country: 'GB',
currency: 'gbp',
total: {
label: 'total',
amount: grand_total*100,
},requestPayerName: true,
requestPayerEmail: true,
});
var points=$("#point1").val();
var elements = stripe.elements();
var prButton = elements.create('paymentRequestButton', {
paymentRequest: paymentRequest,
});
paymentRequest.canMakePayment().then(function(result) {
if (result) {
prButton.mount('#payment-request-button');
} else {
document.getElementById('payment-request-button').style.display = 'none';
}
});
$.post('<?php echo base_url();?>frontend/payment_methods/stripe_method/google_payment/google_pay')
.done(function(session) {
var result=session;
// console.log(result);
var sess=JSON.parse(result);
var clientSecret=sess.client_secret;
//alert(clientSecret);
paymentRequest.on('paymentmethod', function(ev) {
//console.log(ev);exit();
stripe.confirmPaymentIntent(clientSecret, {
payment_method: ev.paymentMethod.id,
}).then(function(confirmResult) {
console.log(confirmResult.error);
if (confirmResult.error) {
ev.complete('fail');
} else {
ev.complete('success');
stripe.handleCardPayment(clientSecret).then(function(result) {
if (result.error) {
window.location = '<?php echo base_url('frontend/payment_methods/stripe_method/google_payment/google_pay_fail');?>';
} else {
window.location = '<?php echo base_url('frontend/payment_methods/stripe_method/google_payment/index');?>';
}
});
}
});
});
});
i got the button name from inspect elements and tried to disable the button by using JQuery but didnt work any other options please help
我正在使用Stripe付款网关并正在使用Codeigniter