安全的PayPal Checkout客户端? [英] Secure PayPal Checkout Client-side?

查看:66
本文介绍了安全的PayPal Checkout客户端?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通过paypal的客户端结帐,他们声称您只需将其代码拖放到您的网站(前端)上即可.但是,从此示例来看,用户似乎可以修改请求的金额,因为代码在客户端上(永不信任客户端").

With paypal's client side checkout they claim you can simply drop their code onto your site (front end). However, from this example it looks like a user could modify the amount requested because the code is on the client ("Never trust the client").

是否可以保护此密码或服务器端代码是否必要?

Is it Possible to secure this or is server side code necessary?

直接来自演示

<!DOCTYPE html>

<head>
    <!-- Add meta tags for mobile and IE -->
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
</head>

<body>
    <!-- Set up a container element for the button -->
    <div id="paypal-button-container"></div>

    <!-- Include the PayPal JavaScript SDK -->
    <script src="https://www.paypal.com/sdk/js?client-id=sb&currency=USD"></script>

    <script>
        // Render the PayPal button into #paypal-button-container
        paypal.Buttons({

            // Set up the transaction
            createOrder: function(data, actions) {
                return actions.order.create({
                    purchase_units: [{
                        amount: {
                            value: '0.01'
                        }
                    }]
                });
            },

            // Finalize the transaction
            onApprove: function(data, actions) {
                return actions.order.capture().then(function(details) {
                    // Show a success message to the buyer
                    alert('Transaction completed by ' + details.payer.name.given_name + '!');
                });
            }


        }).render('#paypal-button-container');
    </script>
</body>

推荐答案

服务器端对于确保金额(以及您要在交易中指定的说明和其他任何数据)是必需的

Server-side is necessary to secure the amount (as well as the description and any other data you want to specify as part of the transaction)

这是服务器的前端演示模式一侧.

这篇关于安全的PayPal Checkout客户端?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆