Saturday, 2 March 2019

How to run my PayPal code for 'INR' currency in Ionic

I am working in my Ionic App and I have added the PayPal native plugin in my app but when I have added the 'INR' currency in PayPal code it is not opening in the real device and when I changed the currency to 'USD' it is opening.

This is my checkout.ts:

 makepaymentp()
  {
    //console.log("Payment");
    this.PayPalMobile.init({
      PayPalEnvironmentProduction: 'YOUR_PRODUCTION_CLIENT_ID',
      PayPalEnvironmentSandbox: 'asasasasasasasasas',
    }).then(() => {
      // Environments: PayPalEnvironmentNoNetwork, PayPalEnvironmentSandbox, PayPalEnvironmentProduction
      this.PayPalMobile.prepareToRender('PayPalEnvironmentSandbox', new PayPalConfiguration({
        // Only needed if you get an "Internal Service Error" after PayPal login!
        //payPalShippingAddressOption: 2 // PayPalShippingAddressOptionPayPal
      })).then(() => {
        let payment = new PayPalPayment(this.totalpricec, 'INR', 'Description', 'sale');
        this.PayPalMobile.renderSinglePaymentUI(payment).then(() => {
          // Successfully paid

          // Example sandbox response
          //
          // {
          //   "client": {
          //     "environment": "sandbox",
          //     "product_name": "PayPal iOS SDK",
          //     "paypal_sdk_version": "2.16.0",
          //     "platform": "iOS"
          //   },
          //   "response_type": "payment",
          //   "response": {
          //     "id": "PAY-1AB23456CD789012EF34GHIJ",
          //     "state": "approved",
          //     "create_time": "2016-10-03T13:33:33Z",
          //     "intent": "sale"
          //   }
          // }
        }, () => {
          // Error or render dialog closed without being successful
          console.log("Error or render dialog closed without being successful");
        });
      }, () => {
        // Error in configuration
        console.log("Error in configuration");
      });
    }, () => {
      // Error in initialization, maybe PayPal isn't supported or something else
      console.log("Error in initialization, maybe PayPal isn't supported or something");
    });
  }

I am running the app in my device and it is not running for the 'INR' and it is running for the 'USD'.

Can anyone help me how to run the code for 'INR' in PayPal in Ionic App.

Any help is much appreciated.



from How to run my PayPal code for 'INR' currency in Ionic

No comments:

Post a Comment