【问题标题】:How can i find Braintree Sandbox Auth Key我如何找到 Braintree 沙盒验证密钥
【发布时间】:2018-02-24 17:49:08
【问题描述】:

我正在使用braintree paypal结帐功能,我找到了jquery代码,我需要将Braintree Sandbox Auth Key放在jquery变量中,我在braintree中创建了帐户,我尝试了所有代码,但是在jquery控制台日志中它说授权失败,谁能帮我在哪里可以找到该代码? 这是我的相同代码

            <!DOCTYPE html>

            <head>
                <meta http-equiv="X-UA-Compatible" content="IE=edge" />
                <meta name="viewport" content="width=device-width, initial-scale=1">
                <script src="https://www.paypalobjects.com/api/checkout.js"></script>
                <script src="https://js.braintreegateway.com/web/3.11.0/js/client.min.js"></script>
                <script src="https://js.braintreegateway.com/web/3.11.0/js/paypal-checkout.min.js"></script>
            </head>

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

                <script>

                    var BRAINTREE_SANDBOX_AUTH = '38mqtdwp4nth5tbk';

                    // Render the PayPal button

                    paypal.Button.render({

                        // Pass in the Braintree SDK

                        braintree: braintree,

                        // Pass in your Braintree authorization key

                        client: {
                            sandbox: BRAINTREE_SANDBOX_AUTH,
                            production: '<insert production auth key>'
                        },

                        // Set your environment

                        env: 'sandbox', // sandbox | production

                        // Wait for the PayPal button to be clicked

                        payment: function(data, actions) {

                            // Make a call to create the payment

                            return actions.payment.create({
                                payment: {
                                    transactions: [
                                        {
                                            amount: { total: '1', currency: 'USD' }
                                        }
                                    ]
                                }
                            });
                        },
                        // Wait for the payment to be authorized by the customer
                        onAuthorize: function(data, actions) {
                            // Call your server with data.nonce to finalize the payment
                            console.log('Braintree nonce:', data.nonce);
                            // Get the payment and buyer details
                            return actions.payment.get().then(function(payment) {
                                console.log('Payment details:', payment);
                            });
                        }
                    }, '#paypal-button-container');
                </script>
            </body>

我需要在这个变量中添加代码var BRAINTREE_SANDBOX_AUTH = '38mqtdwp4nth5tbk'; 谁能帮我解决这个问题?

【问题讨论】:

    标签: paypal paypal-sandbox braintree braintree-sandbox


    【解决方案1】:

    完全披露:我在 Braintree 工作。如果您还有任何问题,请随时联系 support@braintreepayments.com。

    您似乎将BRAINTREE_SANDBOX_AUTH 变量设置为商家ID,而不是Client Token。为了启动 Braintree 结帐,您需要生成,然后传入 client_token

    您生成client_token on your server,然后将其传递给您的client-side callbraintree.client.create()

    如果成功,braintree.client.create() 将返回一个客户端实例,您可以使用该实例使用braintree.paypalCheckout.create() 创建一个 PayPal 结帐组件。

    paypalCheckout component 中,您可以使用paypal.Button.render() 配置您的PayPal 按钮。

    【讨论】:

      猜你喜欢
      • 2015-05-01
      • 2017-02-01
      • 2017-04-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-05-28
      • 2019-06-04
      • 2016-03-06
      相关资源
      最近更新 更多