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

Payments using the Express Checkout Element fail if card testing prevention is enabled #8981

Closed
asumaran opened this issue Jun 18, 2024 · 10 comments · Fixed by #8987
Closed
Assignees
Labels
focus: fraud tools type: bug The issue is a confirmed bug.

Comments

@asumaran
Copy link
Contributor

asumaran commented Jun 18, 2024

Describe the bug

Originally reported by @ricardo in #8937 (comment). A site with the Fraud Prevention Service enabled fails to checkout using the Express Checkout Element.

To Reproduce

  • In the WP folder of your local server run the following command to enable the card testing protection service:
    wp wcpay set_account_meta 233401173 --key=card_testing_prevention_enabled --value=1
    
  • Go to "WCPay Dev" in the admin area of the merchant store.
  • Click "clear" to refresh the account data. Confirm card_testing_protection_eligible is set to true
  • Enable ECE by running the following command in the merchant's WP folder:
    wp option update _wcpay_feature_stripe_ece 1
    
  • Attempt a purchase using Google Pay or Apple Pay.

Actual behavior

Error message is shown: "We're not able to process this payment. Please refresh the page and try again." on checking out using ECE.

Expected behavior

Payment should finish without issues and no error should be displayed.

@vbelolapotkov
Copy link
Collaborator

@dwainm although it's focused on checkout, I think it's a better fit for your team due to carding prevention involved. Could you please prioritize it and take a look?

@asumaran
Copy link
Contributor Author

asumaran commented Jun 19, 2024

It would be ideal if we could confirm whether this is a legitimate issue or if it only occurs when using the local server.

@dwainm
Copy link
Contributor

dwainm commented Jun 20, 2024

Sure @vbelolapotkov , we'll take a look at it.

@tpaksu
Copy link
Contributor

tpaksu commented Jun 25, 2024

@asumaran hey 👋 I think you forgot to send the card testing nonce in the checkout data to the server, which is added to the page when the card testing prevention is enabled, and checked by the server. That might be the cause of it. If you have capacity to solve it by looking to the previous code about how it was sent, feel free to own the issue, otherwise, you'd need to help us set up ECE on our locals :)

@tpaksu
Copy link
Contributor

tpaksu commented Jun 25, 2024

Also FYI, I added a setting to the WCPay dev tools plugin that mimics the card testing prevention flag as activated on the client. You can use that option to test this scenario too.

@asumaran
Copy link
Contributor Author

@tpaksu I've noticed that the wcpay-fraud-prevention-token is defined on the cart and checkout pages, but it’s missing from the product page. When the token is present, the checkout process completes smoothly.

I'll address this for ECEs (and PRBs) as I'm currently handling it.

@asumaran asumaran self-assigned this Jun 25, 2024
@asumaran
Copy link
Contributor Author

asumaran commented Jun 25, 2024

The token isn't being added to the product page

// Don't add the token if the user isn't on the cart or checkout page.
// Checking the cart page too because the user can pay quickly via the payment buttons on that page.
if ( ! is_checkout() && ! is_cart() ) {
return;
}

@asumaran
Copy link
Contributor Author

I'll submit the fix as part of #8987

@tpaksu
Copy link
Contributor

tpaksu commented Jun 26, 2024

Thanks for the confirmation, the digging, and finding the fix @asumaran! Let me know if you need anything.

@asumaran
Copy link
Contributor Author

Just FYI: The wcpay-fraud-prevention-token token was also missing from the Pay for order page. I'm fixing it here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
focus: fraud tools type: bug The issue is a confirmed bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants