woocommerce / woocommerce-paypal-payments

https://wordpress.org/plugins/woocommerce-paypal-payments/
GNU General Public License v2.0
61 stars 47 forks source link

PayPal webhooks are being indiscriminately deleted #2337

Closed marknokes closed 3 weeks ago

marknokes commented 3 weeks ago

Describe the Bug

PayPal webhooks are being indiscriminately deleted when the WebhookRegistrar unregister method is called

To Reproduce

  1. Go to '…'
  2. Click on '…'
  3. Scroll down to …'
  4. See error

Screenshots

Expected Behavior

Actual Behavior

Environment

Additional Details

System status ``` ```
sverleis commented 3 weeks ago

8341290-zen looks to be affected by this.

InpsydeNiklas commented 3 weeks ago

Hello @marknokes, thank you for raising this issue and submitting the PR. I would like to understand your use case better because it seems you might use the same REST application connected to the PayPal Payments plugin for multiple purposes.

The proposed changes in your PR introduce a dependency on local data, which might not always be available. If this data is missing, the webhooks won’t be deleted from the REST application, which could cause issues in various scenarios. Our current implementation deliberately clears all webhook subscriptions to handle situations like clearing old webhook subscriptions from a staging site on a different domain. Skipping subscriptions from other domains or when local data is absent would prevent the removal of old subscriptions and require manually deleting them from the PayPal dashboard or disconnecting and reconnecting the account to the plugin to create a new app.

For tracking specific PayPal webhooks not natively supported by our plugin, I recommend creating separate REST applications for each use case. PayPal webhooks work across different REST apps, allowing you to safely use one app per integration without reusing the same app.

That said, removing this action would prevent webhook resubscription during plugin updates. However, manually removing it may have a broader impact and is not a solution for automatic updates. A feature request for a proper filter to skip webhook registration during updates is in our backlog, but there hasn't been a significant demand. If webhook resubscription during updates is problematic, the root issue might not be the resubscription event but the reusing of the REST app for purposes unrelated to the plugin.

Please let us know if I understood your intentions correctly or missed something. Thank you!

marknokes commented 3 weeks ago

Yes, I'm using the same REST application for multiple purposes. I've found a workaround that doesn't involve meddling with the native functionality, so I'll close this. Thanks for the great explaination :)