Stripe: Einmalpreis News-Einrichtung 30 €
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
85bee3190c
commit
16fbb03c13
4 files changed
+43
-8
No files matched your search
@@ -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,
|
||||
|
||||
Reference in new issue
Block a user