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

Integrating ECE to shortcode checkout #3436

Merged
merged 131 commits into from
Sep 25, 2024
Merged

Conversation

wjrosa
Copy link
Contributor

@wjrosa wjrosa commented Sep 13, 2024

Fixes #3404
Doc: https://docs.stripe.com/elements/express-checkout-element

Changes proposed in this Pull Request:

This PR introduces the new Stripe Express Checkout Element to our shortcode checkout, replacing the current PRB version.

This integration is heavily based on WCPay's, with just some adjustments to adapt the code to our needs and standards.

Testing instructions

  • Apply this PR to your test environment (add/ece-for-shortcode-checkout)

  • Make sure it is publicly accessible. You can use ngrok for this (or a JN website)

  • Enable the ECE flag. You can hardcode is_stripe_ece_enabled to true

  • As a merchant, connect your Stripe account and create a shortcode checkout page

  • As a customer, add any product to your cart

  • Go to the shortcode checkout page

  • Confirm that the new ECE buttons are loaded:
    Screenshot 2024-09-19 at 14 26 50

  • Confirm that you can place an order successfully


  • Covered with tests (or have a good reason not to test in description ☝️)
  • Added changelog entry in both changelog.txt and readme.txt (or does not apply)
  • Tested on mobile (or does not apply)

Post merge

cc @Mayisha

@wjrosa wjrosa self-assigned this Sep 13, 2024
Base automatically changed from task/ece-backend to develop September 16, 2024 20:55
Copy link
Contributor

@mattallan mattallan left a comment

Choose a reason for hiding this comment

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

Thanks for kicking these changes off Wesley, I've just taken a quick code review and left some notes.

I will base my branch off this PR to start looking at implementing ECE on the product page

client/entrypoints/express-checkout/index.js Show resolved Hide resolved
includes/class-wc-stripe-feature-flags.php Outdated Show resolved Hide resolved
client/entrypoints/express-checkout/utils/normalize.js Outdated Show resolved Hide resolved
client/entrypoints/express-checkout/index.js Outdated Show resolved Hide resolved
@wjrosa
Copy link
Contributor Author

wjrosa commented Sep 23, 2024

Thanks, @Mayisha ! Can you and @james-allan test this again now that I have rebased it with your newly created PR?

Base automatically changed from task/ece-common-js-functions to develop September 23, 2024 18:34
// option IDs.
throw new Exception( __( 'Unable to provide shipping options for express checkout.', 'woocommerce-gateway-stripe' ) );
// The Payment Requests will try to load indefinitely if there are duplicate shipping option IDs.
throw new Exception( __( 'Unable to provide shipping options for Payment Requests.', 'woocommerce-gateway-stripe' ) );
Copy link
Contributor

Choose a reason for hiding this comment

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

QQ - Is the wording of this message and the comment above intentionally changed from express checkout to Payment requests?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think so, to make sense with the class name. This specific line was changed by @mattallan

client/entrypoints/express-checkout/index.js Outdated Show resolved Hide resolved
@wjrosa
Copy link
Contributor Author

wjrosa commented Sep 24, 2024

@Mayisha, I have fixed the issue you reported on Slack. Some parameters were missing from the fake cart data provided. Now, it is working fine for me (I hope it fixes it for you folks, too).

@james-allan
Copy link
Contributor

This looks good to me. I tested a couple of different general scenarios.

  • Basic purchases as a logged in user and logged out (as a guest).
  • Subscription purchases.
  • Subscription renewals.
  • Free trial subscriptions. (Not available - see is_invalid_subscription_product())
  • Errors - I'm not sure if there's good way to test failures, however, I forced errors by invaliding the payment request.
Screenshot 2024-09-25 at 3 27 05 pm
  • I changed the checkout button settings in the plugin and confirmed they are reflected on the checkout
Screenshot 2024-09-25 at 3 28 53 pm
  • 🔴 I checkouts with a coupon applied. This failed and the checkout remained blocked.
Screenshot 2024-09-25 at 3 37 32 pm
  • 🟢 I tested various shipping setups and confirmed that the order total in the model and the Stripe Dashboard was correct.
    • I chose a shipping method, changed it via the Google Pay pop up. See example video below.

https://github.com/user-attachments/assets/f09ed8fb-2bfa-4545-98e3-48c258a7e35c\

I checkouts with a coupon applied. This failed and the checkout remained blocked.

I'm happy if we want to handle this separately given the large size of this PR and the other work depending on this PR being merged.

@Mayisha I'm not sure if there are other specific tests you had you want us to check as part of this feature. Let me know if there are specific flows we should check etc. :)

Copy link
Contributor

@Mayisha Mayisha left a comment

Choose a reason for hiding this comment

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

Thanks @wjrosa for the implementation. I have tested with Google Pay and everything is working on the shortcode checkout page.

✅ Purchasing simple product, digital product, simple subscription work.
✅ Checkout with different shipping methods (free, flat rate) works. Tested by changing the shipping method both from checkout page and Google Pay modal.
✅ I can not reproduce the issue related to shipping address anymore.

Thanks @james-allan for testing other scenarios. I have created separate issues for the coupon and payment method title errors.

@wjrosa wjrosa merged commit 22c96f5 into develop Sep 25, 2024
35 checks passed
@wjrosa wjrosa deleted the add/ece-for-shortcode-checkout branch September 25, 2024 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[ECE] Implement ECE for payment processing on shortcode checkout page
4 participants