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

Implement payments via Express Checkout Element for Simple Products on the Product Page #8937

Merged
merged 65 commits into from
Jun 18, 2024

Conversation

asumaran
Copy link
Contributor

@asumaran asumaran commented Jun 10, 2024

Fixes #8868

Changes proposed in this Pull Request

Implements payments using the Express Checkout Elements API.
This feature is behind the _wcpay_feature_stripe_ece flag.

Testing instructions

Note that the changes on this PR are the same as #8914. So, please make sure to follow the setup instructions before starting to test this PR.

Testing on this PR must focus on the product page for simple products only.

Note

There shouldn't be any problem with testing Google Pay or Apple Pay using your own credit card. Just make sure the site is in test mode.

Visit the product page for a simple product then:

Pay using Google Pay

  • Verify shipping address can be changed.
  • Verify the order is created with correct amount.
  • Verify line items are present in the payment sheet.
  • Verify tax is applied to the totals.
  • Test with a US shipping address.
  • Test with a US billing address.

Pay using Apple Pay

  • Verify shipping address can be changed.
  • Verify the order is created with correct amount.
  • Verify line items are present in the payment sheet.
  • Verify tax is applied to the totals.
  • Test with a US shipping address.
  • Test with a US billing address.

  • Run npm run changelog to add a changelog file, choose patch to leave it empty if the change is not significant. You can add multiple changelog files in one PR by running this command a few times.
  • Covered with tests (or have a good reason not to test in description ☝️)
  • Tested on mobile (or does not apply)

Post merge

@ricardo
Copy link
Member

ricardo commented Jun 11, 2024

@asumaran As noted from #8914, the checkout from the product page didn't work for me. I figured out why:

In case the fraud prevention service is enabled for the account, I guess we're not passing the token correctly here, so it throws this error:

We're not able to process this payment. Please refresh the page and try again.

If I comment out that check I can proceed with the checkout.

@ricardo
Copy link
Member

ricardo commented Jun 12, 2024

Just to add to the above comment. I'm also having problems checking out with a saved card while the fraud prevention service is enabled, so this is either a problem with my local environment or a more general issue.

Copy link
Contributor

@lovo-h lovo-h left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code changes are looking good and testing well.

I left a few comments we may want to address before merging.

Testing Instructions

  • ✅ Pay using Google Pay. All tests passed.
  • ✅ Pay using Apple Pay. All tests passed.
  • npm run test:js and npm run test:php.

client/express-checkout/event-handlers.js Outdated Show resolved Hide resolved
client/express-checkout/event-handlers.js Show resolved Hide resolved
client/express-checkout/index.js Show resolved Hide resolved
client/express-checkout/index.js Show resolved Hide resolved
client/express-checkout/index.js Show resolved Hide resolved
client/express-checkout/index.js Show resolved Hide resolved
client/express-checkout/index.js Outdated Show resolved Hide resolved
client/express-checkout/index.js Show resolved Hide resolved
@asumaran
Copy link
Contributor Author

@ricardo, I was able to see the bug, too.
However, let's handle it separately since I'm not sure if it's fixable for ECE right now, given that the same error happens for PRBs. What do you think, @bborman22?
That being said, shall we go ahead and merge this pull request?

@bborman22
Copy link
Contributor

@asumaran @ricardo Just to confirm this is the bug with checking out with a saved card while the fraud prevention service is enabled? And both of you are able to reproduce. If it happens on PRBs as well today, it shouldn't block this PR and we should create an issue to track it instead.

@asumaran
Copy link
Contributor Author

asumaran commented Jun 18, 2024

@bborman22 I was referring to the bug while the prevention service is enabled for the site. I didn't test with saved cards but I assume we'll have the same results.

@asumaran asumaran enabled auto-merge June 18, 2024 18:16
@asumaran asumaran requested a review from lovo-h June 18, 2024 18:27
Copy link
Contributor

@lovo-h lovo-h left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code changes LGTM 👍

@asumaran asumaran added this pull request to the merge queue Jun 18, 2024
Merged via the queue into develop with commit a66ec0b Jun 18, 2024
23 checks passed
@asumaran asumaran deleted the as-8868-ece-product-page-2 branch June 18, 2024 20:45
@asumaran
Copy link
Contributor Author

@bborman22 @ricardo I've created an issue for the issue we have with ECE and the Card Testing Protection Service. #8981

@asumaran
Copy link
Contributor Author

@bborman22 @ricardo ^ I'm fixing #8981 in #8987. The fix was pretty straightforward 59f8f33

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Integrate ECE for Payment Processing in the product page
8 participants