Stripe gateway key filters

This topic contains 1 reply, has 2 voices, and was last updated by  Stephen Harris 5 years, 11 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #30536

    Hi Stephen,

    I’m setting up a site that will use both Event Organiser and WooCommerce to take payments – both using their relevant Stripe gateways.

    As Stripe has the option to regenerate API keys I can foresee a case where this is done and only one plugin has it’s keys updated by the client, causing things to fail.

    Would it be possible to add filters for the keys and live/test mode so that a developer can force the gateway to read it’s key values from another plugin and hide the key setting options in the Event Organiser gateway if doing so?

    Owen Morris
    #30555

    Hi Owen,

    This is possible. Gateway settings are stored in eventorganiser-gateway option so you can use the normal WordPress filters for modifying options:

    add_filter('option_event organ is era option', function($value){
    
        $value['stripe'] = array_merge($value['stripe'], array(
            'api_key' => '...',
            'public_key' => '...',
            'sandbox_api_key' => '...',
            'sandbox_public_key' => '...'
        ));
    
        return $value;
    });
    

    Other options (such as toggling between sandbox and live are also available there)

    Stephen Harris
Viewing 2 posts - 1 through 2 (of 2 total)
To enable me to focus on Pro customers, only users who have a valid license for the Pro add-on may post new topics or replies in this forum. If you have a valid license, please log-in or register an account using the e-mail address you purchased the license with. If you don't you can purchase one here. Or there's always the WordPress repository forum.