PayPal Cordova Shipping Address

Has anyone been able to get the Paypal plugin to supply the shipping address?

I’ve tried to do it but it seems to cause bugs and errors. It complains that the property should be a string but I am sure it should be an object according to the documentation. Any help, would be much appreciated. Thanks!

My code:

payPaypal(){
    PayPal.init({
      "PayPalEnvironmentProduction": "",
      "PayPalEnvironmentSandbox": ""
    }).then(() => {
      // Environments: PayPalEnvironmentNoNetwork, PayPalEnvironmentSandbox, PayPalEnvironmentProduction
      PayPal.prepareToRender('PayPalEnvironmentSandbox', new PayPalConfiguration({
        // Only needed if you get an "Internal Service Error" after PayPal login!
        payPalShippingAddressOption: 1 // PayPalShippingAddressOptionPayPal
      })).then(() => {
        let userAddress = new PayPalShippingAddress(
          'Ben',
          'Address 1',
          '',
          'City',
          'County',
          'YO11 8NP',
          'UK'
        );
        let orderAmount = this.orderTotal.toString();
        let payment = new PayPalPayment(
          orderAmount,
          'GBP',
          'Mobile App Order',
          'sale'
        )
        payment.shippingAddress = userAddress;
        PayPal.renderSinglePaymentUI(payment).then((val) => {
          // Successfully paid
          console.log(JSON.stringify(val));
          // 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
        });
      }, () => {
        // Error in configuration
      });
    }, () => {
      // Error in initialization, maybe PayPal isn't supported or something else
    });
  }

Hi, i’ve got the same error :frowning:
Did you find a solution ?
Thanks,
Nicos

What is this? Where does it come from?
Please provide a link to the library you are using.

It uses the native PayPal plugin:

I didn’t go ahead with adding the shipping address as it wasn’t needed as we already collect this during our checkout process however it would be interesting to know how this should be done correctly. Thanks.

Okay, I fixed your topic’s category to the correct one then.

What exactly does this mean?

Thanks. Basically what I meant, and maybe I wasn’t clear the first time, was when supplying or trying to supply PayPal a shipping address using the plugin it wouldn’t display this address or allow it as part of the code.

In the plugin documentation there is a PayPalShippingAddress instance but it seems that the plugin doesn’t like this instance. Due to this, I never supply a shipping address to PayPal so it doesn’t display as part of the checkout process in PayPal.