Payments to this merchant are not allowed (invalid clientId) - Ionic iOS

痴心易碎 提交于 2020-05-15 07:58:04

问题


Im using the paypal plugin for ionic and is not working on iOS

I already have running this plugin on android and it is working perfect, and also have the clientid generated on https://developer.paypal.com/developer/applications/

doPayment() {
  const total: any = 10;
  const currency: any = 'USD';
  const envProduct: any = '';
  const envSandbox: any = '{Client ID from                                                                  developer.paypal.com/developer/applications/}';

  this.payPal.init({
    PayPalEnvironmentProduction: envProduct,
    PayPalEnvironmentSandbox: envSandbox
  })
  .then(() => {
    // Environments: PayPalEnvironmentNoNetwork,         PayPalEnvironmentSandbox, PayPalEnvironmentProduction
    this.payPal.prepareToRender('PayPalEnvironmentSandbox', new         PayPalConfiguration({
      // Only needed if you get an "Internal Service Error" after         PayPal login!
      // payPalShippingAddressOption: 2 //         PayPalShippingAddressOptionPayPal
        })).then(() => {
          const payment = new PayPalPayment(total, currency,         'Description', 'sale');
          this.payPal.renderSinglePaymentUI(payment).then(async ( res ) =>         {
          // rest of the code after payment
          }, ( errclose ) => {
          console.log( errclose ); // Error or render dialog closed         without being successful
          });
          }, ( errconf ) => {
          console.log( errconf ); // Error in configuration
          });
        }, ( errinit ) => {
          console.log( errinit ); // Error in initialization, maybe PayPal         isn't supported or something else
      });
}

Here is the Error:

Payments to this merchant are not allowed (invalid clientId)

Any help is appreciated. Thank you very much.


回答1:


I get the same error, also on iOS only, when used Ionic Capacitor for runtime instead of Cordova. When I built the app using Cordova runtime it worked correctly on both platforms. Also, you could get the same error when specifying the 'PayPalEnvironmentSandbox' environment name but use production clientId and vice versa.



来源:https://stackoverflow.com/questions/58312665/payments-to-this-merchant-are-not-allowed-invalid-clientid-ionic-ios

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!