簡體   English   中英

后端響應成功后打開 paypal 結帳模式

[英]open paypal checkout modal after backend response success

如果用戶在他的表單上輸入他的詳細信息並提交表單,我有一個表單,在提交表單后它將存儲到數據庫,並且在成功將用戶數據存儲在數據庫中之后,我必須打開 paypal 結帳模式,否則不會。

這是 paypal

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(() => {
 });

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM