【发布时间】:2018-07-27 20:40:50
【问题描述】:
我正在使用 React,并且 paypal express 按钮到现在还可以正常工作。快速按钮打开结帐窗口,但没有显示购物车或总金额,单击继续按钮后,我被重定向到汇总贝宝页面。
我可以在我的帐户中看到交易,但尚未完成。以前有人遇到过这个问题吗?右侧的 paypal 示例运行良好,所以我认为问题出在我身上,但系统运行了大约 6 个月,没有出现任何问题。
import React from 'react';
import ReactDOM from 'react-dom';
import paypal from 'paypal-checkout';
payment(data, actions) {
return actions.payment.create({
transactions: [
{
amount: { total: this.state.totalFee, currency: 'USD' }
}
]
});
}
onAuthorize(data, actions) {
return actions.payment.execute().then(function(paymentData) {
// Show a success page to the buyer
});
}
...
render() {
let PayPalButton = paypal.Button.driver('react', { React, ReactDOM });
return (
<div className = "col-sm-3 text-right">
{
this.state.env !== undefined ?
<PayPalButton
commit={ true }
env={ this.state.env }
client={ this.state.client }
payment={ (data, actions) => this.payment(data, actions) }
onAuthorize={ (data, actions) => this.onAuthorize(data, actions) }
/>
:
''
}
</div>
);
【问题讨论】: