PayPal Checkout - Shipping Address Omission

  • Posts: 34
  • Thank you received: 4
  • Hikashop Essential
5 months 2 weeks ago #356573

-- HikaShop version -- : 5.0.0
-- Joomla version -- : 3.10.12
-- PHP version -- : 8.2.12
-- Browser(s) name and version -- : Firefox 119.0.1

I'm working on a site that solely uses PayPal for checkout. We recently switched the payment plugin from the HikaShop Paypal payment plugin to the HikaShop Paypal Checkout payment plugin. Before the change, PayPal reported the address of the customer to the merchant. After the change the customer's address is not available to the merchant.

PayPal responded to an inquiry about this omission with this message:

Upon checking the REST API logs of your account, we could see that your
website is passing the "shipping_preference" parameter as "NO_SHIPPING"
via "Create Order [1]" API call. This is the reason why the "Shipping
Address" details is missing.


Further PayPal suggests that the shipping_preference should be: "GET_FROM_FILE"

The website uses a fixed price for shipping each product using the HikaShop manual shipping plugin in which 'Use price per product' is set to Yes.
The price per product is USD22.00. Under Restrictions, a published warehouse is selected.

What additional steps should I take to send the correct shipping_preference to PayPal?


Charles
Last edit: 5 months 2 weeks ago by cmb. Reason: Punctuation change.

Please Log in or Create an account to join the conversation.

  • Posts: 81540
  • Thank you received: 13071
  • MODERATOR
5 months 2 weeks ago #356586

Hi,

The PayPal Checkout plugin will set the shipping_preference to SET_PROVIDED_ADDRESS when it can provide the shipping address of the customer to PayPal. For that to happen, the shipping address has to have the firstname, lastname, street, city, post code and country fields filled in. If one is missing (because the field is disabled, or not required and the customer didn't provide it), then the plugin cannot send the partial address as PayPal would just return an error message and prevent the transaction from happening.
So in that case, it sets the shipping_preference to NO_SHIPPING
Thus, I suppose you must have disabled some custom address fields in the Display>Custom fields and that's why you get that behavior.
The previous PayPal plugin didn't had that restriction as even with a partial address, PayPal was still able to process the transaction and just let the customer fill in the missing address fields.

We avoid using GET_FROM_FILE because it would mean the customer would have to enter again his shipping address on PayPal, and it could end up being different from the address in the order on your website, which could lead to shipping mistakes.

Please Log in or Create an account to join the conversation.

  • Posts: 34
  • Thank you received: 4
  • Hikashop Essential
5 months 2 weeks ago #356606

The website never collects name and address information. It relies solely on PayPal for order handling. The website visitor places items in the shopping cart and HikaShop sends that information (item name, quantity, cost, shipping charge etc.) to PayPal.

If the HikaShop PayPal Checkout plug-in sent the shipping_preference of GET_FROM_FILE to PayPal, the merchant would have the needed address information as before from the legacy PayPal plug-in.


Charles
Last edit: 5 months 2 weeks ago by cmb. Reason: Removed duplicated word.

Please Log in or Create an account to join the conversation.

  • Posts: 81540
  • Thank you received: 13071
  • MODERATOR
5 months 2 weeks ago #356607

Hi,

So why not letting HikaShop collect the address so that it would send it to PayPal so that the customer doesn't have to enter it on PayPal ?

Now, you can copy the file plugins/hikashoppayment/paypalcheckout_end.php to templates/YOUR_TEMPLATE/hikashoppayment/paypalcheckout_end.php and add the line below at the top:

<?php $this->orderData->application_context->shipping_preference = 'GET_FROM_FILE'; ?>
That will force PayPal to collect the address on its end.

Please Log in or Create an account to join the conversation.

  • Posts: 34
  • Thank you received: 4
  • Hikashop Essential
5 months 2 weeks ago #356613

nicolas wrote: So why not letting HikaShop collect the address so that it would send it to PayPal so that the customer doesn't have to enter it on PayPal ?

We don't want to burden potential customers with unnecessary work especially in cases in which their addresses are already on file at PayPal.
We try to eliminate roadblocks wherever possible.

Now, you can copy the file plugins/hikashoppayment/paypalcheckout_end.php to templates/YOUR_TEMPLATE/hikashoppayment/paypalcheckout_end.php and add the line below at the top:

<?php $this->orderData->application_context->shipping_preference = 'GET_FROM_FILE'; ?>

I have created a new directory on the site:
/templates/protostar/hikashoppayment
In that directory I have placed a copy of:
/plugins/hikashoppayment/paypalcheckout_end.php
Then I modified the copied file by inserting the PHP line above at line 11.


Charles

Please Log in or Create an account to join the conversation.

Time to create page: 0.065 seconds
Powered by Kunena Forum