dongsanhu4784 2018-12-18 20:04
浏览 635

无法使用paypal付款按钮登录paypal - localhost

I'm trying to make online payment using paypal button. I make the button using some instruction from paypal for developers. The paypal payment button shows fine on the page, but when I want to pay (test) it open me a popup, where I need to login with paypal account. I tried to login with another paypal account, because the money should come to my paypal account, but every time it shows me a error message "Check your email address and password and try again", email address and password are correct because I can login to paypal on another tab.

Image for popup where I need to login to paypal account and the error message

enter image description here

Here is code I got from paypal developers:

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

<script>
// Render the PayPal button
paypal.Button.render({
// Set your environment
env: 'sandbox', // sandbox | production

// Specify the style of the button
style: {
  layout: 'vertical',  // horizontal | vertical
  size:   'medium',    // medium | large | responsive
  shape:  'rect',      // pill | rect
  color:  'gold'       // gold | blue | silver | white | black
},

// Specify allowed and disallowed funding sources
//
// Options:
// - paypal.FUNDING.CARD
// - paypal.FUNDING.CREDIT
// - paypal.FUNDING.ELV
funding: {
  allowed: [
    paypal.FUNDING.CARD,
    paypal.FUNDING.CREDIT
  ],
  disallowed: []
},

// Enable Pay Now checkout flow (optional)
commit: true,

// PayPal Client IDs - replace with your own
// Create a PayPal app: https://developer.paypal.com/developer/applications/create
client: {
  sandbox: 'AZDxjDScFpQtjWTOUtWKbyN_bDt4OgqaF4eYXlewfBP4-8aqX3PiV8e1GWU6liB2CUXlkA59kJXE7M6R',
  production: '<insert production client id>'
},

payment: function (data, actions) {
    totalPrice = $('.price').val()
    totalPrice = parseFloat(totalPrice)
    
  return actions.payment.create({
    payment: {
      transactions: [
        {
          amount: {
            total: '1.0' ,
            currency: 'USD'
          }
        }
      ]
    }
  });
},

onAuthorize: function (data, actions) {
  return actions.payment.execute()
    .then(function () {
      window.alert('Payment Complete!');
    });
}
}, '#paypal-button-container');
</script>
<div id="paypal-button-container"></div>

</div>
  • 写回答

1条回答 默认 最新

  • doupai6875 2018-12-18 22:40
    关注

    Are you logging in with a Sandbox account? Since you're working in the sandbox (according to your screenshot) you need to make sure you're logging in with a Sandbox buyer account for testing.

    评论

报告相同问题?

悬赏问题

  • ¥15 逻辑谓词和消解原理的运用
  • ¥15 三菱伺服电机按启动按钮有使能但不动作
  • ¥15 js,页面2返回页面1时定位进入的设备
  • ¥50 导入文件到网吧的电脑并且在重启之后不会被恢复
  • ¥15 (希望可以解决问题)ma和mb文件无法正常打开,打开后是空白,但是有正常内存占用,但可以在打开Maya应用程序后打开场景ma和mb格式。
  • ¥20 ML307A在使用AT命令连接EMQX平台的MQTT时被拒绝
  • ¥20 腾讯企业邮箱邮件可以恢复么
  • ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?
  • ¥15 错误 LNK2001 无法解析的外部符号
  • ¥50 安装pyaudiokits失败