【问题标题】:Paypal Integration with Ionic 3Paypal 与 Ionic 3 的集成
【发布时间】:2018-05-16 12:14:57
【问题描述】:

我正在使用 ionic 原生插件进行 PayPal 支付:https://ionicframework.com/docs/native/paypal/

我的代码是:

this.payPal.init({   PayPalEnvironmentProduction: 'XXXXXXXXXXX',  
PayPalEnvironmentSandbox: 'XXXXXXXXXXXXX' }).then(() => {  
   this.payPal.prepareToRender('PayPalEnvironmentSandbox', new
   PayPalConfiguration({   })).then(() => {
   let payment = new PayPalPayment('3.33', 'USD', 'Description', 'sale');
   this.payPal.renderSinglePaymentUI(payment).then(() => {}, () => {
});   
}, () => {}, 
() => {});

出现错误无法解析 PayPalPayment 的所有参数:(?, ?, ?, ?, ?)。

【问题讨论】:

  • 代码 sn-p 从这里工作正常 ionicframework.com/docs/native/paypal
  • @PareshGami 得到了解决方案。我错误地导入了导致所有这些问题的 PayPalPayment、PayPalConfiguration 应用内模块。谢谢
  • @PareshGami:先生,我也在使用贝宝,但它不能使用 INR currecny,如果我通过 INR 和 $ 货币,我会在控制台中收到无法处理的付款错误,你能帮我解决问题吗?
  • @Pankaj Dadure:先生,您尝试过使用 INR 货币吗?

标签: ionic-framework


【解决方案1】:

您必须将整个代码包装在一个函数中,并在需要调用时调用它。 首先,您需要为测试目的创建沙箱 ID。然后通过创建沙箱 ID,您将需要创建一个应用程序,您将从中获取客户端 ID。然后将您的客户 ID 插入 PayPalEnvironmentSandbox。

paypalPayment(){
    this.payPal.init({
      PayPalEnvironmentProduction: 'xxxxxxxxxxxx',
      PayPalEnvironmentSandbox: 'xxxxxxxxxxxxxx'
    }).then(() => {

      this.payPal.prepareToRender('PayPalEnvironmentSandbox', new PayPalConfiguration({

      })).then(() => {
        let payment = new PayPalPayment('3.33', 'USD', 'Description', 'sale');
        this.payPal.renderSinglePaymentUI(payment).then((success) => {
          console.log(success);
        }, () => {
          // Error or render dialog closed without being successful
          console.log('error paypal')
        });
      }, () => {
        // Error in configuration
        console.log('error configuration paypal')
      });
    }, () => {
      // Error in initialization, maybe PayPal isn't supported or something else
      console.log('error last paypal')
    });
  }

【讨论】:

  • 先生,我使用了上面的代码,如果我通过 INR,它对我不起作用,我在控制台中收到付款而不是进程错误?
  • :意思是根据国家我们必须转换货币然后分配到美元对吗?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2017-07-09
  • 1970-01-01
  • 2016-05-05
  • 2017-06-19
  • 1970-01-01
  • 2017-10-25
  • 2014-05-20
相关资源
最近更新 更多