Add PayPal/Stripe toggle in admin settings
Deploy to Production (witstore.wende.it) / deploy (push) Successful in 7s

Payment methods can now be enabled/disabled under Einstellungen → Zahlungsarten.
Warning shown if API keys are missing in .env.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-21 11:28:55 +02:00
co-authored by Claude Sonnet 4.6
parent 4c729c6593
commit 8e6bb4f15c
3 changed files with 28 additions and 4 deletions
@@ -14,6 +14,7 @@ class SettingsController extends Controller
'smtp_host','smtp_port','smtp_user','smtp_password','smtp_from_name','smtp_from_email',
'cookie_consent','google_analytics','require_customer_approval',
'theme_name',
'payment_paypal_enabled','payment_stripe_enabled',
];
public function index()
@@ -105,6 +105,29 @@
</div>
</div>
{{-- Zahlungsarten --}}
<div class="bg-white rounded shadow p-6">
<h3 class="font-semibold mb-4">Zahlungsarten</h3>
<div class="space-y-3">
<label class="flex items-center gap-2 text-sm">
<input type="checkbox" name="payment_paypal_enabled" value="1"
{{ ($settings['payment_paypal_enabled'] ?? false) ? 'checked' : '' }}>
<span>PayPal aktivieren</span>
@if(!config('paypal.live.client_id') && !config('paypal.sandbox.client_id'))
<span class="text-xs text-orange-500">(PAYPAL_LIVE_CLIENT_ID in .env fehlt)</span>
@endif
</label>
<label class="flex items-center gap-2 text-sm">
<input type="checkbox" name="payment_stripe_enabled" value="1"
{{ ($settings['payment_stripe_enabled'] ?? false) ? 'checked' : '' }}>
<span>Kreditkarte via Stripe aktivieren</span>
@if(!config('services.stripe.key'))
<span class="text-xs text-orange-500">(STRIPE_KEY in .env fehlt)</span>
@endif
</label>
</div>
</div>
{{-- Design / Theme --}}
<div class="bg-white rounded shadow p-6">
<h3 class="font-semibold mb-4">Design</h3>
@@ -1,7 +1,7 @@
@extends('layouts.shop')
@section('title', 'Kasse')
@push('scripts')
@if(config('services.stripe.key'))
@if(\App\Models\Setting::get('payment_stripe_enabled') && config('services.stripe.key'))
<script src="https://js.stripe.com/v3/"></script>
<script>
const stripe = Stripe('{{ config('services.stripe.key') }}');
@@ -203,7 +203,7 @@ document.addEventListener('DOMContentLoaded', () => {
<div class="text-sm text-gray-500">Sie erhalten die Rechnung per E-Mail. Zahlungsziel: {{ \App\Models\Setting::get('invoice_payment_days', 14) }} Tage.</div>
</div>
</label>
@if(config('paypal.live.client_id') || config('paypal.sandbox.client_id'))
@if(\App\Models\Setting::get('payment_paypal_enabled') && (config('paypal.live.client_id') || config('paypal.sandbox.client_id')))
<label class="flex items-start gap-3 p-3 border rounded-lg cursor-pointer hover:bg-gray-50"
:class="method==='paypal' ? 'border-blue-500 bg-blue-50' : ''">
<input type="radio" name="payment_method" value="paypal" class="mt-1"
@@ -217,7 +217,7 @@ document.addEventListener('DOMContentLoaded', () => {
</div>
</label>
@endif
@if(config('services.stripe.key'))
@if(\App\Models\Setting::get('payment_stripe_enabled') && config('services.stripe.key'))
<label class="flex items-start gap-3 p-3 border rounded-lg cursor-pointer hover:bg-gray-50"
:class="method==='stripe' ? 'border-blue-500 bg-blue-50' : ''">
<input type="radio" name="payment_method" value="stripe" class="mt-1"
@@ -227,7 +227,7 @@ document.addEventListener('DOMContentLoaded', () => {
<div class="text-sm text-gray-500">Visa, Mastercard, American Express — verschlüsselt über Stripe.</div>
</div>
</label>
@if(config('services.stripe.key'))
@if(\App\Models\Setting::get('payment_stripe_enabled') && config('services.stripe.key'))
<div x-show="method==='stripe'" class="mt-3 p-3 border rounded-lg bg-gray-50">
<div id="stripe-card-element" class="p-3 bg-white border rounded"></div>
<p id="stripe-errors" class="text-red-500 text-sm mt-2 hidden"></p>