diff --git a/includes/plugin-instrumentation.php b/includes/plugin-instrumentation.php index 2f36f3f5..7b60f75b 100644 --- a/includes/plugin-instrumentation.php +++ b/includes/plugin-instrumentation.php @@ -275,7 +275,11 @@ public function getDefaultProperties($timestamp = true) } $paymentSettings = get_option('woocommerce_razorpay_settings'); -if ($paymentSettings !== false) +if (($paymentSettings !== false) and + (isset($paymentSettings['key_id']) === true) and + (empty($paymentSettings['key_id']) === false) and + (isset($paymentSettings['key_secret']) === true) and + (empty($paymentSettings['key_secret']) === false)) { $api = new Api($paymentSettings['key_id'], $paymentSettings['key_secret']); diff --git a/woo-razorpay.php b/woo-razorpay.php index fe1e36db..e8d2fee2 100644 --- a/woo-razorpay.php +++ b/woo-razorpay.php @@ -460,6 +460,11 @@ public function init_form_fields() $api = $this->getRazorpayApiInstance(); } + if (empty($key_id) === true) + { + return; + } + $merchantPreferences = $api->request->request('GET', 'accounts/me/features'); if (isset($merchantPreferences) === false or isset($merchantPreferences['assigned_features']) === false)