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

[ECE] Payment processing with taxes #3472

Closed
Tracked by #3381
Mayisha opened this issue Sep 25, 2024 · 9 comments
Closed
Tracked by #3381

[ECE] Payment processing with taxes #3472

Mayisha opened this issue Sep 25, 2024 · 9 comments
Assignees
Labels
component: ECE Issues related to Express Checkout Element

Comments

@Mayisha
Copy link
Contributor

Mayisha commented Sep 25, 2024

Process payment with ECE Google Pay / Apple Pay button when tax is applied to the order.

Acceptance criteria

  • The payment is processed successfully with no error.
  • The total amount is correct in the order.
  • The charged amount by Google Pay / Apple Pay is correct and it matches the order's total amount.
@annemirasol
Copy link
Contributor

The ECE behavior seems correct, and matches PRB behavior -- the tax computation is based on the shipping address chosen in the PRB/ECE modal, which makes sense to me.

For example, I added a 10% tax for all CA addresses, and checked out a cart worth $18. The total becomes $19.80.

Screenshot 2024-09-26 at 12 57 21 PM

Changing the shipping address to a location not defined in my tax table, I get a total without taxes.

Screenshot 2024-09-26 at 12 58 07 PM

Is there anything else we want to check here?

@Mayisha
Copy link
Contributor Author

Mayisha commented Sep 27, 2024

Thanks @annemirasol for checking this.

  1. We need to test with different tax settings, especially with prices entered with/without tax and taxes based on billing, shipping, and store address.
Screenshot 2024-09-28 at 4 14 48 AM
  1. Check these tax related issues from WooPayments and see if we also have these problems.

@annemirasol annemirasol self-assigned this Sep 30, 2024
@annemirasol
Copy link
Contributor

Some findings: Similar to WooPayments, we are unable to display the correct tax amount in the express checkout modal if the product is virtual. This is regardless of whether tax is based on shipping address or based on billing address.

WooPayments has elected to disable express checkout for this scenario -- we likely will need to do the same but I will be doing my own timeboxed investigation if there are other potential solutions.

@annemirasol
Copy link
Contributor

annemirasol commented Oct 11, 2024

The following tax scenarios were tested:

  • Tax based on shop location
    • ✅ Displays and charges correct taxes
  • Tax based on customer shipping address
    • ✅ Shippable cart: displays and charges correct taxes
    • ✅ Non-shippable cart: ECE modal displays the cart total with no taxes applied, but then charges taxes after user clicks "Pay". In Disable ECE for incompatible tax scenarios #3493, we hide ECE for no-shipping products and carts.
  • Tax based on customer billing address
    • ❗ We do not have access to the billing address attached to the ECE card used until after the user clicks "Pay". This means that we might display the wrong tax and total in the ECE modal.
    • ❓ Shippable cart: If the billing address is not the same as the shipping address -- this is possible if the user has several addresses in https://payments.google.com/gp/w/home/addressbook -- we might display the incorrect tax in the ECE modal, but charge the correct tax on payment.
    • ✅ Non-shippable product: ECE modal displays the cart total with no taxes applied, but then charges taxes after user clicks "Pay". In Disable ECE for incompatible tax scenarios #3493, we hide ECE for no-shipping products and carts.

*For each scenario, "Default customer location" is set to "No location by default", in order to test for scenarios where we have incomplete information.

@Mayisha
Copy link
Contributor Author

Mayisha commented Oct 14, 2024

Hi @annemirasol 👋

❗ We do not have access to the billing address attached to the ECE card used until after the user clicks "Pay". This means that we might display the wrong tax and total in the ECE modal.

Are we already hiding the ECE button in this case or do we need a fix for this?

❓ Shippable cart: If the billing address is not the same as the shipping address -- this is possible if the user has several addresses in https://payments.google.com/gp/w/home/addressbook -- we might display the incorrect tax in the ECE modal, but charge the correct tax on payment.

As you mentioned in the previous point, we do not have access to the billing address attached to the ECE card used until after the user clicks "Pay". Isn't the tax (and final payment) supposed to be calculated wrong for this scenario as well then? 🤔

@annemirasol
Copy link
Contributor

@Mayisha

Isn't the tax (and final payment) supposed to be calculated wrong for this scenario as well then? 🤔

Correct, as long as the tax is based on the billing address, there is a chance the tax amount we display in the modal will be incorrect 😔.

Are we already hiding the ECE button in this case or do we need a fix for this?

Currently, we are only hiding it if the cart is not shippable i.e. there is no billing and shipping address available to the express checkout modal. The tax amount displayed will be incorrect if:

  • the customer's assumed location (set by "Default Customer Location" inside admin) is not the same as the actual location, and
  • the tax rates are different for the assumed location and actual location.

When the cart is shippable, the tax amount displayed will be incorrect if:

  • the selected shipping address is different from the card billing address.
  • the tax rates are different for the shipping address and billing address.

I do not know whether this latter scenario is equally likely as the former. What do you think? Do you think we should just turn off express checkout whenever taxes are based on billing address? We can easily do that, but I am worried that this kind of tax setup is very common, which would mean a lot of merchants will basically lose the option to have express checkout for their stores.

Some other options I am mulling over:

  • Let the displayed taxes be wrong. We can display a notice that final taxes charged can differ based on the actual billing address.
  • Let the merchant decide (as a toggable settings option) if they want to hide express checkout if tax computation can sometimes be inaccurate.

LMK what you think!

@Mayisha
Copy link
Contributor Author

Mayisha commented Oct 17, 2024

Thanks @annemirasol for the details.

Let the displayed taxes be wrong. We can display a notice that final taxes charged can differ based on the actual billing address.

I have created an issue for this #3521. As the final charged amount is correct, allowing the user to pay with the ECE button should be fine.

@Mayisha
Copy link
Contributor Author

Mayisha commented Oct 17, 2024

Closing this issue as

  • The investigation is completed and things are working as expected.
  • We disabled ECE for incompatible tax scenarios.
  • Created a separate issue for displaying tax related notices.

@Mayisha Mayisha closed this as completed Oct 17, 2024
@annemirasol
Copy link
Contributor

When there are no shipping locations defined, WC()->cart->needs_shipping() will return false, even if the cart contains shippable products. This means that, because of #3493, ECE will not show up if the store does not have any shipping locations defined, and tax is based on billing or shipping.

This is expected, and maybe even desired, as Google Pay will not let you select a shipping address that is not defined in the store's shipping locations. For example, if a Google Pay account has two shipping addresses connected to it, e.g. United States and United Kingdom, and only United States is defined as a shipping location, the customer cannot select the United Kingdom address inside the Google Pay modal.

@Mayisha Mayisha added the component: ECE Issues related to Express Checkout Element label Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: ECE Issues related to Express Checkout Element
Projects
None yet
Development

No branches or pull requests

2 participants