diff --git a/Plugin.php b/Plugin.php index 2615bf9..8106bfc 100644 --- a/Plugin.php +++ b/Plugin.php @@ -99,4 +99,18 @@ public function registerPermissions() ]; } + public function registerSettings() + { + return [ + 'settings' => [ + 'label' => 'Stripe Settings', + 'description' => 'Manage your Stripe API keys.', + 'category' => 'Shop', + 'icon' => 'icon-credit-card', + 'class' => 'Dshoreman\Shop\Models\Settings', + 'order' => 200, + ], + ]; + } + } diff --git a/models/Settings.php b/models/Settings.php new file mode 100644 index 0000000..30e7adc --- /dev/null +++ b/models/Settings.php @@ -0,0 +1,13 @@ + 'shop'], function() { @@ -32,7 +33,9 @@ $order->shipping_postcode = post('stripeShippingAddressZip'); $order->shipping_country = post('stripeShippingAddressCountry'); - Stripe::setApiKey('sk_test_NHbBmLzRSL7G06gpyLVraQ2Z'); + Settings::get('stripe_active_keys') == 'live' + ? Stripe::setApiKey(Settings::get('stripe_live_sec_key')) + : Stripe::setApiKey(Settings::get('stripe_test_sec_key')); try { $charge = Stripe_Charge::create([