设置客户端调用服务器端 PayPal 时出现控制台错误 API

Getting console errors while setting up client to call server side PayPal API

设置时,用于测试服务器集成的 PayPal 客户端代码,来自 https://developer.paypal.com/docs/archive/checkout/how-to/server-integration/

我的代码如下:

<html>
<head>
    <title>TEST PAYMENT</title>
</head>
<body>    
<div id="paypal-button"></div>
<script src="https://www.paypalobjects.com/api/checkout.js"></script>
<script>
  paypal.Button.render({
    env: 'sandbox', // Or 'production'
    
    // Set up the payment:
    // 1. Add a payment callback
    payment: function(data, actions) {
      // 2. Make a request to your server
      return actions.request.post('/api/paypal/create-payment')
        .then(function(res) {
            console.log(res);
          // 3. Return res.id from the response
          return res.id;
        });
    },

    // Execute the payment:
    // 1. Add an onAuthorize callback
    onAuthorize: function(data, actions) {
      // 2. Make a request to your server
      return actions.request.post('/api/paypal/execute-payment', {
        paymentID: data.paymentID,
        payerID:   data.payerID
      })
        .then(function(res) {
          // 3. Show the buyer a confirmation message.
        });
    }
  }, '#paypal-button');
</script>
</body>
</html>

当我打开页面时。

当我单击该按钮时,模态 window 显示一秒钟并关闭并出现以下错误。

您尝试使用的 checkout.js 集成已弃用。

这是调用您的服务器的当前 JS SDK:https://developer.paypal.com/demo/checkout/#/pattern/server