[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6NW827BE95A174EYKM06R18":3,"skill-same:01M6NW827BE95A174EYKM06R18":66},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":39,"linkOnly":40,"markdownContent":41,"markdownBody":42,"frontMatter":43,"refName":44,"commitSha":45,"skillDirectory":46,"forksCount":14,"repositoryHtmlUrl":47,"repositoryHomepageUrl":6,"ownerHtmlUrl":48,"ownerBlogUrl":49,"ownerDescription":50,"updatedAt":51,"install":52,"resources":65},"01M6NW827BE95A174EYKM06R18","revenuecat-patterns",null,"RevenueCat SDK entegrasyon pattern'leri. iOS (Swift), Android (Kotlin), React Native ve Flutter icin setup, offerings, entitlement checking, webhook integration, StoreKit 2 migration ve sandbox testing.","rubicanjr\u002FFinCognis","rubicanjr","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F234912519?v=4","01M6NT156NND8J474G34SB3923","Rubi","01M6NT15B70RWXE1N3YV0BZY8A",0,"MIT","https:\u002F\u002Fgithub.com\u002Frubicanjr\u002FFinCognis\u002Fblob\u002Fmain\u002Fskills\u002Frevenuecat-patterns\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38],"revenuecat patterns","revenuecat","patterns","flutter","native","webhook integration","webhook","pattern","migration","react native","testing","kotlin","ios","offerings","integration","setup","react","sdk","sandbox","android","2026-11-10 10:12:30",false,"---\nname: revenuecat-patterns\ndescription: RevenueCat SDK entegrasyon pattern'leri. iOS (Swift), Android (Kotlin), React Native ve Flutter icin setup, offerings, entitlement checking, webhook integration, StoreKit 2 migration ve sandbox testing.\n---\n\n# RevenueCat Integration Patterns\n\n## SDK Setup\n\n### iOS (Swift + StoreKit 2)\n\n```swift\n\u002F\u002F AppDelegate.swift veya @main App\nimport RevenueCat\n\nPurchases.logLevel = .debug \u002F\u002F sandbox'ta acik tut\nPurchases.configure(\n    with: .init(withAPIKey: \"appl_XXXXXXXXXXXXX\")\n        .with(usesStoreKit2IfAvailable: true)\n)\n\n\u002F\u002F Kullanici kimlik eslestirme (auth sonrasi)\nPurchases.shared.logIn(\"user_id_from_your_backend\") { customerInfo, created, error in\n    \u002F\u002F created: true ise yeni kullanici\n}\n\n\u002F\u002F Logout\nPurchases.shared.logOut { customerInfo, error in }\n```\n\n### Android (Kotlin)\n\n```kotlin\n\u002F\u002F Application.onCreate()\nPurchases.logLevel = LogLevel.DEBUG\nPurchases.configure(\n    PurchasesConfiguration.Builder(this, \"goog_XXXXXXXXXXXXX\")\n        .appUserID(\"user_id\") \u002F\u002F null ise anonim\n        .build()\n)\n```\n\n### React Native\n\n```typescript\nimport Purchases from 'react-native-purchases';\n\n\u002F\u002F App.tsx useEffect icinde\nawait Purchases.configure({\n  apiKey: Platform.OS === 'ios'\n    ? 'appl_XXXXXXXXXXXXX'\n    : 'goog_XXXXXXXXXXXXX',\n  appUserID: userId ?? undefined, \u002F\u002F null = anonim\n});\n```\n\n### Flutter\n\n```dart\n\u002F\u002F main.dart\nawait Purchases.configure(\n  PurchasesConfiguration('appl_XXXXXXXXXXXXX')\n    ..appUserID = userId\n);\n```\n\n---\n\n## Offerings ve Paywalls\n\n### Offerings Getirme\n\n```swift\n\u002F\u002F iOS\nPurchases.shared.getOfferings { offerings, error in\n    guard let current = offerings?.current else { return }\n\n    let monthly = current.monthly   \u002F\u002F Package?\n    let annual = current.annual     \u002F\u002F Package?\n    let weekly = current.package(identifier: \"weekly\") \u002F\u002F Custom\n\n    \u002F\u002F Fiyat gosterme\n    if let monthly = monthly {\n        priceLabel.text = monthly.storeProduct.localizedPriceString\n        \u002F\u002F \"$9.99\" (locale'e gore formatlanmis)\n    }\n}\n```\n\n```kotlin\n\u002F\u002F Android\nPurchases.sharedInstance.getOfferingsWith(\n    onError = { error -> \u002F* PurchasesError *\u002F },\n    onSuccess = { offerings ->\n        val current = offerings.current ?: return@getOfferingsWith\n        val monthly = current.monthly\n        val annual = current.annual\n\n        monthly?.product?.let { product ->\n            priceText.text = product.price.formatted \u002F\u002F \"$9.99\"\n        }\n    }\n)\n```\n\n```typescript\n\u002F\u002F React Native\nconst offerings = await Purchases.getOfferings();\nconst current = offerings.current;\n\nif (current) {\n  const monthly = current.monthly;\n  const annual = current.annual;\n\n  \u002F\u002F Fiyat\n  monthly?.product.priceString; \u002F\u002F \"$9.99\"\n\n  \u002F\u002F Savings hesapla\n  if (monthly && annual) {\n    const monthlyPerYear = monthly.product.price * 12;\n    const savings = Math.round((1 - annual.product.price \u002F monthlyPerYear) * 100);\n    \u002F\u002F \"Save 60%\"\n  }\n}\n```\n\n### RevenueCat Paywalls (No-code)\n\n```swift\n\u002F\u002F iOS - RevenueCat Paywall UI\nimport RevenueCatUI\n\n\u002F\u002F SwiftUI\nPaywallView()\n    .onPurchaseCompleted { customerInfo in\n        \u002F\u002F Satin alma basarili\n    }\n    .onDismiss {\n        \u002F\u002F Kullanici kapatti\n    }\n\n\u002F\u002F Footer mode (kendi UI'in + RC pricing)\nPaywallFooterView()\n```\n\n```kotlin\n\u002F\u002F Android - Paywall UI\nPaywallDialog(\n    PaywallDialogOptions.Builder()\n        .setDismissRequest { \u002F* kapandi *\u002F }\n        .setListener(object : PaywallListener {\n            override fun onPurchaseCompleted(customerInfo: CustomerInfo, storeTransaction: StoreTransaction) {\n                \u002F\u002F Basarili\n            }\n        })\n        .build()\n)\n```\n\n---\n\n## Entitlement Checking\n\n```swift\n\u002F\u002F iOS - Erisim kontrolu\nPurchases.shared.getCustomerInfo { customerInfo, error in\n    let isPremium = customerInfo?.entitlements[\"premium\"]?.isActive == true\n\n    \u002F\u002F Detayli bilgi\n    if let entitlement = customerInfo?.entitlements[\"premium\"] {\n        entitlement.isActive              \u002F\u002F true\u002Ffalse\n        entitlement.willRenew             \u002F\u002F otomatik yenilenecek mi\n        entitlement.expirationDate        \u002F\u002F bitis tarihi\n        entitlement.periodType            \u002F\u002F .normal, .trial, .intro\n        entitlement.productIdentifier     \u002F\u002F hangi urun\n    }\n}\n\n\u002F\u002F Listener (real-time degisiklik)\nPurchases.shared.delegate = self\n\nfunc purchases(_ purchases: Purchases,\n               receivedUpdated customerInfo: CustomerInfo) {\n    let isPremium = customerInfo.entitlements[\"premium\"]?.isActive == true\n    updateUI(isPremium: isPremium)\n}\n```\n\n```typescript\n\u002F\u002F React Native\nconst customerInfo = await Purchases.getCustomerInfo();\nconst isPremium = customerInfo.entitlements.active['premium'] !== undefined;\n\n\u002F\u002F Listener\nPurchases.addCustomerInfoUpdateListener((info) => {\n  const isPremium = info.entitlements.active['premium'] !== undefined;\n  setIsPremium(isPremium);\n});\n```\n\n### Feature Gating Pattern\n\n```typescript\n\u002F\u002F Merkezi erisim kontrolu\nclass EntitlementManager {\n  private customerInfo: CustomerInfo | null = null;\n\n  async refresh(): Promise\u003Cvoid> {\n    this.customerInfo = await Purchases.getCustomerInfo();\n  }\n\n  get isPremium(): boolean {\n    return this.customerInfo?.entitlements.active['premium'] !== undefined;\n  }\n\n  get isOnTrial(): boolean {\n    const ent = this.customerInfo?.entitlements.active['premium'];\n    return ent?.periodType === 'TRIAL';\n  }\n\n  get trialEndDate(): Date | null {\n    const ent = this.customerInfo?.entitlements.active['premium'];\n    if (ent?.periodType !== 'TRIAL') return null;\n    return ent.expirationDate ? new Date(ent.expirationDate) : null;\n  }\n\n  get willRenew(): boolean {\n    return this.customerInfo?.entitlements.active['premium']?.willRenew ?? false;\n  }\n}\n```\n\n---\n\n## Purchase Flow\n\n```swift\n\u002F\u002F iOS\nPurchases.shared.purchase(package: monthlyPackage) { transaction, customerInfo, error, userCancelled in\n    if userCancelled {\n        \u002F\u002F Kullanici iptal etti - agresif olmadan geri don\n        return\n    }\n    if let error = error {\n        \u002F\u002F Hata: odeme basarisiz, network vb.\n        handleError(error)\n        return\n    }\n    if customerInfo?.entitlements[\"premium\"]?.isActive == true {\n        \u002F\u002F BASARILI - premium erisim ac\n        unlockPremium()\n    }\n}\n```\n\n```typescript\n\u002F\u002F React Native\ntry {\n  const { customerInfo } = await Purchases.purchasePackage(monthlyPackage);\n  if (customerInfo.entitlements.active['premium']) {\n    unlockPremium();\n  }\n} catch (e: any) {\n  if (e.userCancelled) return;\n  handleError(e);\n}\n```\n\n### Restore Purchases (ZORUNLU - Apple Requirement)\n\n```swift\n\u002F\u002F iOS - MUTLAKA paywall'da \"Restore Purchases\" butonu olmali\nPurchases.shared.restorePurchases { customerInfo, error in\n    if customerInfo?.entitlements[\"premium\"]?.isActive == true {\n        showAlert(\"Aboneliginiz geri yuklendi!\")\n        unlockPremium()\n    } else {\n        showAlert(\"Aktif abonelik bulunamadi.\")\n    }\n}\n```\n\n---\n\n## Webhook Integration (Server-Side)\n\n### Webhook Setup\n\nRevenueCat Dashboard > Project > Integrations > Webhooks\n- URL: `https:\u002F\u002Fyour-api.com\u002Fwebhooks\u002Frevenuecat`\n- Authorization Header: Bearer token ile dogrula\n\n### Webhook Handler\n\n```typescript\n\u002F\u002F Next.js API Route\nimport { NextRequest, NextResponse } from 'next\u002Fserver';\n\ninterface RevenueCatEvent {\n  api_version: string;\n  event: {\n    type: string;\n    app_user_id: string;\n    product_id: string;\n    entitlement_ids: string[];\n    period_type: 'TRIAL' | 'NORMAL' | 'INTRO';\n    expiration_at_ms: number;\n    environment: 'SANDBOX' | 'PRODUCTION';\n    price_in_purchased_currency: number;\n    currency: string;\n    store: 'APP_STORE' | 'PLAY_STORE' | 'STRIPE';\n  };\n}\n\n\u002F\u002F Event tipleri ve aksiyonlar\nconst EVENT_HANDLERS: Record\u003Cstring, (event: RevenueCatEvent['event']) => Promise\u003Cvoid>> = {\n  \u002F\u002F Yeni satin alma\n  'INITIAL_PURCHASE': async (event) => {\n    await db.user.update({\n      where: { id: event.app_user_id },\n      data: { isPremium: true, subscriptionStart: new Date() }\n    });\n    await analytics.track('subscription_started', {\n      userId: event.app_user_id,\n      product: event.product_id,\n      price: event.price_in_purchased_currency,\n      currency: event.currency,\n      periodType: event.period_type,\n    });\n  },\n\n  \u002F\u002F Yenileme\n  'RENEWAL': async (event) => {\n    await db.user.update({\n      where: { id: event.app_user_id },\n      data: { subscriptionRenewedAt: new Date() }\n    });\n  },\n\n  \u002F\u002F Iptal (hemen degil, sure sonunda biter)\n  'CANCELLATION': async (event) => {\n    await db.user.update({\n      where: { id: event.app_user_id },\n      data: { willCancel: true, cancelledAt: new Date() }\n    });\n    \u002F\u002F Win-back kampanyasi baslat\n    await triggerWinBackCampaign(event.app_user_id, event.expiration_at_ms);\n  },\n\n  \u002F\u002F Sure doldu\n  'EXPIRATION': async (event) => {\n    await db.user.update({\n      where: { id: event.app_user_id },\n      data: { isPremium: false, expiredAt: new Date() }\n    });\n  },\n\n  \u002F\u002F Odeme sorunu\n  'BILLING_ISSUE': async (event) => {\n    await db.user.update({\n      where: { id: event.app_user_id },\n      data: { hasBillingIssue: true }\n    });\n    \u002F\u002F Grace period bilgilendirmesi\n    await sendBillingIssueNotification(event.app_user_id);\n  },\n\n  \u002F\u002F Trial donusumu\n  'SUBSCRIBER_ALIAS': async (event) => {\n    \u002F\u002F Anonim kullanici -> kayitli kullanici eslestirme\n  },\n};\n\nexport async function POST(req: NextRequest) {\n  const authHeader = req.headers.get('authorization');\n  if (authHeader !== `Bearer ${process.env.REVENUECAT_WEBHOOK_SECRET}`) {\n    return NextResponse.json({ error: 'Unauthorized' }, { status: 401 });\n  }\n\n  const body: RevenueCatEvent = await req.json();\n\n  \u002F\u002F Sandbox event'lerini filtrele (production'da)\n  if (process.env.NODE_ENV === 'production' && body.event.environment === 'SANDBOX') {\n    return NextResponse.json({ ok: true });\n  }\n\n  const handler = EVENT_HANDLERS[body.event.type];\n  if (handler) {\n    await handler(body.event);\n  }\n\n  return NextResponse.json({ ok: true });\n}\n```\n\n---\n\n## Sandbox Testing\n\n### iOS Sandbox\n\n1. App Store Connect > Users and Access > Sandbox Testers\n2. Yeni sandbox kullanici olustur (gercek email gerekli)\n3. iPhone Settings > App Store > Sandbox Account ile giris\n4. Sandbox'ta sureler kisaltilmis:\n   - 1 haftalik = 3 dakika\n   - 1 aylik = 5 dakika\n   - 1 yillik = 1 saat\n   - Auto-renew 6 kez sonra durur\n\n### Android Test\n\n1. Google Play Console > Setup > License testing\n2. Test email'lerini ekle\n3. Test track'e yukle (internal testing)\n4. `Purchases.logLevel = .debug` ile test et\n\n### Debug Checklist\n\n```\n[ ] RevenueCat dashboard'da sandbox event'leri gorunuyor mu?\n[ ] Entitlement dogru aktive oluyor mu?\n[ ] Restore purchases calisiyor mu?\n[ ] Webhook'lar geliyor mu? (RequestBin ile test et)\n[ ] Fiyatlar locale'e gore formatlanmis mi?\n[ ] Trial suresi dogru gorunuyor mu?\n[ ] Iptal sonrasi erisim sure sonunda kapaniyor mu?\n```\n\n---\n\n## StoreKit 2 Migration Notlari\n\n- RevenueCat v4+ StoreKit 2'yi otomatik destekler\n- `usesStoreKit2IfAvailable: true` ile etkinlestir\n- StoreKit 2 avantajlari: real-time transaction updates, better receipt handling\n- iOS 15+ gerektirir (iOS 14 icin StoreKit 1 fallback otomatik)\n- Server-side receipt validation artik gerekli degil (SK2 bunu yapiyor)\n\n## Onemli Kurallar\n\n1. **Restore Purchases butonu ZORUNLU** (Apple reject eder yoksa)\n2. **Fiyatlari localizedPriceString ile goster** (hardcode ETME)\n3. **Sandbox'ta test etmeden production'a cikma**\n4. **Webhook secret'i .env'de tut** (hardcode ETME)\n5. **BILLING_ISSUE event'ini handle et** (grace period uygula)\n6. **Trial bitis tarihini kullaniciya goster** (seffaflik)\n7. **Anonim -> kayitli kullanici gecisinde merge yap** (veri kaybi olmasin)\n","# RevenueCat Integration Patterns\n\n## SDK Setup\n\n### iOS (Swift + StoreKit 2)\n\n```swift\n\u002F\u002F AppDelegate.swift veya @main App\nimport RevenueCat\n\nPurchases.logLevel = .debug \u002F\u002F sandbox'ta acik tut\nPurchases.configure(\n    with: .init(withAPIKey: \"appl_XXXXXXXXXXXXX\")\n        .with(usesStoreKit2IfAvailable: true)\n)\n\n\u002F\u002F Kullanici kimlik eslestirme (auth sonrasi)\nPurchases.shared.logIn(\"user_id_from_your_backend\") { customerInfo, created, error in\n    \u002F\u002F created: true ise yeni kullanici\n}\n\n\u002F\u002F Logout\nPurchases.shared.logOut { customerInfo, error in }\n```\n\n### Android (Kotlin)\n\n```kotlin\n\u002F\u002F Application.onCreate()\nPurchases.logLevel = LogLevel.DEBUG\nPurchases.configure(\n    PurchasesConfiguration.Builder(this, \"goog_XXXXXXXXXXXXX\")\n        .appUserID(\"user_id\") \u002F\u002F null ise anonim\n        .build()\n)\n```\n\n### React Native\n\n```typescript\nimport Purchases from 'react-native-purchases';\n\n\u002F\u002F App.tsx useEffect icinde\nawait Purchases.configure({\n  apiKey: Platform.OS === 'ios'\n    ? 'appl_XXXXXXXXXXXXX'\n    : 'goog_XXXXXXXXXXXXX',\n  appUserID: userId ?? undefined, \u002F\u002F null = anonim\n});\n```\n\n### Flutter\n\n```dart\n\u002F\u002F main.dart\nawait Purchases.configure(\n  PurchasesConfiguration('appl_XXXXXXXXXXXXX')\n    ..appUserID = userId\n);\n```\n\n---\n\n## Offerings ve Paywalls\n\n### Offerings Getirme\n\n```swift\n\u002F\u002F iOS\nPurchases.shared.getOfferings { offerings, error in\n    guard let current = offerings?.current else { return }\n\n    let monthly = current.monthly   \u002F\u002F Package?\n    let annual = current.annual     \u002F\u002F Package?\n    let weekly = current.package(identifier: \"weekly\") \u002F\u002F Custom\n\n    \u002F\u002F Fiyat gosterme\n    if let monthly = monthly {\n        priceLabel.text = monthly.storeProduct.localizedPriceString\n        \u002F\u002F \"$9.99\" (locale'e gore formatlanmis)\n    }\n}\n```\n\n```kotlin\n\u002F\u002F Android\nPurchases.sharedInstance.getOfferingsWith(\n    onError = { error -> \u002F* PurchasesError *\u002F },\n    onSuccess = { offerings ->\n        val current = offerings.current ?: return@getOfferingsWith\n        val monthly = current.monthly\n        val annual = current.annual\n\n        monthly?.product?.let { product ->\n            priceText.text = product.price.formatted \u002F\u002F \"$9.99\"\n        }\n    }\n)\n```\n\n```typescript\n\u002F\u002F React Native\nconst offerings = await Purchases.getOfferings();\nconst current = offerings.current;\n\nif (current) {\n  const monthly = current.monthly;\n  const annual = current.annual;\n\n  \u002F\u002F Fiyat\n  monthly?.product.priceString; \u002F\u002F \"$9.99\"\n\n  \u002F\u002F Savings hesapla\n  if (monthly && annual) {\n    const monthlyPerYear = monthly.product.price * 12;\n    const savings = Math.round((1 - annual.product.price \u002F monthlyPerYear) * 100);\n    \u002F\u002F \"Save 60%\"\n  }\n}\n```\n\n### RevenueCat Paywalls (No-code)\n\n```swift\n\u002F\u002F iOS - RevenueCat Paywall UI\nimport RevenueCatUI\n\n\u002F\u002F SwiftUI\nPaywallView()\n    .onPurchaseCompleted { customerInfo in\n        \u002F\u002F Satin alma basarili\n    }\n    .onDismiss {\n        \u002F\u002F Kullanici kapatti\n    }\n\n\u002F\u002F Footer mode (kendi UI'in + RC pricing)\nPaywallFooterView()\n```\n\n```kotlin\n\u002F\u002F Android - Paywall UI\nPaywallDialog(\n    PaywallDialogOptions.Builder()\n        .setDismissRequest { \u002F* kapandi *\u002F }\n        .setListener(object : PaywallListener {\n            override fun onPurchaseCompleted(customerInfo: CustomerInfo, storeTransaction: StoreTransaction) {\n                \u002F\u002F Basarili\n            }\n        })\n        .build()\n)\n```\n\n---\n\n## Entitlement Checking\n\n```swift\n\u002F\u002F iOS - Erisim kontrolu\nPurchases.shared.getCustomerInfo { customerInfo, error in\n    let isPremium = customerInfo?.entitlements[\"premium\"]?.isActive == true\n\n    \u002F\u002F Detayli bilgi\n    if let entitlement = customerInfo?.entitlements[\"premium\"] {\n        entitlement.isActive              \u002F\u002F true\u002Ffalse\n        entitlement.willRenew             \u002F\u002F otomatik yenilenecek mi\n        entitlement.expirationDate        \u002F\u002F bitis tarihi\n        entitlement.periodType            \u002F\u002F .normal, .trial, .intro\n        entitlement.productIdentifier     \u002F\u002F hangi urun\n    }\n}\n\n\u002F\u002F Listener (real-time degisiklik)\nPurchases.shared.delegate = self\n\nfunc purchases(_ purchases: Purchases,\n               receivedUpdated customerInfo: CustomerInfo) {\n    let isPremium = customerInfo.entitlements[\"premium\"]?.isActive == true\n    updateUI(isPremium: isPremium)\n}\n```\n\n```typescript\n\u002F\u002F React Native\nconst customerInfo = await Purchases.getCustomerInfo();\nconst isPremium = customerInfo.entitlements.active['premium'] !== undefined;\n\n\u002F\u002F Listener\nPurchases.addCustomerInfoUpdateListener((info) => {\n  const isPremium = info.entitlements.active['premium'] !== undefined;\n  setIsPremium(isPremium);\n});\n```\n\n### Feature Gating Pattern\n\n```typescript\n\u002F\u002F Merkezi erisim kontrolu\nclass EntitlementManager {\n  private customerInfo: CustomerInfo | null = null;\n\n  async refresh(): Promise\u003Cvoid> {\n    this.customerInfo = await Purchases.getCustomerInfo();\n  }\n\n  get isPremium(): boolean {\n    return this.customerInfo?.entitlements.active['premium'] !== undefined;\n  }\n\n  get isOnTrial(): boolean {\n    const ent = this.customerInfo?.entitlements.active['premium'];\n    return ent?.periodType === 'TRIAL';\n  }\n\n  get trialEndDate(): Date | null {\n    const ent = this.customerInfo?.entitlements.active['premium'];\n    if (ent?.periodType !== 'TRIAL') return null;\n    return ent.expirationDate ? new Date(ent.expirationDate) : null;\n  }\n\n  get willRenew(): boolean {\n    return this.customerInfo?.entitlements.active['premium']?.willRenew ?? false;\n  }\n}\n```\n\n---\n\n## Purchase Flow\n\n```swift\n\u002F\u002F iOS\nPurchases.shared.purchase(package: monthlyPackage) { transaction, customerInfo, error, userCancelled in\n    if userCancelled {\n        \u002F\u002F Kullanici iptal etti - agresif olmadan geri don\n        return\n    }\n    if let error = error {\n        \u002F\u002F Hata: odeme basarisiz, network vb.\n        handleError(error)\n        return\n    }\n    if customerInfo?.entitlements[\"premium\"]?.isActive == true {\n        \u002F\u002F BASARILI - premium erisim ac\n        unlockPremium()\n    }\n}\n```\n\n```typescript\n\u002F\u002F React Native\ntry {\n  const { customerInfo } = await Purchases.purchasePackage(monthlyPackage);\n  if (customerInfo.entitlements.active['premium']) {\n    unlockPremium();\n  }\n} catch (e: any) {\n  if (e.userCancelled) return;\n  handleError(e);\n}\n```\n\n### Restore Purchases (ZORUNLU - Apple Requirement)\n\n```swift\n\u002F\u002F iOS - MUTLAKA paywall'da \"Restore Purchases\" butonu olmali\nPurchases.shared.restorePurchases { customerInfo, error in\n    if customerInfo?.entitlements[\"premium\"]?.isActive == true {\n        showAlert(\"Aboneliginiz geri yuklendi!\")\n        unlockPremium()\n    } else {\n        showAlert(\"Aktif abonelik bulunamadi.\")\n    }\n}\n```\n\n---\n\n## Webhook Integration (Server-Side)\n\n### Webhook Setup\n\nRevenueCat Dashboard > Project > Integrations > Webhooks\n- URL: `https:\u002F\u002Fyour-api.com\u002Fwebhooks\u002Frevenuecat`\n- Authorization Header: Bearer token ile dogrula\n\n### Webhook Handler\n\n```typescript\n\u002F\u002F Next.js API Route\nimport { NextRequest, NextResponse } from 'next\u002Fserver';\n\ninterface RevenueCatEvent {\n  api_version: string;\n  event: {\n    type: string;\n    app_user_id: string;\n    product_id: string;\n    entitlement_ids: string[];\n    period_type: 'TRIAL' | 'NORMAL' | 'INTRO';\n    expiration_at_ms: number;\n    environment: 'SANDBOX' | 'PRODUCTION';\n    price_in_purchased_currency: number;\n    currency: string;\n    store: 'APP_STORE' | 'PLAY_STORE' | 'STRIPE';\n  };\n}\n\n\u002F\u002F Event tipleri ve aksiyonlar\nconst EVENT_HANDLERS: Record\u003Cstring, (event: RevenueCatEvent['event']) => Promise\u003Cvoid>> = {\n  \u002F\u002F Yeni satin alma\n  'INITIAL_PURCHASE': async (event) => {\n    await db.user.update({\n      where: { id: event.app_user_id },\n      data: { isPremium: true, subscriptionStart: new Date() }\n    });\n    await analytics.track('subscription_started', {\n      userId: event.app_user_id,\n      product: event.product_id,\n      price: event.price_in_purchased_currency,\n      currency: event.currency,\n      periodType: event.period_type,\n    });\n  },\n\n  \u002F\u002F Yenileme\n  'RENEWAL': async (event) => {\n    await db.user.update({\n      where: { id: event.app_user_id },\n      data: { subscriptionRenewedAt: new Date() }\n    });\n  },\n\n  \u002F\u002F Iptal (hemen degil, sure sonunda biter)\n  'CANCELLATION': async (event) => {\n    await db.user.update({\n      where: { id: event.app_user_id },\n      data: { willCancel: true, cancelledAt: new Date() }\n    });\n    \u002F\u002F Win-back kampanyasi baslat\n    await triggerWinBackCampaign(event.app_user_id, event.expiration_at_ms);\n  },\n\n  \u002F\u002F Sure doldu\n  'EXPIRATION': async (event) => {\n    await db.user.update({\n      where: { id: event.app_user_id },\n      data: { isPremium: false, expiredAt: new Date() }\n    });\n  },\n\n  \u002F\u002F Odeme sorunu\n  'BILLING_ISSUE': async (event) => {\n    await db.user.update({\n      where: { id: event.app_user_id },\n      data: { hasBillingIssue: true }\n    });\n    \u002F\u002F Grace period bilgilendirmesi\n    await sendBillingIssueNotification(event.app_user_id);\n  },\n\n  \u002F\u002F Trial donusumu\n  'SUBSCRIBER_ALIAS': async (event) => {\n    \u002F\u002F Anonim kullanici -> kayitli kullanici eslestirme\n  },\n};\n\nexport async function POST(req: NextRequest) {\n  const authHeader = req.headers.get('authorization');\n  if (authHeader !== `Bearer ${process.env.REVENUECAT_WEBHOOK_SECRET}`) {\n    return NextResponse.json({ error: 'Unauthorized' }, { status: 401 });\n  }\n\n  const body: RevenueCatEvent = await req.json();\n\n  \u002F\u002F Sandbox event'lerini filtrele (production'da)\n  if (process.env.NODE_ENV === 'production' && body.event.environment === 'SANDBOX') {\n    return NextResponse.json({ ok: true });\n  }\n\n  const handler = EVENT_HANDLERS[body.event.type];\n  if (handler) {\n    await handler(body.event);\n  }\n\n  return NextResponse.json({ ok: true });\n}\n```\n\n---\n\n## Sandbox Testing\n\n### iOS Sandbox\n\n1. App Store Connect > Users and Access > Sandbox Testers\n2. Yeni sandbox kullanici olustur (gercek email gerekli)\n3. iPhone Settings > App Store > Sandbox Account ile giris\n4. Sandbox'ta sureler kisaltilmis:\n   - 1 haftalik = 3 dakika\n   - 1 aylik = 5 dakika\n   - 1 yillik = 1 saat\n   - Auto-renew 6 kez sonra durur\n\n### Android Test\n\n1. Google Play Console > Setup > License testing\n2. Test email'lerini ekle\n3. Test track'e yukle (internal testing)\n4. `Purchases.logLevel = .debug` ile test et\n\n### Debug Checklist\n\n```\n[ ] RevenueCat dashboard'da sandbox event'leri gorunuyor mu?\n[ ] Entitlement dogru aktive oluyor mu?\n[ ] Restore purchases calisiyor mu?\n[ ] Webhook'lar geliyor mu? (RequestBin ile test et)\n[ ] Fiyatlar locale'e gore formatlanmis mi?\n[ ] Trial suresi dogru gorunuyor mu?\n[ ] Iptal sonrasi erisim sure sonunda kapaniyor mu?\n```\n\n---\n\n## StoreKit 2 Migration Notlari\n\n- RevenueCat v4+ StoreKit 2'yi otomatik destekler\n- `usesStoreKit2IfAvailable: true` ile etkinlestir\n- StoreKit 2 avantajlari: real-time transaction updates, better receipt handling\n- iOS 15+ gerektirir (iOS 14 icin StoreKit 1 fallback otomatik)\n- Server-side receipt validation artik gerekli degil (SK2 bunu yapiyor)\n\n## Onemli Kurallar\n\n1. **Restore Purchases butonu ZORUNLU** (Apple reject eder yoksa)\n2. **Fiyatlari localizedPriceString ile goster** (hardcode ETME)\n3. **Sandbox'ta test etmeden production'a cikma**\n4. **Webhook secret'i .env'de tut** (hardcode ETME)\n5. **BILLING_ISSUE event'ini handle et** (grace period uygula)\n6. **Trial bitis tarihini kullaniciya goster** (seffaflik)\n7. **Anonim -> kayitli kullanici gecisinde merge yap** (veri kaybi olmasin)\n",{"name":5,"description":7},"main","70e1c350500ee750987420bbae48837afa906b7e","skills\u002Frevenuecat-patterns","https:\u002F\u002Fgithub.com\u002Frubicanjr\u002FFinCognis","https:\u002F\u002Fgithub.com\u002Frubicanjr","linktr.ee\u002Ffinanskodu","Industrial Engineer & CIO @FinansKodu. Architecting AI-driven financial agents and autonomous workflows. 🏗️ Building systems, not just prompts.","2026-06-09 13:50:15",{"source":8,"skillName":5,"commands":53,"prompt":63,"zipAvailable":64},[54,57,60],{"tool":55,"command":56},"npx","npx skills add rubicanjr\u002FFinCognis --skill revenuecat-patterns",{"tool":58,"command":59},"bunx","bunx skills add rubicanjr\u002FFinCognis --skill revenuecat-patterns",{"tool":61,"command":62},"pnpm","pnpm dlx skills add rubicanjr\u002FFinCognis --skill revenuecat-patterns","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Frubicanjr\u002FFinCognis\u002Fblob\u002Fmain\u002Fskills\u002Frevenuecat-patterns\u002FSKILL.md",true,[],[67,83,92,108,134,153],{"skillNo":68,"name":69,"nameZh":6,"description":70,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":71,"categories":72,"keywords":73,"publishedAt":39},"01M6NWS9DAXJTADT4T5MB49X8W","workflow-router","Goal-based workflow orchestration - routes tasks to specialist agents based on user goals","https:\u002F\u002Fgithub.com\u002Frubicanjr\u002FFinCognis\u002Fblob\u002Fmain\u002Fskills\u002Fworkflow-router\u002FSKILL.md",[],[74,75,76,77,78,79,80,81,82],"workflow router","workflow","router","orchestration","goals","goal","user","workflow orchestration","tasks",{"skillNo":84,"name":85,"nameZh":6,"description":86,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":87,"categories":88,"keywords":89,"publishedAt":39},"01M6NWS3RETSC0SHP16HP66E14","wiring","Wiring Verification","https:\u002F\u002Fgithub.com\u002Frubicanjr\u002FFinCognis\u002Fblob\u002Fmain\u002Fskills\u002Fwiring\u002FSKILL.md",[],[85,90,91],"verification","false",{"skillNo":93,"name":94,"nameZh":6,"description":95,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":96,"categories":97,"keywords":98,"publishedAt":39},"01M6NWS0XW9CVQZBDA1EGW0TWC","websocket-patterns","Connection management, room patterns, reconnection strategies, message buffering, and binary protocol design.","https:\u002F\u002Fgithub.com\u002Frubicanjr\u002FFinCognis\u002Fblob\u002Fmain\u002Fskills\u002Fwebsocket-patterns\u002Fskill.md",[],[99,21,100,101,102,103,104,105,106,107],"websocket","websocket patterns","design","protocol","management","message","strategies","binary","connection",{"skillNo":109,"name":110,"nameZh":6,"description":111,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":112,"categories":113,"keywords":114,"publishedAt":39},"01M6NWRDQDX9ZNETAWRRMQWV52","visual-verdict","Screenshot comparison QA for frontend development. Takes a screenshot of the current implementation, scores it across multiple visual dimensions, and returns a structured PASS\u002FREVISE\u002FFAIL verdict with concrete fixes. Use when implementing UI from a design reference or verifying visual correctness.","https:\u002F\u002Fgithub.com\u002Frubicanjr\u002FFinCognis\u002Fblob\u002Fmain\u002Fskills\u002Fvisual-verdict\u002FSKILL.md",[],[115,116,117,118,119,120,121,122,123,124,125,126,127,101,128,129,130,131,132,133],"visual","verdict","visual verdict","ui","across","revise","comparison","correctness","implementing","for","fixes","dimensions","frontend","development","qa","screenshot","returns","use","frontend development",{"skillNo":135,"name":136,"nameZh":6,"description":137,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":138,"categories":139,"keywords":140,"publishedAt":39},"01M6NWR8HSNRS7MNDK2J02QYMN","verification-loop","Comprehensive verification system covering build, types, lint, tests, security, and diff review before a PR.","https:\u002F\u002Fgithub.com\u002Frubicanjr\u002FFinCognis\u002Fblob\u002Fmain\u002Fskills\u002Fverification-loop\u002FSKILL.md",[],[141,142,90,143,144,145,146,147,148,149,150,151,152],"verification loop","loop","lint","review","security","pr","system","diff","build","tests","diff review","types",{"skillNo":154,"name":155,"nameZh":6,"description":156,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":157,"categories":158,"keywords":159,"publishedAt":39},"01M6NWR4HHSFR0VR5EXFRWA747","vector-db-patterns","Embedding strategies, ANN algorithms, hybrid search, RAG chunking strategies, and reranking for semantic search and retrieval.","https:\u002F\u002Fgithub.com\u002Frubicanjr\u002FFinCognis\u002Fblob\u002Fmain\u002Fskills\u002Fvector-db-patterns\u002Fskill.md",[],[160,161,162,163,21,164,165,166,167,105,168,169,170,171,172,124,173,174],"vector db patterns","vector db","db","vector","semantic search","search","embedding strategies","algorithms","chunking","semantic","retrieval","embedding","Hybrid Search","hybrid","rag"]