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

Adding Amazon Pay to the classic checkout #3793

Merged
merged 20 commits into from
Feb 3, 2025

Conversation

wjrosa
Copy link
Contributor

@wjrosa wjrosa commented Jan 29, 2025

Fixes #3733

Changes proposed in this Pull Request:

This PR introduces Amazon Pay as a new payment method for the Stripe Express Checkout Element on the classic checkout, product, and cart pages.

Most of the implementation was done using the other wallet methods as a reference to avoid the method showing up as another option on the regular checkout (not ECE).

Testing instructions

  • Create an Amazon Pay sandbox account (if you don't have it already)
  • Checkout and build this branch on your test environment
  • Connect your Stripe account
  • Configure webhooks
  • As a merchant, enable the Amazon Pay express payment method
  • As a shopper, access your test store using a public-facing address (Ngrok or JN website)
  • Confirm you can see the Amazon Pay button on the classic checkout, product, and cart pages
Screenshot 2025-01-30 at 19 28 05
  • Confirm you can complete the checkout process on all the pages above (logged-in and anonymously). Try physical and virtual products. Amazon Pay is a async method, so it may take around 5 minutes to confirm
  • As a merchant, confirm the payment title is correctly displayed:
Screenshot 2025-01-30 at 19 26 51
  • 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

@wjrosa wjrosa self-assigned this Jan 29, 2025
Base automatically changed from add/amazon-pay-to-settings to develop January 30, 2025 04:17
@wjrosa wjrosa force-pushed the add/amazon-pay-to-classic-checkout branch from 56943b2 to ed5e933 Compare January 30, 2025 14:05
@@ -41,8 +41,9 @@ public function __construct() {
* @return string
*/
public function get_title( $payment_details = false ) {
if ( $payment_details && isset( $payment_details->card->wallet->type ) ) {
return $this->get_card_wallet_type_title( $payment_details->card->wallet->type );
$wallet_type = WC_Stripe_Payment_Methods::AMAZON_PAY === ( $payment_details->type ?? null ) ? WC_Stripe_Payment_Methods::AMAZON_PAY : ( $payment_details->card->wallet->type ?? null );
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe I should replace this with another IF. A bit confusing to read.

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree an if-else clause might be easier to read here. 👍

@wjrosa wjrosa marked this pull request as ready for review January 30, 2025 22:22
@wjrosa wjrosa requested review from a team and annemirasol and removed request for a team January 31, 2025 13:52
Copy link
Contributor

@annemirasol annemirasol left a comment

Choose a reason for hiding this comment

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

This looks great, and tests out well ✨ Love the unit tests!

  • Verified working well in:
    • product page
    • shortcode cart
    • shortcode checkout
  • Verified that charges clear and payment method title is correct

🚢🚢🚢

@annemirasol
Copy link
Contributor

Oh, missed this! We need to hook Amazon Pay to a different setting. Currently, it still gets shown even when Amazon Pay is turned off:

Screenshot 2025-01-31 at 2 11 23 PM

@wjrosa
Copy link
Contributor Author

wjrosa commented Feb 3, 2025

Oh, missed this! We need to hook Amazon Pay to a different setting. Currently, it still gets shown even when Amazon Pay is turned off:

Screenshot 2025-01-31 at 2 11 23 PM

Thanks for the review, Anne! I have fixed the setting issue in 14e849d

@wjrosa
Copy link
Contributor Author

wjrosa commented Feb 3, 2025

We may need to turn Link and Amazon Pay independent from Google/Apple Pay. Right now, both only works if the first is enabled.

@wjrosa wjrosa merged commit cfabad4 into develop Feb 3, 2025
37 checks passed
@wjrosa wjrosa deleted the add/amazon-pay-to-classic-checkout branch February 3, 2025 14:30
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.

Amazon Pay ECE: add to classic checkout
3 participants