【发布时间】:2016-12-08 16:12:57
【问题描述】:
我遵循此文档并已完成以下代码。
paypal.Button.render({
env: 'sandbox', // Optional: specify 'sandbox' environment
client: {
sandbox: 'xxxxxxxxx',
production: 'xxxxxxxxx'
},
payment: function() {
var env = this.props.env;
var client = this.props.client;
return paypal.rest.payment.create(env, client, {
transactions: [
{
amount: { total: ($scope.qty * 19) + '.00' , currency: 'USD' },
item_list: {
items: [{
"name": "bag",
"quantity": $scope.qty,
"price": "19.00",
"currency": "USD"
}]
}
}
]
});
},
commit: true, // Optional: show a 'Pay Now' button in the checkout flow
onAuthorize: function(data, actions) {
// Optional: display a confirmation page here
return actions.payment.execute().then(function() {
// Show a success page to the buyer
console.log(data);
//save data to db
});
}
}, '#paypal-button');
就这些了吗?接下来我应该用贝宝做什么?我知道如果1actions.payment.execute() 没有失败,我将向我的服务器发布一些内容。但如果仅此而已,paypal 的 node.js sdk 有什么用?我现在很困惑。我尝试使用测试账户支付,但余额没有被扣除,嗯..
【问题讨论】:
-
actions.payment.execute()应该完成交易并汇款。您确定在您的帐户中看不到它吗?有时需要很短的时间才会出现。或者,您是否看到任何控制台错误? -
@bluepnume 控制台中没有错误。如果这足够了,那么 paypal fo node.js npm 是干什么用的?访问令牌有什么用?
-
我也有同样的问题。你有没有设法解决它。我在控制台中也没有收到任何错误
标签: javascript paypal