javascript - 后端响应成功后打开贝宝结帐模式
问题描述
如果用户在他的表单上输入他的详细信息并提交表单,我有一个表单,在提交表单后它将存储到数据库,并且在成功将用户数据存储在数据库中之后,我必须打开贝宝结帐模式,否则不会。
这是贝宝
paypal.Button.render({
env: 'sandbox',
client: {
sandbox: ''
// production: 'demo_production_client_id'
},
locale: 'en_US',
style: {
layout: 'horizontal',
size: 'small',
color: 'blue',
shape: 'pill',
label: 'checkout',
height: 40,
tagline: 'false'
},
commit: true,
payment: (data, actions) => {
return actions.payment.create({
transactions: [{
amount: {
total: '1',
currency: 'USD'
}
}]
});
},
onAuthorize: function(data, actions) {
return actions.payment.execute()
.then(function() {
window.alert('Thank you for your purchase!');
});
}
}, this.paypalRef.nativeElement);
这是提交表单 api 调用
submit(){
const data={
url: this.URL,
email:this.email
}
this.home.websiteScratching(data)
.subscribe(res=>{
},err=>{
console.log(err);
})
}
after submit success response i want to go for paypal checkout process how to do it.. i am stuck.
解决方案
简而言之,您必须创建新组件并使用 dialogRef。 https://material.angular.io/components/dialog/overview
const dialogRef = this.dialog.open(SuccessPaymentPaypalComponent, {
disableClose: true,
data: { PaypaplRetunrnTrasactionId: this.params.Paypalid }
})
dialogRef.afterClosed().subscribe(() => {
});
推荐阅读
- node.js - 即使验证失败,也可以在数据库中更新记录
- python - 获取提取的 Zipfile 的根文件夹
- javascript - 页面加载时如何使 navigator.vibrate 在 Onload 上工作
- php - Silverstripe 数据对象太大,无法使用 MySQL/InnoDB 保存
- python - 多处理中的Python3子进程
- android - 为什么 getJSONObject() 方法的源代码是“隐藏的”?
- c# - WinSCP - 将文件从 Windows 机器上传到 Linux - 错误:时间跨度溢出,因为持续时间太长
- c# - 在 foreach 循环中使用 List.FindAll 返回的 List<> 与使用本地 List 的区别?
- python - ModuleNotFoundError:没有名为“tensorflow”的模块 Windows 10
- mysql - 如何避免 mysql 存储过程中的 IN (Select...) 子查询