Skip to content

PayPal Payment Buttons: put the API-managed buttons behind a feature flag - #51982

Open
millerf wants to merge 6 commits into
add/paypal-payment-buttons-v2from
add/paypal-api-managed-buttons-flag
Open

PayPal Payment Buttons: put the API-managed buttons behind a feature flag#51982
millerf wants to merge 6 commits into
add/paypal-payment-buttons-v2from
add/paypal-api-managed-buttons-flag

Conversation

@millerf

@millerf millerf commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Fixes PAYPAL-180

Proposed changes

Puts the API-managed PayPal Payment Buttons (V2) behind a jetpack-feature-flags flag, paypal-payments-api-managed-buttons, off by default, so the V2 work can merge without shipping.

  • Package — registers the flag and exposes it through PayPal_Payment_Buttons::is_api_managed_enabled() and add_editor_feature_flags(). While the flag is off, the wpcom/v2/paypal/* REST routes, the Payment Links admin page, the email sender AJAX action, and the sharing hook are not registered. Rendering is deliberately not gated, so a button created while the flag was on keeps working after it is turned off.
  • Editor — the block's edit.jsx is now a thin switch. The V2 editor moved to edit-api-managed.jsx; trunk's paste-code editor is restored as edit-paste-code.jsx (with its styles) and is what the block shows while the flag is off. The two are separate components so the V2 connection hooks, which call routes that only exist while the flag is on, never run on the paste-code path. An API-managed block seen with the flag off shows a read-only preview with a notice.
  • Jetpack plugin — registers the flag in the block loader and bridges it through jetpack_block_editor_feature_flags, so JS reads it with hasFeatureFlag(). Also restores trunk's WordPress.com plan gate (plan_check => true and the value_bundle upsell fallback), which the V2 port had dropped; that gate is current pricing policy (DOTCOM-15310, Gate PayPal payment buttons block behind conditional features #46536) and this PR should not lift it.
  • Standalone plugin — registers the flag and adds feature_flags to the editor state it already localizes.
  • Regenerates both plugin lock files for the new package dependency, and documents how to turn the flag on in the package DEVELOPMENT.md.

Related product discussion/links

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

No.

Testing instructions

Flag off (default)

  • Build and sync plugins/jetpack or plugins/paypal-payment-buttons to a test site.
  • Insert a PayPal Payment Buttons block: it shows the paste-code placeholder, as on trunk.
  • wp eval 'var_dump( array_keys( \Automattic\Jetpack\Feature_Flags\Feature_Flags::all() ) );' lists paypal-payments-api-managed-buttons.
  • curl -s <site>/wp-json/wpcom/v2/paypal/connection returns rest_no_route, and there is no Payment Links entry under the Jetpack (or Settings) menu.

Flag on

  • On Jurassic Ninja: wp companion feature-flag enable paypal-payments-api-managed-buttons. Elsewhere, drop add_filter( 'jetpack_feature_flag_enabled_paypal-payments-api-managed-buttons', '__return_true' ); into an mu-plugin.
  • Reload the editor: a new block opens the connection wizard, the REST route above answers, and Payment Links appears in the menu.
  • Create a button, then turn the flag off again: the published button still renders on the frontend, and the block shows a read-only preview in the editor.

Automated

  • jp test php packages/paypal-payments and jp test js packages/paypal-payments cover both branches of the flag.

@millerf millerf added Enhancement Changes to an existing feature — removing, adding, or changing parts of it [Status] Needs Review This PR is ready for review. [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Package] Paypal Payments [Plugin] Paypal Payment Buttons labels Sep 4, 2026
@millerf millerf self-assigned this Sep 4, 2026
@github-actions

github-actions Bot commented Sep 4, 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 (Jetpack or WordPress.com Site Helper), and enable the add/paypal-api-managed-buttons-flag branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack add/paypal-api-managed-buttons-flag
bin/jetpack-downloader test jetpack-mu-wpcom-plugin add/paypal-api-managed-buttons-flag

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

@github-actions

github-actions Bot commented Sep 4, 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!


Jetpack plugin:

The Jetpack plugin has different release cadences depending on the platform:

  • WordPress.com Simple releases happen as soon as you deploy your changes after merging this PR (PCYsg-Jjm-p2).
  • WoA releases happen weekly.
  • Releases to self-hosted sites happen monthly:
    • Scheduled release: October 6, 2026

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.


Paypal Payment buttons plugin:

No scheduled milestone found for this plugin.

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.

@jp-launch-control

jp-launch-control Bot commented Sep 4, 2026

Copy link
Copy Markdown

Code Coverage Summary

No summary data is available for parent commit 1e7d9fb, so cannot calculate coverage changes. 😴

If that commit is a feature branch rather than a trunk commit, this is expected. Otherwise, this should be updated once coverage for 1e7d9fb is available.

Full summary · PHP report · JS report

Base automatically changed from fix/paypal-admin-delete-orphans to add/paypal-payment-buttons-v2 September 4, 2026 11:15
@millerf
millerf requested a review from a team as a code owner September 4, 2026 11:22
millerf and others added 3 commits September 4, 2026 13:22
…flag

Register `paypal-payments-api-managed-buttons` (off by default) in the
package and read it from both bootstraps. While it is off the REST routes,
the Payment Links admin page, the email sender, and the sharing hook stay
unregistered, and the block editor shows the paste-code editor restored
from trunk. A button created through the API keeps rendering on the
frontend and shows as a read-only preview in the editor.

Also restores trunk's WordPress.com plan gate on the block (`plan_check`
and the `value_bundle` upsell fallback), which the V2 port had dropped.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
… is off in the changelog

The standalone plugin's e2e suite drives the V2 editor, so it gets an
e2e helper plugin that forces the flag on, mounted like Boost's helpers
and activated by the suite's env scripts. The V2 changelog entries now
say the feature sits behind a flag that is not yet enabled.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@github-actions github-actions Bot added the Docker label Sep 4, 2026
…ndant

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@millerf
millerf force-pushed the add/paypal-api-managed-buttons-flag branch from e20d86a to f9eaa51 Compare September 4, 2026 11:25
…, flipped button default

* Fixed the editor loading the PayPal block bundle twice on every editor screen
* Fixed the onboarding endpoint registering on every site while the feature is off
* Reverted a buttonType default flip that re-rendered already-published buttons
* Fixed the block stylesheet loading on every classic-theme page
* Fixed a warning style leaking onto every warned block in the editor
* Changed the Payment Links admin page to load nothing while the feature is off
* Changed the package to stop shipping 49 KB of internal docs
Two stubs claimed the handle on init, ahead of Script_Data registering the real file
on wp_loaded. The editor bundle imports isWpcomPlatformSite, which only the real
module exports, so the block failed to render with the flag off.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Block] Paypal Payment Buttons Docker Docs E2E Tests Enhancement Changes to an existing feature — removing, adding, or changing parts of it [mu wpcom Feature] Wpcom Endpoints [Package] Jetpack mu wpcom WordPress.com Features [Package] Paypal Payments [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Plugin] Paypal Payment Buttons [Status] Needs Review This PR is ready for review. [Tests] Includes Tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants