Skip to content

WPS migration: specify user_action field for order creation #59942

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

Merged

Conversation

annemirasol
Copy link

@annemirasol annemirasol commented Jul 23, 2025

Submission Review Guidelines:

Changes proposed in this Pull Request:

Part of the WPS migration project. Merges into feature/paypal-wps-migration

I noticed the PayPal payment approval button label is "Review Order", which seemed wrong as clicking it submits the approval for payment capture. It turns out we need to specify user_action as PAY_NOW (default is CONTINUE) (Source)

Before After
Screenshot 2025-07-23 at 11 50 48 AM Screenshot 2025-07-23 at 11 51 12 AM

Related to PAYPAL-30 .

How to test the changes in this Pull Request:

Using the WooCommerce Testing Instructions Guide, include your detailed testing instructions:

  1. If you haven't yet, follow the PayPal Orders v2 basic setup.
  2. As a shopper, add a product to cart and go to checkout.
  3. Click "Proceed to PayPal".
  4. After logging in to your PayPal account, you should see the button say "Pay" instead of "Review Order".

Orders v2 basic setup

  1. You will need a Business sandbox account (merchant) and a Personal sandbox account (shopper).
  2. Set the deprecated PayPal gateway feature flag, and set the Orders v2 migration flag:
    wp option patch update woocommerce_paypal_settings _should_load 'yes'
    wp option patch update woocommerce_paypal_settings use_orders_v2 'yes'
    
  3. Go to WooCommerce > Settings > Payments > and enable PayPal Standard.
  4. Configure PayPal Standard's setting:
  • For PayPal email, enter your merchant sandbox account email.
  • Check Enable PayPal sandbox
  • Check Enable logging (optional, for logging)
  • For Payment action, select Capture
  1. To enable end-to-end testing, add the PayPal API client and secret (used by the feature branch's test proxy):
    wp option update wc_paypal_api_client_id <YOUR-PAYPAL-CLIENT>
    wp option update wc_paypal_api_client_secret <YOUR-PAYPAL-CLIENT-SECRET>
    

Testing that has already taken place:

Changelog entry

  • Automatically create a changelog entry from the details below.
  • This Pull Request does not require a changelog entry. (Comment required below)
Changelog Entry Details

Significance

  • Patch
  • Minor
  • Major

Type

  • Fix - Fixes an existing bug
  • Add - Adds functionality
  • Update - Update existing functionality
  • Dev - Development related task
  • Tweak - A minor adjustment to the codebase
  • Performance - Address performance issues
  • Enhancement - Improvement to existing functionality

Message

Changelog Entry Comment

Comment

This merges into a feature branch. The feature branch will take care of the changelog entry.

@github-actions github-actions bot added the plugin: woocommerce Issues related to the WooCommerce Core plugin. label Jul 23, 2025
@annemirasol annemirasol self-assigned this Jul 23, 2025
@annemirasol annemirasol marked this pull request as ready for review July 23, 2025 17:52
@annemirasol annemirasol requested review from Mayisha and Copilot July 23, 2025 17:53
Copy link
Contributor

github-actions bot commented Jul 23, 2025

Testing Guidelines

Hi @Mayisha @Copilot ,

Apart from reviewing the code changes, please make sure to review the testing instructions (Guide) and verify that relevant tests (E2E, Unit, Integration, etc.) have been added or updated as needed.

Reminder: PR reviewers are required to document testing performed. This includes:

  • 🖼️ Screenshots or screen recordings.
  • 📝 List of functionality tested / steps followed.
  • 🌐 Site details (environment attributes such as hosting type, plugins, theme, store size, store age, and relevant settings).
  • 🔍 Any analysis performed, such as assessing potential impacts on environment attributes and other plugins, conducting performance profiling, or using LLM/AI-based analysis.

⚠️ Within the testing details you provide, please ensure that no sensitive information (such as API keys, passwords, user data, etc.) is included in this public issue.

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds the user_action field specification for PayPal order creation as part of the WPS migration project. The change ensures that the PayPal payment approval button displays "Pay Now" instead of the default "Review Order" text, providing clearer user experience during the payment flow.

  • Adds payment_source configuration with user_action set to PAY_NOW in the PayPal order creation request
  • Improves PayPal button labeling to better reflect the payment action being performed

Copy link
Contributor

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.

Note that this URL is valid for 30 days from when this comment was last updated. You can update it by closing/reopening the PR or pushing a new commit.

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 for improving this @annemirasol. The previous button was very confusing. It's perfect now 👍

@annemirasol annemirasol merged commit e012dd9 into feature/paypal-wps-migration Jul 23, 2025
55 of 56 checks passed
@annemirasol annemirasol deleted the fix/paypal-create-order-user-action branch July 23, 2025 22:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plugin: woocommerce Issues related to the WooCommerce Core plugin.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants