pronamic / wp-pronamic-pay-paypal

PayPal driver for the WordPress payment processing library.
http://www.wp-pay.org/gateways/paypal/
2 stars 2 forks source link

PayPal `no_shipping` variable #3

Open remcotolsma opened 3 years ago

remcotolsma commented 3 years ago

In the Easy Digital Downloads PayPal gateway the PayPal variable no_shipping is set to 1: https://github.com/easydigitaldownloads/easy-digital-downloads/blob/2.10.5/includes/gateways/paypal-standard.php#L217

developer paypal com_docs_paypal-payments-standard_integration-guide_Appx-websitestandard-htmlvariables_

https://developer.paypal.com/docs/paypal-payments-standard/integration-guide/Appx-websitestandard-htmlvariables/

This makes sense for a download.

Do not prompt buyers for a shipping address.

Valid value is:

  • 0. Prompt for an address, but do not require one.
  • 1. Do not prompt for an address.
  • 2. Prompt for an address and require one.

Default is 0.

Character Length: 1

Do we want to set this also to 0 in case of a payment with only virtual (download) items? How can we give this variable the correct value?

https://github.com/wp-pay-extensions/easy-digital-downloads/blob/1086b276097a67c33f70fa9fe8efde9ba174004d/src/Gateway.php#L502

rvdsteege commented 3 years ago

Maybe set to 1 if $payment->get_shipping_address() is null, 0 otherwise?

I think it's difficult at the moment for us to distinguish between an optional (0) or required (2) shipping address.

remcotolsma commented 3 years ago

For now we set the no_shipping variable to 1 so there is no prompt for an address. For now we require that each extensions requests the shipping details.

https://github.com/wp-pay-gateways/paypal/commit/6887dc8fe6c11d0caad770c7be0d3aebac1f94c9

remcotolsma commented 3 years ago

Maybe set to 1 if $payment->get_shipping_address() is null, 0 otherwise?

I think it's difficult at the moment for us to distinguish between an optional (0) or required (2) shipping address.

That is also an option, but customers should also make sure that they use the shipping address specified in PayPal for the shipment.

Let's stick to 1 for now.

rvdsteege commented 3 years ago

If we're not updating the shipping address of the payment/order on payment status update, then 1 is the best option indeed.

remcotolsma commented 3 years ago

I just noticed that Pay.nl has a setting for this in the dashboard with the name "Verzendadres Verplicht":

Indien ingeschakeld, checkt PayPal of de adresgegevens van de consument meegestuurd worden met de transactie. Indien niet aanwezig, zullen deze worden opgevraagd op het betaalscherm van PayPal.

admin pay nl_programs_paymentoptionssettings_add

Schermafbeelding 2021-06-21 om 21 48 16

We may consider including a similar setting in the gateway configuration.

If we're not updating the shipping address of the payment/order on payment status update, then 1 is the best option indeed.

I don't think it's desirable to auto update the shipping address from PayPal? You (@rvdsteege) mean that for example the WooCommerce order shipping address is overwritten by the PayPal IPN request?

rvdsteege commented 3 years ago

You (@rvdsteege) mean that for example the WooCommerce order shipping address is overwritten by the PayPal IPN request?

Yes, but that sounds confusing indeed :) However, in a later stage we might want to do that with express checkout.