feat: implement billing and subscription management screen with RevenueCat integration

This commit is contained in:
2026-04-04 21:33:51 +02:00
parent 363f5f60d1
commit 1b40f1eb1b
2 changed files with 14 additions and 2 deletions

View File

@@ -81,10 +81,10 @@ const getBillingCopy = (language: Language) => {
freePlanName: 'Free',
freePlanPrice: '0 EUR / Monat',
proPlanName: 'Pro',
proPlanPrice: '4.99 EUR / Monat',
proPlanPrice: '4,99 / Monat',
proBadgeText: 'EMPFOHLEN',
proYearlyPlanName: 'Pro',
proYearlyPlanPrice: '39.99 EUR / Jahr',
proYearlyPlanPrice: '39,99 / Jahr',
proYearlyBadgeText: 'SPAREN',
proBenefits: [
'250 Credits jeden Monat',

View File

@@ -308,6 +308,18 @@ const getValidProEntitlement = (customerInfo) => {
return proEntitlement;
}
// Fallback: entitlement is active but backed by a non-subscription product (e.g. a topup
// that was previously misconfigured to grant the pro entitlement). If the user also has a
// supported subscription product in their purchase history, honour the entitlement anyway.
const purchased = Array.isArray(customerInfo?.allPurchasedProductIdentifiers)
? customerInfo.allPurchasedProductIdentifiers
: [];
const hasSubscription = purchased.some((id) => SUPPORTED_SUBSCRIPTION_PRODUCTS.has(id));
if (hasSubscription) {
console.warn('[Billing] Pro entitlement backed by unsupported product but subscription found — honouring entitlement', summarizeRevenueCatCustomerInfo(customerInfo));
return proEntitlement;
}
console.warn('[Billing] Ignoring unsupported RevenueCat pro entitlement', summarizeRevenueCatCustomerInfo(customerInfo));
return null;
};