Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Confusing creditcard billing/shipping address #749

Open
FritzHerbers opened this issue May 27, 2020 · 8 comments
Open

Confusing creditcard billing/shipping address #749

FritzHerbers opened this issue May 27, 2020 · 8 comments
Labels
priority: high The issue/PR is high priority—it affects lots of customers substantially, but not critically.

Comments

@FritzHerbers
Copy link

Describe the bug

Version 2.0.1
We have WooCommerce "Shipping Options / Shipping Destination" set to "Force shipping to the customer billing address". The customer only fills out the billing address. We only ship to this address.
When the customer selects to use PayPal and clicks the "Debit and Credit Card" options, the billing address is empty. Shipped to "Billing Address" is ticked, unticking it, it shows the billing address information from the Cart.

Expected behavior

It would be great when in the "Debit and Credit Card" section no shipping address is visible.
Also, the Carts billing address should/could be copied to the billing address section.

As what I see on many online stores, for credit card information they use only the Cardnumber, Expires, CSC and sometimes a cardholders name. I never saw that a whole address and phone number has to be entered.
On the credit card itself there are only the 4 above mentioned data items, asking more doesn't make sense.

The current implementation is very confusing, also in our reduced setup. When shops allowing a different Cart shipping address, then they end up with 4 addresses (2x Cart, 2x Credit Card section). Which one will be used is unclear.

As the (visuell) behavior changed, it would be nice to have a release note, explaining the changes.

Environment (please complete the following information):

  • WordPress Version 5.4.1
  • WooCommerce Version 4.1
  • PayPal (Express) Checkout Plugin Version 2.0.1
@FritzHerbers
Copy link
Author

We had a second look at the issue. What we haven't noticed is that this behavior also exists on 1.6.21. We also haven't noticed that the credit card information form is shown below the icons and that no PayPal screen opens anymore.

An explanation of such changes would be nice to have in the change log or a reference to some release notes or a "What's new" section.
https://docs.woocommerce.com/document/paypal-express-checkout/
Some screenshots are updated, some still show the old icons. From this document no new behavior is described or visualized.

We found the following support request:
https://wordpress.org/support/topic/billing-address-required-something-went-wrong/

On 1.6.21 we can produce the same effect, that on pressing around on the credit card icons, the error “something went wrong. we’ll take you back to checkout so you can try again" comes and PayPal opens:

https://imgur.com/PJghtRs

On the PayPal page no shipping information is asked.

Why is a shipping checkbox available when the form opens below the black credit card icon?
Also, why is the billing information not copied to the credit card billing information?

@FritzHerbers
Copy link
Author

https://wordpress.org/support/topic/redirect-to-cart-after-closing-paypal-checkout-popup/
Did a checkout on the website in the issue, and noticed that the credit card fields only show some fields:

20200530_paypal_creditcard

Why are only some fields shown, and not like ours:

20200530_paypal_creditcard-1

On what does it depend, which fields are shown?
The Italian site credit card form would be OK for us, how/what do we have to configure?

@dsmithweb
Copy link

dsmithweb commented Jun 3, 2020

Just to further describe this behavior: If "Require Billing Address" is set on the merchant's PayPal account, then at checkout when the customer fills in the Billing Address area within WooCommerce checkout, then clicks the "Credit/Debit" button, the resultant windowshade dropdown auto-enters the Woo Checkout area's Billing Address into the Shipping Address area of the PayPal dropdown, leaving the Billing Address of the dropdown blank.

@BenceSzalai
Copy link

BenceSzalai commented Jan 29, 2021

Hi! I'm apparently facing a related issue, although under somewhat simpler circumstances. I've asked about it on wordpress.org support forum and got redirected here, so I'll share my findings here.

(Un)fortunately I had another (unrelated) issue where shipping costs were not added to the PayPal total, and while debugging that I've took a deeper dive into how this payment plugin works.

Apparently it uses the NVP API to send the payment details to PayPal. When the payment process is initiated the SetExpressCheckout method is called to provide PayPal with the details for the purchase and payment. This includes API user and password, settings, the price of the cart, and the shipping address. This can be seen as well in the logs under wp-content/uploads/wc-logs/wc_gateway_ppec-*.log files, once Debug Log is enabled under settings.

Long story short, the thing is - as far as I can see - the NVP API does not have a way to provide the Billing Address. The SetExpressCheckout only has shipping fields, but I've been browsing through the other methods as well and found no reference to billing address or any details to be used for the billing fields.

When the Debit/Credit card form is loaded, the details sent by the WordPress server in the background are coming back to the browser. Look for a request starting with https://www.paypal.com/smart/card-fields?... in the network inspector in your browser. The response to this request contains the information used to initialise the payment form. If you look at the definition of the window.__INITIAL_STATE__ object, it contains an initialFormValues object, and that contains a billingAddress object, which to no surprise for me looks like this:

{"line1":null,"line2":null,"city":null,"state":null,"country":null,"postalCode":null,"isFullAddress":false,"lastName":null,"firstName":null}

So right now I think the situation is this:

  • Since the API provides no way to provide the billing address, as long as WooCommerce PayPal Checkout Payment Gateway relies on this API, there is no control over the billing fields.
  • Most of the PAYMENTREQUEST_n_SHIPTO* fields are mandatory, so in order to initiate the payment, WooCommerce PayPal Checkout Payment Gateway will send the billing address to PayPal under the Shipping fields if there is no Shipping address on WooCommerce side (for whatever reason).

Any other differences in our experience with the billing fileds must be down to other reasons, e.g. (only speculating):

  • PayPal may or may not use some of the Shipping details provided to pre-populate the Billing fields, it is totally up to them, and cannot be controlled from the API side.
  • If the customer is logged in their own PayPal account, PayPal may or may not use some of their details from their user profile to pre-populate the billing fields, it is totally up to them, and cannot be controlled from the API side.
  • PayPal may or may not require some of the Billing fields to be filled in depending on the currency, the shipping country, geolocation of the request or any other parameters they see fit.

So I think as long as the whole payment process is built around an API without explicit support to provide the Billing details it is not really an issue with the implementation of WooCommerce PayPal Checkout Payment Gateway, even though it could in theory use a different API, which would allow the handling of the Billing details, but after all that would be a substantial rework of the plugin, not really just a few fixes here and there.

For example there is another one, the REST API for PayPal, which apparently supports sending the billing address. See the Create order method, which allows to pass a Payer object, which in turn contains an Address object, which according to the linked docs:

Also referred to as the billing address of the customer.

This is the API referenced in the walkthrough to set up Paypal Checkout in general, while the NVP/SOAP API is marked as deprecated since 2017, even though the deprecation may only refer to the client side (JS) usage...

@donmarkon
Copy link

Any update regarding this?

@LCmry LCmry added priority: high The issue/PR is high priority—it affects lots of customers substantially, but not critically. and removed status: needs author reply labels Jun 19, 2021
@tcivie
Copy link

tcivie commented Sep 23, 2021

Having the same issue, Any updates on this?
The shipping information is passed when using the PayPal gold button but not when using the "Debit or Credit Card" option.

@ntrpnr
Copy link

ntrpnr commented Nov 3, 2021

I'm facing the same issue as @tcivie
Edit: The shipping info is passed if a user is logged in to WP

@ifnull
Copy link

ifnull commented Jan 26, 2022

It probably doesn't matter at this point because this plugin appears to be end-of-life, but I think this is similar to an issue my team encountered. The solution was to apply a filter to woocommerce_paypal_express_checkout_request_body to remove PAYMENTREQUEST_0_SHIPTO* params when NOSHIPPING is present.

add_filter('woocommerce_paypal_express_checkout_request_body', array($this, 'correct_paypal_params_for_no_shipping'), 9999, 1);

public function correct_paypal_params_for_no_shipping($params){
    if (array_key_exists('NOSHIPPING', $params) && 1 == $params['NOSHIPPING']){
        $params = array_filter($params, function($key){
            return !(0 === strpos($key, 'PAYMENTREQUEST_0_SHIPTO'));
        }, ARRAY_FILTER_USE_KEY);
    }
    return $params;
}

Related ticket: #878

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: high The issue/PR is high priority—it affects lots of customers substantially, but not critically.
Projects
None yet
Development

No branches or pull requests

9 participants