Stripe: Einmalpreis News-Einrichtung 30 €

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
knsoandClaude Opus 5.5 committed 2026-09-30 16:24:21 +00:00
1 parent 85bee3190c
commit 16fbb03c13
4 files changed
+43 -8

No files matched your search

+11
View File
@@ -88,6 +88,16 @@ const mailStorage = {
hetznerPackage: { name: 'Webhosting M', gb: 50, warnGb: 40 },
}
// News-Pinnwand: einmalige Einrichtung (Einmalpreis, kein Abo)
const newsSetup = {
key: 'newsSetup',
name: 'News-Pinnwand – Einrichtung',
amountCents: 3000,
lookupKey: 'webklar_news_einrichtung_3000',
oneTime: true,
priceNickname: 'News-Einrichtung 30 €',
}
export const config = {
port: Number(process.env.PORT) || 3000,
sessionSecret: process.env.SESSION_SECRET || '',
@@ -133,6 +143,7 @@ export const config = {
products,
mailStorage,
newsSetup,
// Wartungs-Abo (Stripe Billing). Preis/Produkt legt der Server per lookup_key selbst an.
// Die Werte kommen aus dem Produktkatalog (products.wartung).
+6 -4
View File
@@ -51,17 +51,19 @@ export function isStripeConfigured() {
}
// Produkt-Metadaten "webklar" je Katalog-Schluessel (F09/Produces: ensurePrice)
const PRODUCT_METADATA = { wartung: 'wartungs-abo', hosting: 'hosting-abo', mailStorage: 'mail-speicher' }
const PRODUCT_METADATA = { wartung: 'wartungs-abo', hosting: 'hosting-abo', mailStorage: 'mail-speicher', newsSetup: 'news-einrichtung' }
/** Katalogeintrag zum Schluessel: die beiden Abos aus products.js, der Zusatzspeicher aus config.mailStorage. */
function catalogFor(key) {
return key === 'mailStorage' ? config.mailStorage : getProduct(key)
if (key === 'mailStorage') return config.mailStorage
if (key === 'newsSetup') return config.newsSetup
return getProduct(key)
}
const priceIdCache = new Map()
/**
* Preis per lookup_key holen oder (einmalig) samt Produkt anlegen. key: 'wartung' | 'hosting' |
* 'mailStorage'. Ersetzt das fruehere ensureAboPrice (nur Wartung); lookup_keys werden bei Stripe
* 'mailStorage' | 'newsSetup' (Einmalpreis). Ersetzt das fruehere ensureAboPrice (nur Wartung); lookup_keys werden bei Stripe
* nie uebertragen, ein neuer Preis bekaeme also ohnehin einen neuen lookup_key im Katalog.
*/
export async function ensurePrice(key) {
@@ -94,7 +96,7 @@ export async function ensurePrice(key) {
product: product.id,
currency: 'eur',
unit_amount: catalog.amountCents,
recurring: { interval: 'month' },
...(catalog.oneTime ? {} : { recurring: { interval: 'month' } }),
tax_behavior: 'inclusive',
lookup_key: catalog.lookupKey,
nickname: catalog.priceNickname,