简体   繁体   English

我想将贝宝支付网关集成到我的应用程序中,但是我无法传递金额变量

[英]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>

The code contains a button that grabs the total sum from the checked answers. 该代码包含一个按钮,可从检查的答案中获取总金额。 I need to pass this value to the payment gateway. 我需要将此值传递给支付网关。

Thanks in advance.... 提前致谢....

You need another input for amount in your form 您需要在表单中输入其他金额

<input type="hidden" name="amount" value="">

Then, instead of $('button').click register form submit event like 然后,代替$('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.

相关问题 我可以在adobe AIR桌面应用程序中集成支付网关吗? - Can I integrate payment gateway in adobe AIR desktop application? 如何将PHP中的变量PayPal作为支付金额传递给JavaScript - How to pass PHP variable in PayPal JavaScript as payment amount 我正在使用贝宝(Paypal)付款网关,但可以正常工作,但是成功返回空白屏幕后仍会自动运行? - I am using paypal payment gateway, its working but some time on success auto return showing blank screen? 可变金额的 PayPal 付款按钮 - PayPal Payment Button for Variable Amount 如何在我的PHP网站中集成Billdesk付款网关,以便我可以从印度银行进行交易 - How to integrate billdesk payment gateway in my php website so that i can make transactions from indian bank 我正在使用 PayPal API,我希望将生成的付款数据保存在我的数据库中 - I'm using the PayPal API and I want the resulting payment data to be saved in my database 如何将 paypal 月度订阅与直接卡支付相结合? - How can I integrate paypal monthly subscription with direct card payment? 我想在我的 Laravel 应用程序中集成一个 sms api - i want to integrate a sms api on my laravel application 在Stripe Payment Gateway中使用变量作为金额 - Using a variable for amount in Stripe Payment Gateway 我想在我的codeigniter代码中实现贝宝集成。但是我需要的是只有一个功能,即付款确认或验证 - I want to implement paypal integration in my codeigniter code .But What i need is that only one function i.e payment confirmation or verification
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM