简体   繁体   English

贝宝快递结帐按钮IPN

[英]Paypal express checkout button IPN

I have an express checkout button on my webpage which looks somethin like that: 我的网页上有一个快速结帐按钮,看起来像这样:

<body>
<div id="paypal-button"></div>

<script src="https://www.paypalobjects.com/api/checkout.js"></script>

<script>
    paypal.Button.render({

        env: 'sandbox', // Or 'sandbox'

        client: {
            sandbox:    '<censored>',
            production: 'xxxxxxxxx'
        },

        commit: true, // Show a 'Pay Now' button

        payment: function(data, actions) {
            return actions.payment.create({
                payment: {
                    transactions: [
                        {
                            amount: { total: '1.00', currency: 'USD' }
                        }
                    ]
                }
            });
        },

        onAuthorize: function(data, actions) {
            return actions.payment.execute().then(function(payment) {
                console.log(data);
            });
        }

    }, '#paypal-button');
</script>

I also have an IPN handler on my rails backend that i tested with the IPN simulator at https://developer.paypal.com/developer/ipnSimulator/ and selected express checkout and it works fine. 我还在我的后端上有一个IPN处理程序,我在https://developer.paypal.com/developer/ipnSimulator/上使用IPN模拟器进行了测试,并选择了快速结帐,它工作正常。 The only thing I couldn't figure out is how to setup paypal to send the IPNs to my server. 我唯一不知道的是如何设置贝宝来将IPN发送到我的服务器。 I tried setting up a paypal business account and entering url there for IPNs but i don't recieve anything on the server nor on the IPNs history website. 我尝试设置贝宝业务帐户并在其中输入IPN的网址,但是我在服务器上或IPNs历史网站上都收不到任何信息。

I see button code is for sandbox. 我看到按钮代码用于沙箱。 Sandbox is a test environment, you should setup IPN in your sandbox account to receive IPN notifications. 沙盒是一个测试环境,您应该在沙盒帐户中设置IPN以接收IPN通知。 You can login to sandbox account in this URL: www.sandbox.paypal.com 您可以通过以下URL登录沙盒帐户:www.sandbox.paypal.com

If you are using live account, you'll need to change "env" and "client" to production. 如果您使用真实账户,则需要将“ env”和“ client”更改为生产环境。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM