我可以在角4应用程序中成功加载checkout.js,呈现贝宝按钮,新窗口出现,我确认付款,付款被处理,但我不知道如何设置onAuthorize回调以处理角4中的响应(喜欢显示成功并将支付记录存储到MongoDb)。这是我的密码。我可以看到包含支付响应的第一个console.log,但我无法访问组件的作用域,因此在执行第一个console.log之后没有任何内容。控制台没有出错。即使是console.log(“成功!”)没有被处理。
onAuthorize: (data, actions) => {
return actions.payment.execute().then(function(payment) {
console.log("response = " + JSON.stringify(payment));
this._alertService.success("The extension of subscription was succesfull!");
this.user.contracts.push({
"acquired": new Date(payment.create_time),
"price": payment.transactions[0].amount.total,
"expires": new Date(this.user.expires.getFullYear()+this.selectedAccountExtensionOption.addedYears, this.user.expires.getMonth(), this.user.expires.getDate())
});
console.log("successful!");
});
},发布于 2017-10-21 22:38:20
https://stackoverflow.com/questions/46861004
复制相似问题