我在我的 Angular 项目中使用 Paypal Plus。一切正常。
如何识别付款成功?我必须将哪些数据保存在我的数据库中。简而言之,我在成功等待哪些数据?
<div id="payments-container"></div>
export class PaypalComponent implements OnInit {
paypalConfig = {
env: 'sandbox',
client: {
sandbox: 'ATvgtyEZznsHf...',
production: '<insert production client id>'
},
style: {
layout: 'vertical',
label: 'pay',
size: 'responsive',
shape: 'rect',
color: 'gold'
},
commit: true,
payment: (data, actions) => {
return actions.payment.create({
payment: {
transactions: [{
amount: {
total: 10.5,
currency: "EUR",
}
}]
}
});
},
onAuthorize: (data, actions) => {
return actions.payment.execute().then((response) => {
console.log('response', response);
console.log('data', data);
console.log('actions', actions);
});
},
onCancel: (data, actions) => {
console.log('Canceled!');
}
};
ngOnInit() {
paypal.Button.render(this.paypalConfig, '#payments-container');
}
}