• Resolved magicoders

    (@patopaiar)


    Hi,

    I am a developer that would love to have a filter available for

    self::WEBHOOK_EVENTS

    in woocommerce-gateway-stripe/includes/class-wc-stripe-account.php

    Specifically in the function configure_webhooks a filter that allows to filter allowed events to be able to include custom ones, and then not have the webhook re configured with every update.

    Namely instead of using self::WEBHOOK_EVENTS directly here

        /**
    * Configures webhooks for the account.
    *
    * @param string $mode The mode to configure webhooks for. Either 'live' or 'test'. Default is 'live'.
    *
    * @throws Exception If there was a problem setting up the webhooks.
    * @return object The response from the API.
    */
    public function configure_webhooks( $mode = 'live', $secret_key = '' ) {
    $request = [
    'enabled_events' => self::WEBHOOK_EVENTS,
    'url' => WC_Stripe_Helper::get_webhook_url(),
    'api_version' => WC_Stripe_API::STRIPE_API_VERSION,
    ];

    ... Rest of function
    }

    Adding a filter like for example ‘wc_stripe_enabled_events’ in this way

    public function configure_webhooks( $mode = 'live', $secret_key = '' ) {
    $request = [
    'enabled_events' => apply_filters( 'wc_stripe_enabled_events', self::WEBHOOK_EVENTS ),
    'url' => WC_Stripe_Helper::get_webhook_url(),
    'api_version' => WC_Stripe_API::STRIPE_API_VERSION,
    ];

    ... Rest of function
    }

    This would be backwards compatible, as by default the returned events are exactly the same as defined in the the const at the start of the class.

    I can submit a PR or whatever way is preferred to make this possible.

    Looking forward to your reply to whether we can do this.

    Thank you

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support shahzeen(woo-hc)

    (@shahzeenfarooq)

    Hi there,

    Thank you for sharing your suggestion and explaining the need for a filter to modify the webhook events. I understand why having this flexibility would be helpful for your development workflow.

    However, in this forum we can only provide support for the core features of the WooCommerce Stripe Gateway plugin. Requests involving customization or extending the plugin’s default behavior fall outside our support scope.

    If you’d like this enhancement to be considered in a future release, please submit a feature request here:
    https://woocommerce.com/feature-requests/stripe/

    You’re also welcome to submit a Pull Request so our developers can review it and guide you accordingly:
    https://github.com/woocommerce/woocommerce-gateway-stripe/pulls

    Thank you for understanding and cooperation.

    Plugin Support thelmachido a11n

    (@thelmachido)

    It’s been a while since we heard back from you for this reason we are closing this thread. 

    If Stripe for WooCommerce has been useful for your store and you appreciate the support you’ve received, we’d truly appreciate it if you could leave us a quick review here: 

    https://wordpress.org/support/plugin/woocommerce-gateway-stripe/reviews/

    Feel free to open a new forum topic if you run into any other problem. 

Viewing 2 replies - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.