started implementing stripe

This commit is contained in:
2025-06-26 15:15:16 +02:00
parent 3a0659b63b
commit 9b85f3bb8d
24 changed files with 2025 additions and 103 deletions

View File

@@ -1,6 +1,6 @@
{% from "settings/components/connection_modals.html" import connection_modals %}
{% macro connections_tab(portainer_settings, nginx_settings, site_settings, git_settings, cloudflare_settings) %}
{% macro connections_tab(portainer_settings, nginx_settings, site_settings, git_settings, cloudflare_settings, stripe_settings) %}
<!-- Meta tags for JavaScript -->
<meta name="management-api-key" content="{{ site_settings.management_api_key }}">
<meta name="git-settings" content="{{ git_settings|tojson|safe }}">
@@ -212,6 +212,67 @@
</div>
</div>
</div>
<!-- Stripe Connection Card -->
<div class="col-md-6 mb-4">
<div class="card h-100">
<div class="card-header d-flex justify-content-between align-items-center">
<h5 class="mb-0">
<i class="fab fa-stripe me-2"></i>Stripe Connection
</h5>
<button class="btn btn-sm btn-outline-primary" onclick="testStripeConnection()">
<i class="fas fa-plug me-1"></i>Test Connection
</button>
</div>
<div class="card-body">
<form id="stripeForm" onsubmit="saveStripeConnection(event)">
<div class="mb-3">
<label for="stripePublishableKey" class="form-label">Publishable Key</label>
<input type="text" class="form-control" id="stripePublishableKey" name="stripePublishableKey"
placeholder="pk_test_..." required
value="{{ stripe_settings.publishable_key if stripe_settings and stripe_settings.publishable_key else '' }}">
<div class="form-text">Your Stripe publishable key (starts with pk_test_ or pk_live_)</div>
</div>
<div class="mb-3">
<label for="stripeSecretKey" class="form-label">Secret Key</label>
<input type="password" class="form-control" id="stripeSecretKey" name="stripeSecretKey"
placeholder="sk_test_..." required
value="{{ stripe_settings.secret_key if stripe_settings and stripe_settings.secret_key else '' }}">
<div class="form-text">Your Stripe secret key (starts with sk_test_ or sk_live_)</div>
</div>
<div class="mb-3">
<label for="stripeWebhookSecret" class="form-label">Webhook Secret (Optional)</label>
<input type="password" class="form-control" id="stripeWebhookSecret" name="stripeWebhookSecret"
placeholder="whsec_..."
value="{{ stripe_settings.webhook_secret if stripe_settings and stripe_settings.webhook_secret else '' }}">
<div class="form-text">Webhook endpoint secret for secure event handling</div>
</div>
<div class="mb-3">
<label for="stripeCustomerPortalUrl" class="form-label">Customer Portal URL</label>
<input type="url" class="form-control" id="stripeCustomerPortalUrl" name="stripeCustomerPortalUrl"
placeholder="https://billing.stripe.com/p/login/..."
value="{{ stripe_settings.customer_portal_url if stripe_settings and stripe_settings.customer_portal_url else '' }}">
<div class="form-text">URL for customers to manage their subscriptions and billing</div>
</div>
<div class="mb-3">
<div class="form-check">
<input class="form-check-input" type="checkbox" id="stripeTestMode" name="stripeTestMode"
{% if stripe_settings and stripe_settings.test_mode %}checked{% endif %}>
<label class="form-check-label" for="stripeTestMode">
Test Mode (Use test keys)
</label>
</div>
<div class="form-text">Enable this to use Stripe test mode for development</div>
</div>
<div class="d-flex justify-content-end">
<button type="submit" class="btn btn-primary">
<i class="fas fa-save me-1"></i>Save Stripe Settings
</button>
</div>
</form>
</div>
</div>
</div>
</div>
<!-- Save Connection Modal -->

View File

@@ -53,28 +53,32 @@
</div>
</div>
<!-- Stripe Payment Links -->
{% if plan.monthly_stripe_link or plan.annual_stripe_link %}
<!-- Stripe Integration Info -->
{% if plan.stripe_product_id or plan.stripe_monthly_price_id or plan.stripe_annual_price_id %}
<div class="mb-3">
<strong>Payment Links:</strong>
<strong>Stripe Integration:</strong>
<div class="mt-2">
{% if plan.monthly_stripe_link %}
{% if plan.stripe_product_id %}
<div class="mb-1">
<small class="text-muted">
<i class="fas fa-credit-card me-1"></i>Monthly:
<a href="{{ plan.monthly_stripe_link }}" target="_blank" class="text-primary">
Stripe Payment Link
</a>
<i class="fas fa-tag me-1"></i>Product ID:
<code class="text-primary">{{ plan.stripe_product_id }}</code>
</small>
</div>
{% endif %}
{% if plan.annual_stripe_link %}
{% if plan.stripe_monthly_price_id %}
<div class="mb-1">
<small class="text-muted">
<i class="fas fa-credit-card me-1"></i>Annual:
<a href="{{ plan.annual_stripe_link }}" target="_blank" class="text-primary">
Stripe Payment Link
</a>
<i class="fas fa-credit-card me-1"></i>Monthly Price ID:
<code class="text-primary">{{ plan.stripe_monthly_price_id }}</code>
</small>
</div>
{% endif %}
{% if plan.stripe_annual_price_id %}
<div class="mb-1">
<small class="text-muted">
<i class="fas fa-credit-card me-1"></i>Annual Price ID:
<code class="text-primary">{{ plan.stripe_annual_price_id }}</code>
</small>
</div>
{% endif %}
@@ -91,10 +95,6 @@
</ul>
</div>
<div class="mb-3">
<strong>Button:</strong> {{ plan.button_text }} → {{ plan.button_url }}
</div>
<div class="mb-3">
<div class="form-check">
<input class="form-check-input plan-popular-toggle" type="checkbox"
@@ -251,22 +251,27 @@
</div>
</div>
<!-- Stripe Payment Links Section -->
<!-- Stripe Product/Price IDs Section -->
<div class="row">
<div class="col-md-6">
<div class="col-md-4">
<div class="mb-3">
<label for="monthlyStripeLink" class="form-label">Monthly Stripe Payment Link</label>
<input type="url" class="form-control" id="monthlyStripeLink" name="monthly_stripe_link"
placeholder="https://buy.stripe.com/...">
<small class="text-muted">Stripe payment link for monthly billing</small>
<label for="stripeProductId" class="form-label">Stripe Product ID</label>
<input type="text" class="form-control" id="stripeProductId" name="stripe_product_id" placeholder="prod_xxx">
<small class="text-muted">The Stripe Product ID for this plan</small>
</div>
</div>
<div class="col-md-6">
<div class="col-md-4">
<div class="mb-3">
<label for="annualStripeLink" class="form-label">Annual Stripe Payment Link</label>
<input type="url" class="form-control" id="annualStripeLink" name="annual_stripe_link"
placeholder="https://buy.stripe.com/...">
<small class="text-muted">Stripe payment link for annual billing</small>
<label for="stripeMonthlyPriceId" class="form-label">Stripe Monthly Price ID</label>
<input type="text" class="form-control" id="stripeMonthlyPriceId" name="stripe_monthly_price_id" placeholder="price_xxx">
<small class="text-muted">The Stripe Price ID for monthly billing</small>
</div>
</div>
<div class="col-md-4">
<div class="mb-3">
<label for="stripeAnnualPriceId" class="form-label">Stripe Annual Price ID</label>
<input type="text" class="form-control" id="stripeAnnualPriceId" name="stripe_annual_price_id" placeholder="price_xxx">
<small class="text-muted">The Stripe Price ID for annual billing</small>
</div>
</div>
</div>
@@ -411,22 +416,27 @@
</div>
</div>
<!-- Stripe Payment Links Section -->
<!-- Stripe Product/Price IDs Section -->
<div class="row">
<div class="col-md-6">
<div class="col-md-4">
<div class="mb-3">
<label for="editMonthlyStripeLink" class="form-label">Monthly Stripe Payment Link</label>
<input type="url" class="form-control" id="editMonthlyStripeLink" name="monthly_stripe_link"
placeholder="https://buy.stripe.com/...">
<small class="text-muted">Stripe payment link for monthly billing</small>
<label for="stripeProductId" class="form-label">Stripe Product ID</label>
<input type="text" class="form-control" id="stripeProductId" name="stripe_product_id" placeholder="prod_xxx">
<small class="text-muted">The Stripe Product ID for this plan</small>
</div>
</div>
<div class="col-md-6">
<div class="col-md-4">
<div class="mb-3">
<label for="editAnnualStripeLink" class="form-label">Annual Stripe Payment Link</label>
<input type="url" class="form-control" id="editAnnualStripeLink" name="annual_stripe_link"
placeholder="https://buy.stripe.com/...">
<small class="text-muted">Stripe payment link for annual billing</small>
<label for="stripeMonthlyPriceId" class="form-label">Stripe Monthly Price ID</label>
<input type="text" class="form-control" id="stripeMonthlyPriceId" name="stripe_monthly_price_id" placeholder="price_xxx">
<small class="text-muted">The Stripe Price ID for monthly billing</small>
</div>
</div>
<div class="col-md-4">
<div class="mb-3">
<label for="stripeAnnualPriceId" class="form-label">Stripe Annual Price ID</label>
<input type="text" class="form-control" id="stripeAnnualPriceId" name="stripe_annual_price_id" placeholder="price_xxx">
<small class="text-muted">The Stripe Price ID for annual billing</small>
</div>
</div>
</div>