Skip to content

PayPal Payment Buttons: Add a V2 rollout and kill switch on WordPress.com, and stop gating live onboarding on the flag - #55273

Open
tx2pnw wants to merge 2 commits into
trunkfrom
add/wooptp-607-paypal-buttons-rollout
Open

tx2pnw wants to merge 2 commits into
trunkfrom
add/wooptp-607-paypal-buttons-rollout

Conversation

@tx2pnw

@tx2pnw tx2pnw commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Part of WOOPTP-607

Proposed changes

Add a percent rollout and a kill switch for PayPal Buttons V2 on WordPress.com, shipped at 0%, and stop gating live PayPal onboarding on the flag.

  • Simple: V2 (API-managed buttons) is on for a site when the site's bucket is under PERCENT. Every user on the site gets the same answer. PERCENT ships at 0.
  • Atomic: V2 is on only when PERCENT is 100.
  • A site's Feature Flags override (force on or force off) beats the rollout.
  • Kill switch: the KILLED constant (Simple and Atomic) or a network option (Simple only) turns V2 off and beats the override. Ships off.
  • On WordPress.com the rollout ignores the flag's registered default, so flipping that default in the package does not turn V2 on for every WordPress.com site.
  • Live PayPal onboarding on signup-link, merchant-integration and the request forwarder no longer checks the flag. It is open to any connected site from merge, and only the kill switch closes it. When killed, these routes return 403 platform_production_not_enabled with "PayPal is temporarily unavailable. Please try again later." Sandbox stays open.

At merge the onboarding change is the only one that goes live. V2 stays off on every site without a force-on override. Flag: paypal-payments-api-managed-buttons.

Why are these changes being made?

V2 has to go live on WordPress.com in steps and be switchable off fast. Today it is one off-by-default flag with no ramp and no off switch. The onboarding endpoints read that flag on the WordPress.com blog that serves the request, not the caller's site, so a ramp could never open them.

Related product discussion/links

  • WOOPTP-607
  • p1795032163536059-slack-CDLH4C1UZ

Does this pull request change what data or activity we track or use?

No.

Details

Details
  • Accepted risk: from merge, any Jetpack-connected site can call the three onboarding routes against live PayPal. The seller ownership check is unchanged. Tying this to the flag or to PERCENT > 0 would check the wrong site for remote callers and would block the pilot and kill testing.
  • rollout_default() ignores the incoming $enabled on purpose. That value is the package's registered default, so || $enabled would let a default flip turn V2 on for all of WordPress.com.
  • Ramp and kill PRs change only PERCENT or KILLED. The tests set both through the wpcom_paypal_buttons_rollout_percent / wpcom_paypal_buttons_kill_switch filters, the kill option or a subclass, so those PRs merge green.
  • Onboarding tests changed: test_production_is_refused_until_the_flag_opens_it is now test_production_is_refused_only_while_killed. test_credentials_for_other_environment_are_rejected and test_production_environment_uses_live_host open production through enable_production(), which turns the kill switch off.

Testing instructions

jetpack test php packages/jetpack-mu-wpcom

Wpcom_PayPal_Buttons_Rollout_Test covers the bucket, Atomic, override, kill and default-flip cases. WPCOM_REST_API_V2_Endpoint_PayPal_Onboarding_Test covers the kill switch on all three onboarding routes.

Load this branch on a Simple site (build plugins/mu-wpcom-plugin). In wp shell, on a site with no feature flag override:

use Automattic\Jetpack\Feature_Flags\Feature_Flags;
$f = 'paypal-payments-api-managed-buttons';

Feature_Flags::is_enabled( $f ); // false - shipped at 0%

add_filter( 'wpcom_paypal_buttons_rollout_percent', fn() => 100 );
Feature_Flags::is_enabled( $f ); // true

add_filter( 'wpcom_paypal_buttons_kill_switch', '__return_true' );
Feature_Flags::is_enabled( $f ); // false - kill beats the rollout

Without this PR the flag reads false all three times.

Onboarding: on a Jetpack-connected site, request a production signup link from wp shell:

Automattic\Jetpack\Connection\Client::wpcom_json_api_request_as_blog( '/paypal/platform/signup-link', '2', array( 'method' => 'POST', 'headers' => array( 'Content-Type' => 'application/json' ) ), wp_json_encode( array( 'environment' => 'production', 'return_url' => home_url( '/' ) ) ), 'wpcom' );
  • This PR, shipped values: 200 with a signup link.
  • This PR with KILLED set to true: 403 platform_production_not_enabled, "PayPal is temporarily unavailable. Please try again later."
  • Same call with 'environment' => 'sandbox' and KILLED set to true: 200.

@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ Add a "[Status]" label (In Progress, Needs Review, ...).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖


Follow this PR Review Process:

  1. Ensure all required checks appearing at the bottom of this PR are passing.
  2. Make sure to test your changes on all platforms that it applies to. You're responsible for the quality of the code you ship.
  3. You can use GitHub's Reviewers functionality to request a review.
  4. When it's reviewed and merged, you will be pinged in Slack to deploy the changes to WordPress.com simple once the build is done.

If you have questions about anything, reach out in #jetpack-developers for guidance!

@github-actions github-actions Bot added the [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. label Nov 19, 2026
@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.

  • To test on WoA, go to the Plugins menu on a WoA dev site. Click on the "Upload" button and follow the upgrade flow to be able to upload, install, and activate the Jetpack Beta plugin. Once the plugin is active, go to Jetpack > Jetpack Beta, select your plugin (WordPress.com Site Helper), and enable the add/wooptp-607-paypal-buttons-rollout branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack-mu-wpcom-plugin add/wooptp-607-paypal-buttons-rollout

Interested in more tips and information?

  • In your local development environment, use the jetpack rsync command to sync your changes to a WoA dev blog.
  • Read more about our development workflow here: PCYsg-eg0-p2
  • Figure out when your changes will be shipped to customers here: PCYsg-eg5-p2

@jp-launch-control

Copy link
Copy Markdown

Code Coverage Summary

Coverage changed in 1 file.

File Coverage Δ% Δ Uncovered
projects/packages/jetpack-mu-wpcom/src/class-jetpack-mu-wpcom.php 102/543 (18.78%) 0.30% 0 💚

1 file is newly checked for coverage.

File Coverage
projects/packages/jetpack-mu-wpcom/src/features/wpcom-feature-flags/class-wpcom-paypal-buttons-rollout.php 11/11 (100.00%) 💚

Full summary · PHP report · JS report

@tx2pnw
tx2pnw force-pushed the add/wooptp-607-paypal-buttons-rollout branch from 0056673 to 6f7319b Compare November 19, 2026 22:54
@tx2pnw tx2pnw changed the title PayPal Payment Buttons: Add a WordPress.com rollout and kill switch for V2, shipped at 0% PayPal Payment Buttons: Add a V2 rollout and kill switch on WordPress.com, and stop gating live onboarding on the flag Nov 19, 2026
@tx2pnw
tx2pnw marked this pull request as ready for review November 19, 2026 22:54

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant