solidus_paypal_commerce_platform icon indicating copy to clipboard operation
solidus_paypal_commerce_platform copied to clipboard

Support shipping_preference: GET_FROM_FILE to be able to checkout without address

Open hefan opened this issue 2 years ago • 0 comments

if a user wants to do a paypal guided checkout from address or cart it is not possible. Paypal returns a 422 Error "The shipping address is required when shipping_preference=SET_PROVIDED_ADDRESS. It would be only possible if the shop doesn't require any shipping step at all.

Solidus Version: Solidus 3.4.3

To Reproduce

  • Just install Solidus 3.4.3 with solidus paypal commerce platform.
  • Configure a paypal sandbox account and fill in the sandbox credentials in the payment method.
  • Check "Display on Cart"

it doesnt matter if you use the solidus_starter_frontend or solidus_frontend.

In Solidus Frontend

  1. use a user without a former address
  2. put an item in cart
  3. go to cart
  4. click on paypal button

Watch the

  1. javascript error box "There was a problem connecting with PayPal."
  2. Error from Paypal in Log 'The shipping address is required when `shipping_preference=SET_PROVIDED_ADDRESS'

Current behavior You are not able to use the paypal Checkout. You need an Adress. 'shipping_preference=SET_PROVIDED_ADDRESS' needs an address. 'shipping_preference=NO_SHIPPING' is no working solution if you have shipment.

These are seemingly the only possibilities given here https://github.com/solidusio/solidus_paypal_commerce_platform/blob/master/app/models/solidus_paypal_commerce_platform/paypal_order.rb#L108

Expected behavior You should be able to do the Paypal checkout and return on the confirm page with the provided address from paypal. If you have to apply shipping rates, they should be added automatically or you should have the possibility to write an adapter which sets the shipping method.

Proposal You can use the 'shipping_preference=GET_FROM_FILE' see here https://www.paypal-community.com/t5/REST-APIs/order-created-with-SET-PROVIDED-ADDRESS-canno-t-patch-without-a/td-p/3034696 which would not need an address.

The Logic for the shipping_preference should be more complex and consider an already entered user address, no address, and also no shipping. it may also alter the setting based on if paypal is used from product screen, cart screen or payment screen. https://github.com/solidusio/solidus_paypal_commerce_platform/blob/master/app/models/solidus_paypal_commerce_platform/paypal_order.rb#L108

Desktop (please complete the following information):

  • OS: Ubuntu 2204
  • Browser Firefox
  • Version 114.0

Additional context configured paypal sandbox account

hefan avatar Jul 13 '23 00:07 hefan