Skip to content

Conversation

@hmouhtar
Copy link
Collaborator

Unlike other contexts, the Pay for Order page does not process the payment over AJAX, it uses a regular form submission.

When there is an error during payment processing on this page, there is no way to notify that to the frontend before or after the page is reloaded. Since the AppSwitch hash params are still present in the URL upon reload, the AppSwitch flow is triggered again, causing an infinite reload loop.

To fix this, this PR adds code to preemptively remove the hash params from the URL on the onApprove callback, before the payment is processed.

@hmouhtar hmouhtar requested review from AlexP11223 and Narek13 July 29, 2025 00:42
@hmouhtar hmouhtar marked this pull request as ready for review July 29, 2025 00:42
Copy link
Collaborator

@Narek13 Narek13 left a comment

Choose a reason for hiding this comment

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

Haven't tested but code wise looks good to me. Thanks

@hmouhtar hmouhtar changed the base branch from trunk to develop August 26, 2025 16:42
@github-actions
Copy link

github-actions bot commented Aug 26, 2025

Test using WordPress Playground

The changes in this pull request can be previewed and tested using a WordPress Playground instance.
WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

🔗 Test this pull request with WordPress Playground

What's included:

  • ✅ WordPress (latest)
  • ✅ WooCommerce (latest)
  • ✅ PayPal Payments plugin v3.0.9-pr3562-17446445888-g3a088e0 (built from this PR)

Login credentials:

  • Username: admin
  • Password: password

Plugin Details:

  • Version: 3.0.9-pr3562-17446445888-g3a088e0
  • Commit: 3a088e0
  • Artifact: woocommerce-paypal-payments-3.0.9-pr3562-17446445888-g3a088e0

💡 The demo environment resets each time you refresh. Perfect for testing!

🔄 This link updates automatically with each new commit to the PR.

⚠️ This URL is valid for 30 days from when this comment was last updated.


🤖 Auto-generated for commit 3a088e0 • Last updated: 2025-09-03T21:29:25.588Z

@hmouhtar hmouhtar changed the base branch from develop to PCP-4712-appswitch-qa September 3, 2025 21:10
@hmouhtar hmouhtar force-pushed the PCP-4712-appswitch-qa branch from d4a3b6d to c7270c8 Compare September 3, 2025 21:12
@hmouhtar hmouhtar merged commit a6b1d35 into PCP-4712-appswitch-qa Sep 3, 2025
13 checks passed
@hmouhtar hmouhtar deleted the PCP-5031 branch September 3, 2025 21:22
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.

3 participants