Configure PayPal integration and cart checkout error display

This commit is contained in:
Zach committed 2026-12-01 04:20:38 +00:00
1 parent 62065828e1
commit cf07fc5d9b
98 files changed
+1430 -281

No files matched your search

+24 -41
View File
@@ -1,45 +1,28 @@
{% extends 'base.html' %}
{% extends 'base.html' %}{% load static %}
{% block scripts %}<link rel="stylesheet" href="{% static 'storefront.css' %}">{% endblock %}
{% block title %}{{ product.title }} · Shop · SLUMP X LAND{% endblock %}
{% block content %}
<main class="page-shell">
<p><a href="{% url 'shop-index' %}">&larr; Back to Shop</a></p>
<article class="product-detail" style="display:grid;grid-template-columns:repeat(auto-fit,minmax(280px,1fr));gap:2rem;">
{% if product.image %}
<div><img src="{{ product.image.url }}" alt="{{ product.title }}" style="width:100%;border-radius:8px;"></div>
{% endif %}
<div>
<span class="badge">{{ product.get_kind_display }}</span>
<h1>{{ product.title }}</h1>
<p style="font-size:1.35rem;"><strong>${{ product.price_usd }}{% if product.kind == 'subscription' %} / {{ product.billing_interval }}{% endif %}</strong></p>
{% if product.description %}<div class="prose">{{ product.description|linebreaks }}</div>{% endif %}
{% if product.kind == 'subscription' %}
<form method="post" action="{% url 'shop-subscribe' product.slug %}" style="margin-top:1.5rem;display:grid;gap:.75rem;max-width:360px;">
{% csrf_token %}
{% if not request.user.is_authenticated or not request.user.email %}
<label>Email for membership receipts
<input type="email" name="email" required placeholder="you@example.com">
</label>
{% endif %}
{% if stripe_enabled %}
<button type="submit" name="gateway" value="stripe" class="btn">Subscribe with Card (Stripe)</button>
{% endif %}
{% if paypal_enabled and product.paypal_plan_id %}
<button type="submit" name="gateway" value="paypal" class="btn">Subscribe with PayPal</button>
{% endif %}
</form>
{% else %}
{% if product.in_stock %}
<form method="post" action="{% url 'shop-cart-add' product.pk %}" style="margin-top:1.5rem;display:flex;gap:.75rem;align-items:center;">
{% csrf_token %}
<input type="number" name="quantity" value="1" min="1" max="20" style="width:72px;">
<button type="submit" class="btn">Add to Cart</button>
</form>
{% else %}
<p><strong>Sold Out</strong></p>
{% endif %}
{% endif %}
</div>
</article>
<main class="section slx-store">
<div class="store-bar"><a href="{% url 'shop-index' %}">← Back to Shop</a><a href="{% url 'shop-cart' %}">Cart ({{ cart_count }})</a></div>
<article class="store-detail">
<div class="store-cover">{% if product.image %}<img src="{{ product.image.url }}" alt="{{ product.title }}">{% else %}<span>SLX</span>{% endif %}</div>
<div class="store-product-info"><h1>{{ product.title }}</h1><p>{{ product.get_kind_display }}</p>{% include "shop/_seller_badge.html" %}
<p>{{ product.summary }}</p><p class="store-price">${{ product.price_usd }}{% if product.kind == 'subscription' %} / {{ product.billing_interval }}{% endif %}</p>
{% if product.kind == 'subscription' %}
<p><a href="{% url 'membership' %}#compare-plans">Compare Fan Club plans →</a></p>
{% if not user.is_authenticated %}<a class="store-button" href="{% url 'fan-login' %}?next={% url 'shop-product' product.slug %}">Sign in to subscribe</a>
{% else %}<form method="post" action="{% url 'shop-subscribe' product.slug %}">{% csrf_token %}
{% if not user.email %}<label>Email for receipts <input type="email" name="email" required></label>{% endif %}
{% if stripe_enabled %}<button name="gateway" value="stripe" class="store-button">Subscribe with Stripe</button>{% endif %}
{% if not product.member_tier and paypal_enabled and product.paypal_plan_id %}<button name="gateway" value="paypal" class="store-button">Subscribe with PayPal</button>{% endif %}
</form>{% endif %}
{% elif product.in_stock %}
<form method="post" action="{% url 'shop-cart-add' product.pk %}">{% csrf_token %}<label>Quantity <input type="number" name="quantity" value="1" min="1" max="20"></label><button class="store-button">Add to cart</button></form>
{% else %}<p>Sold out</p>{% endif %}
</div>
<aside class="store-format"><h2>Format &amp; delivery</h2>{% if product.kind == 'physical' %}<p>Ships to you · {% if product.in_stock %}In stock{% else %}Sold out{% endif %}</p>{% elif product.kind == 'digital' %}<p>Digital edition</p>{% else %}<p>Recurring membership · {{ product.get_member_tier_display }}</p>{% endif %}{% if sample_chapter %}<a href="{% url 'chapter' sample_chapter.number %}">Open chapter reader →</a>{% endif %}</aside>
</article>
{% if product.description %}<section class="store-section"><h2>Overview</h2><div>{{ product.description|linebreaks }}</div></section>{% endif %}
{% if related_products %}<section class="store-section"><h2>You may also like</h2><div class="store-grid">{% for product in related_products %}{% include 'shop/card.html' %}{% endfor %}</div></section>{% endif %}
</main>
{% endblock %}