System.Web.Http.HttpConfigurationExtensions.InitializeReceiveStripeDirectWebHooks C# (CSharp) Method

InitializeReceiveStripeDirectWebHooks() public static method

Initializes support for receiving Stripe WebHooks without any follow-up HTTP GET request to get the WebHook data. A sample WebHook URI is 'https://<host>/api/webhooks/incoming/stripe/{id}?code=83699ec7c1d794c0c780e49a5c72972590571fd8'. For security reasons the WebHook URI must be an https URI and contain a 'code' query parameter with the same value as configured in the 'MS_WebHookReceiverSecret_Stripe' application setting. The 'code' parameter must be between 32 and 128 characters long. For details about Stripe WebHooks, see https://stripe.com/docs/webhooks.
public static InitializeReceiveStripeDirectWebHooks ( this config ) : void
config this The current config.
return void
        public static void InitializeReceiveStripeDirectWebHooks(this HttpConfiguration config)
        {
            if (config == null)
            {
                throw new ArgumentNullException(nameof(config));
            }

            // Enable direct mode
            IDependencyResolver resolver = config.DependencyResolver;
            SettingsDictionary settings = resolver.GetSettings();
            settings[StripeWebHookReceiver.DirectWebHook] = bool.TrueString;

            WebHooksConfig.Initialize(config);
        }
    }