javascript - PayPal 智能按钮交易显示错误
问题描述
我正在使用 PayPal 智能按钮在 JavScript 中进行付款。目前,我正在使用沙盒帐户进行测试。
此代码给出错误
function addPaypal()
{
paypal.Buttons({
createOrder: function(data, actions) {
return actions.order.create({
purchase_units: [{
amount: {
currency_code:'USD',
value: '30.00'
}
}]
});
},
onApprove: function(data, actions) {
return actions.order.capture().then(function(details) {
console.log(details);
});
},
onCancel: function (data) {
},
onError: function (err) {
console.log(err)
}
}).render('#paypal-button'); // Display payment options on your web page
}
我得到的错误是
details.purchase_units.amount 未定义
我正在使用两个沙盒帐户。我从中创建了一个应用程序并使用它的凭据。另一个是我支付测试费用的地方。
我检查了两个帐户。我没有得到更多关于错误的细节。
解决方案
推荐阅读
- c++ - QCursor 设置光标颜色的问题
- regex - RegEX 从 shell 脚本中的字符串中获取必填字段
- python - Python input().split() 函数问题
- hyperledger-fabric - Tx 提交后获取空缓冲区:Fabric 2.1 with fabric-network client
- node.js - 与多个连接一起使用时,Mongoose 不会在 .find() 中返回记录
- python - 在python中将基于图像的pdf转换为图像文件(png/jpg)
- python - Python将日期时间转换为另一种格式
- spring - Axon - 调用后的 MessageHandlerInterceptor / 处理程序
- python - 如何安装 python API LGSVL?
- kotlin - 是否可以在 Kotlin 中使用命名空间对扩展进行分组?