[英]I want to integrate paypal payment gateway to my application but i am not able to pass the amount variable
<button type="button" >total?</button>
<?php $abc= '<div id="output"></div>';
echo $abc;?>
<form class="paypal" action="payments.php" method="post" id="paypal_form" target="_blank" runat="server">
<input type="hidden" name="cmd" value="_xclick" />
<input type="hidden" name="no_note" value="1" />
<input type="hidden" name="lc" value="UK" />
<input type="hidden" name="currency_code" value="GBP" />
<input type="hidden" name="bn" value="PP-BuyNowBF:btn_buynow_LG.gif:NonHostedGuest" />
<input type="hidden" name="first_name" value="Customer's First Name" />
<input type="hidden" name="last_name" value="Customer's Last Name" />
<input type="hidden" name="payer_email" value="customer@example.com" />
<input type="hidden" name="item_number" value="123456" / >
<input type="submit" value="Submit Payment"/>
</form>
<script type='text/javascript'>
$('button').click(function() {
var total = $(':checkbox:checked.case').get().reduce(function(total, checkbox) {
return total + +checkbox.value;
}, 0);
$("#output").html(total);
});
</script>
该代码包含一个按钮,可从检查的答案中获取总金额。 我需要将此值传递给支付网关。
提前致谢....
您需要在表单中输入其他金额
<input type="hidden" name="amount" value="">
然后,代替$('button').click
注册表单提交事件,例如
$(function(){
$('#paypal_form').on('submit', function(e){
var total = 'get total here';
if(!total)
{
e.preventDefault();
return false;
}
$(this).find("[name='amount']").val(total);
return true;
});
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.