react-native-iap 14.4.10 → 14.4.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. package/android/src/main/java/com/margelo/nitro/iap/HybridRnIap.kt +195 -12
  2. package/ios/HybridRnIap.swift +115 -2
  3. package/ios/RnIapHelper.swift +32 -1
  4. package/lib/module/hooks/useIAP.js +24 -3
  5. package/lib/module/hooks/useIAP.js.map +1 -1
  6. package/lib/module/index.js +275 -2
  7. package/lib/module/index.js.map +1 -1
  8. package/lib/module/types.js +18 -0
  9. package/lib/module/types.js.map +1 -1
  10. package/lib/module/utils/type-bridge.js +39 -1
  11. package/lib/module/utils/type-bridge.js.map +1 -1
  12. package/lib/typescript/plugin/src/withIAP.d.ts +27 -0
  13. package/lib/typescript/plugin/src/withIAP.d.ts.map +1 -1
  14. package/lib/typescript/src/hooks/useIAP.d.ts +6 -1
  15. package/lib/typescript/src/hooks/useIAP.d.ts.map +1 -1
  16. package/lib/typescript/src/index.d.ts +133 -0
  17. package/lib/typescript/src/index.d.ts.map +1 -1
  18. package/lib/typescript/src/specs/RnIap.nitro.d.ts +101 -2
  19. package/lib/typescript/src/specs/RnIap.nitro.d.ts.map +1 -1
  20. package/lib/typescript/src/types.d.ts +116 -13
  21. package/lib/typescript/src/types.d.ts.map +1 -1
  22. package/lib/typescript/src/utils/type-bridge.d.ts.map +1 -1
  23. package/nitrogen/generated/android/NitroIapOnLoad.cpp +2 -0
  24. package/nitrogen/generated/android/c++/JAlternativeBillingModeAndroid.hpp +62 -0
  25. package/nitrogen/generated/android/c++/JExternalPurchaseLinkResultIOS.hpp +58 -0
  26. package/nitrogen/generated/android/c++/JExternalPurchaseNoticeAction.hpp +59 -0
  27. package/nitrogen/generated/android/c++/JExternalPurchaseNoticeResultIOS.hpp +60 -0
  28. package/nitrogen/generated/android/c++/JFunc_void_NitroProduct.hpp +2 -0
  29. package/nitrogen/generated/android/c++/JFunc_void_UserChoiceBillingDetails.hpp +78 -0
  30. package/nitrogen/generated/android/c++/JHybridRnIapSpec.cpp +136 -3
  31. package/nitrogen/generated/android/c++/JHybridRnIapSpec.hpp +9 -1
  32. package/nitrogen/generated/android/c++/JInitConnectionConfig.hpp +55 -0
  33. package/nitrogen/generated/android/c++/JNitroOneTimePurchaseOfferDetail.hpp +61 -0
  34. package/nitrogen/generated/android/c++/JNitroProduct.hpp +16 -2
  35. package/nitrogen/generated/android/c++/JNitroPurchase.hpp +74 -2
  36. package/nitrogen/generated/android/c++/JPurchaseAndroid.hpp +4 -0
  37. package/nitrogen/generated/android/c++/JPurchaseIOS.hpp +4 -0
  38. package/nitrogen/generated/android/c++/JUserChoiceBillingDetails.hpp +75 -0
  39. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/AlternativeBillingModeAndroid.kt +22 -0
  40. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/ExternalPurchaseLinkResultIOS.kt +32 -0
  41. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/ExternalPurchaseNoticeAction.kt +21 -0
  42. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/ExternalPurchaseNoticeResultIOS.kt +32 -0
  43. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/Func_void_UserChoiceBillingDetails.kt +81 -0
  44. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/HybridRnIapSpec.kt +43 -1
  45. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/InitConnectionConfig.kt +29 -0
  46. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroOneTimePurchaseOfferDetail.kt +35 -0
  47. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroProduct.kt +10 -1
  48. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroPurchase.kt +55 -1
  49. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/PurchaseAndroid.kt +3 -0
  50. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/PurchaseIOS.kt +3 -0
  51. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/UserChoiceBillingDetails.kt +32 -0
  52. package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Bridge.cpp +24 -0
  53. package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Bridge.hpp +174 -0
  54. package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Umbrella.hpp +21 -0
  55. package/nitrogen/generated/ios/c++/HybridRnIapSpecSwift.hpp +84 -3
  56. package/nitrogen/generated/ios/swift/AlternativeBillingModeAndroid.swift +44 -0
  57. package/nitrogen/generated/ios/swift/ExternalPurchaseLinkResultIOS.swift +65 -0
  58. package/nitrogen/generated/ios/swift/ExternalPurchaseNoticeAction.swift +40 -0
  59. package/nitrogen/generated/ios/swift/ExternalPurchaseNoticeResultIOS.swift +65 -0
  60. package/nitrogen/generated/ios/swift/Func_void_ExternalPurchaseLinkResultIOS.swift +47 -0
  61. package/nitrogen/generated/ios/swift/Func_void_ExternalPurchaseNoticeResultIOS.swift +47 -0
  62. package/nitrogen/generated/ios/swift/Func_void_UserChoiceBillingDetails.swift +47 -0
  63. package/nitrogen/generated/ios/swift/HybridRnIapSpec.swift +9 -1
  64. package/nitrogen/generated/ios/swift/HybridRnIapSpec_cxx.swift +168 -2
  65. package/nitrogen/generated/ios/swift/InitConnectionConfig.swift +47 -0
  66. package/nitrogen/generated/ios/swift/NitroOneTimePurchaseOfferDetail.swift +57 -0
  67. package/nitrogen/generated/ios/swift/NitroProduct.swift +91 -1
  68. package/nitrogen/generated/ios/swift/NitroPurchase.swift +520 -1
  69. package/nitrogen/generated/ios/swift/PurchaseAndroid.swift +31 -1
  70. package/nitrogen/generated/ios/swift/PurchaseIOS.swift +31 -1
  71. package/nitrogen/generated/ios/swift/UserChoiceBillingDetails.swift +58 -0
  72. package/nitrogen/generated/shared/c++/AlternativeBillingModeAndroid.hpp +80 -0
  73. package/nitrogen/generated/shared/c++/ExternalPurchaseLinkResultIOS.hpp +72 -0
  74. package/nitrogen/generated/shared/c++/ExternalPurchaseNoticeAction.hpp +76 -0
  75. package/nitrogen/generated/shared/c++/ExternalPurchaseNoticeResultIOS.hpp +74 -0
  76. package/nitrogen/generated/shared/c++/HybridRnIapSpec.cpp +8 -0
  77. package/nitrogen/generated/shared/c++/HybridRnIapSpec.hpp +22 -2
  78. package/nitrogen/generated/shared/c++/InitConnectionConfig.hpp +69 -0
  79. package/nitrogen/generated/shared/c++/NitroOneTimePurchaseOfferDetail.hpp +75 -0
  80. package/nitrogen/generated/shared/c++/NitroProduct.hpp +17 -2
  81. package/nitrogen/generated/shared/c++/NitroPurchase.hpp +74 -2
  82. package/nitrogen/generated/shared/c++/PurchaseAndroid.hpp +5 -1
  83. package/nitrogen/generated/shared/c++/PurchaseIOS.hpp +5 -1
  84. package/nitrogen/generated/shared/c++/UserChoiceBillingDetails.hpp +72 -0
  85. package/openiap-versions.json +3 -3
  86. package/package.json +3 -3
  87. package/plugin/build/withIAP.d.ts +27 -0
  88. package/plugin/build/withIAP.js +91 -1
  89. package/plugin/src/withIAP.ts +162 -0
  90. package/src/hooks/useIAP.ts +47 -1
  91. package/src/index.ts +313 -2
  92. package/src/specs/RnIap.nitro.ts +131 -1
  93. package/src/types.ts +124 -13
  94. package/src/utils/type-bridge.ts +76 -16
@@ -26,8 +26,10 @@ import dev.hyo.openiap.RequestPurchaseResultPurchase
26
26
  import dev.hyo.openiap.RequestPurchaseResultPurchases
27
27
  import dev.hyo.openiap.RequestSubscriptionAndroidProps
28
28
  import dev.hyo.openiap.RequestSubscriptionPropsByPlatforms
29
+ import dev.hyo.openiap.InitConnectionConfig as OpenIapInitConnectionConfig
29
30
  import dev.hyo.openiap.listener.OpenIapPurchaseErrorListener
30
31
  import dev.hyo.openiap.listener.OpenIapPurchaseUpdateListener
32
+ import dev.hyo.openiap.listener.OpenIapUserChoiceBillingListener
31
33
  import kotlinx.coroutines.Dispatchers
32
34
  import kotlinx.coroutines.withContext
33
35
  import kotlinx.coroutines.CompletableDeferred
@@ -50,15 +52,16 @@ class HybridRnIap : HybridRnIapSpec() {
50
52
  private val purchaseUpdatedListeners = mutableListOf<(NitroPurchase) -> Unit>()
51
53
  private val purchaseErrorListeners = mutableListOf<(NitroPurchaseResult) -> Unit>()
52
54
  private val promotedProductListenersIOS = mutableListOf<(NitroProduct) -> Unit>()
55
+ private val userChoiceBillingListenersAndroid = mutableListOf<(UserChoiceBillingDetails) -> Unit>()
53
56
  private var listenersAttached = false
54
57
  private var isInitialized = false
55
58
  private var initDeferred: CompletableDeferred<Boolean>? = null
56
59
  private val initLock = Any()
57
60
 
58
61
  // Connection methods
59
- override fun initConnection(): Promise<Boolean> {
62
+ override fun initConnection(config: InitConnectionConfig?): Promise<Boolean> {
60
63
  return Promise.async {
61
- RnIapLog.payload("initConnection", null)
64
+ RnIapLog.payload("initConnection", config)
62
65
  // Fast-path: if already initialized, return immediately
63
66
  if (isInitialized) {
64
67
  RnIapLog.result("initConnection", true)
@@ -114,16 +117,39 @@ class HybridRnIap : HybridRnIapSpec() {
114
117
  )
115
118
  }.onFailure { RnIapLog.failure("purchaseErrorListener", it) }
116
119
  })
120
+ openIap.addUserChoiceBillingListener(OpenIapUserChoiceBillingListener { details ->
121
+ runCatching {
122
+ RnIapLog.result(
123
+ "userChoiceBillingListener",
124
+ mapOf("products" to details.products, "token" to details.externalTransactionToken)
125
+ )
126
+ val nitroDetails = UserChoiceBillingDetails(
127
+ externalTransactionToken = details.externalTransactionToken,
128
+ products = details.products.toTypedArray()
129
+ )
130
+ sendUserChoiceBilling(nitroDetails)
131
+ }.onFailure { RnIapLog.failure("userChoiceBillingListener", it) }
132
+ })
117
133
  RnIapLog.result("listeners.attach", "attached")
118
134
  }
119
135
 
120
136
  // We created it above; reuse the shared instance
121
137
  val deferred = initDeferred!!
122
138
  try {
139
+ // Convert Nitro config to OpenIAP config
140
+ val openIapConfig = config?.let {
141
+ OpenIapInitConnectionConfig(
142
+ alternativeBillingModeAndroid = when (it.alternativeBillingModeAndroid) {
143
+ com.margelo.nitro.iap.AlternativeBillingModeAndroid.USER_CHOICE -> dev.hyo.openiap.AlternativeBillingModeAndroid.UserChoice
144
+ com.margelo.nitro.iap.AlternativeBillingModeAndroid.ALTERNATIVE_ONLY -> dev.hyo.openiap.AlternativeBillingModeAndroid.AlternativeOnly
145
+ else -> null
146
+ }
147
+ )
148
+ }
123
149
  val ok = try {
124
- RnIapLog.payload("initConnection.native", null)
150
+ RnIapLog.payload("initConnection.native", openIapConfig)
125
151
  withContext(Dispatchers.Main) {
126
- openIap.initConnection()
152
+ openIap.initConnection(openIapConfig)
127
153
  }
128
154
  } catch (err: Throwable) {
129
155
  val error = OpenIAPError.InitConnection
@@ -189,7 +215,7 @@ class HybridRnIap : HybridRnIapSpec() {
189
215
  throw Exception(toErrorJson(OpenIAPError.EmptySkuList))
190
216
  }
191
217
 
192
- initConnection().await()
218
+ initConnection(null).await()
193
219
 
194
220
  val queryType = parseProductQueryType(type)
195
221
  val skusList = skus.toList()
@@ -262,7 +288,7 @@ class HybridRnIap : HybridRnIapSpec() {
262
288
  }
263
289
 
264
290
  try {
265
- initConnection().await()
291
+ initConnection(null).await()
266
292
  withContext(Dispatchers.Main) { runCatching { openIap.setActivity(context.currentActivity) } }
267
293
 
268
294
  val missingSkus = androidRequest.skus.filterNot { productTypeBySku.containsKey(it) }
@@ -377,7 +403,7 @@ class HybridRnIap : HybridRnIapSpec() {
377
403
  override fun getAvailablePurchases(options: NitroAvailablePurchasesOptions?): Promise<Array<NitroPurchase>> {
378
404
  return Promise.async {
379
405
  val androidOptions = options?.android
380
- initConnection().await()
406
+ initConnection(null).await()
381
407
 
382
408
  RnIapLog.payload(
383
409
  "getAvailablePurchases",
@@ -444,7 +470,7 @@ class HybridRnIap : HybridRnIapSpec() {
444
470
 
445
471
  // Ensure connection; if it fails, return an error result instead of throwing
446
472
  try {
447
- initConnection().await()
473
+ initConnection(null).await()
448
474
  } catch (e: Exception) {
449
475
  val err = OpenIAPError.InitConnection
450
476
  return@async Variant_Boolean_NitroPurchaseResult.Second(
@@ -494,7 +520,7 @@ class HybridRnIap : HybridRnIapSpec() {
494
520
  override fun getStorefront(): Promise<String> {
495
521
  return Promise.async {
496
522
  try {
497
- initConnection().await()
523
+ initConnection(null).await()
498
524
  RnIapLog.payload("getStorefront", null)
499
525
  val value = openIap.getStorefront()
500
526
  RnIapLog.result("getStorefront", value)
@@ -657,6 +683,13 @@ class HybridRnIap : HybridRnIapSpec() {
657
683
  }
658
684
 
659
685
  val subscriptionOffersJson = subscriptionOffers.takeIf { it.isNotEmpty() }?.let { serializeSubscriptionOffers(it) }
686
+ val oneTimeOfferNitro = oneTimeOffer?.let { otp ->
687
+ NitroOneTimePurchaseOfferDetail(
688
+ formattedPrice = otp.formattedPrice,
689
+ priceAmountMicros = otp.priceAmountMicros,
690
+ priceCurrencyCode = otp.priceCurrencyCode
691
+ )
692
+ }
660
693
 
661
694
  var originalPriceAndroid: String? = null
662
695
  var originalPriceAmountMicrosAndroid: Double? = null
@@ -695,6 +728,12 @@ class HybridRnIap : HybridRnIapSpec() {
695
728
  }
696
729
  }
697
730
 
731
+ val nameAndroid = when (product) {
732
+ is ProductAndroid -> product.nameAndroid
733
+ is ProductSubscriptionAndroid -> product.nameAndroid
734
+ else -> null
735
+ }
736
+
698
737
  return NitroProduct(
699
738
  id = product.id,
700
739
  title = product.title,
@@ -708,6 +747,7 @@ class HybridRnIap : HybridRnIapSpec() {
708
747
  typeIOS = null,
709
748
  isFamilyShareableIOS = null,
710
749
  jsonRepresentationIOS = null,
750
+ discountsIOS = null,
711
751
  subscriptionPeriodUnitIOS = null,
712
752
  subscriptionPeriodNumberIOS = null,
713
753
  introductoryPriceIOS = null,
@@ -715,6 +755,7 @@ class HybridRnIap : HybridRnIapSpec() {
715
755
  introductoryPricePaymentModeIOS = null,
716
756
  introductoryPriceNumberOfPeriodsIOS = null,
717
757
  introductoryPriceSubscriptionPeriodIOS = null,
758
+ nameAndroid = nameAndroid,
718
759
  originalPriceAndroid = originalPriceAndroid,
719
760
  originalPriceAmountMicrosAndroid = originalPriceAmountMicrosAndroid,
720
761
  introductoryPriceValueAndroid = introductoryPriceValueAndroid,
@@ -722,7 +763,8 @@ class HybridRnIap : HybridRnIapSpec() {
722
763
  introductoryPricePeriodAndroid = introductoryPricePeriodAndroid,
723
764
  subscriptionPeriodAndroid = subscriptionPeriodAndroid,
724
765
  freeTrialPeriodAndroid = freeTrialPeriodAndroid,
725
- subscriptionOfferDetailsAndroid = subscriptionOffersJson
766
+ subscriptionOfferDetailsAndroid = subscriptionOffersJson,
767
+ oneTimePurchaseOfferDetailsAndroid = oneTimeOfferNitro
726
768
  )
727
769
  }
728
770
 
@@ -748,6 +790,23 @@ class HybridRnIap : HybridRnIapSpec() {
748
790
  originalTransactionDateIOS = null,
749
791
  originalTransactionIdentifierIOS = null,
750
792
  appAccountToken = null,
793
+ appBundleIdIOS = null,
794
+ countryCodeIOS = null,
795
+ currencyCodeIOS = null,
796
+ currencySymbolIOS = null,
797
+ environmentIOS = null,
798
+ expirationDateIOS = null,
799
+ isUpgradedIOS = null,
800
+ offerIOS = null,
801
+ ownershipTypeIOS = null,
802
+ reasonIOS = null,
803
+ reasonStringRepresentationIOS = null,
804
+ revocationDateIOS = null,
805
+ revocationReasonIOS = null,
806
+ storefrontCountryCodeIOS = null,
807
+ subscriptionGroupIdIOS = null,
808
+ transactionReasonIOS = null,
809
+ webOrderLineItemIdIOS = null,
751
810
  purchaseTokenAndroid = androidPurchase?.purchaseToken,
752
811
  dataAndroid = androidPurchase?.dataAndroid,
753
812
  signatureAndroid = androidPurchase?.signatureAndroid,
@@ -756,7 +815,8 @@ class HybridRnIap : HybridRnIapSpec() {
756
815
  isAcknowledgedAndroid = androidPurchase?.isAcknowledgedAndroid,
757
816
  packageNameAndroid = androidPurchase?.packageNameAndroid,
758
817
  obfuscatedAccountIdAndroid = androidPurchase?.obfuscatedAccountIdAndroid,
759
- obfuscatedProfileIdAndroid = androidPurchase?.obfuscatedProfileIdAndroid
818
+ obfuscatedProfileIdAndroid = androidPurchase?.obfuscatedProfileIdAndroid,
819
+ developerPayloadAndroid = androidPurchase?.developerPayloadAndroid
760
820
  )
761
821
  }
762
822
 
@@ -791,7 +851,7 @@ class HybridRnIap : HybridRnIapSpec() {
791
851
  override fun deepLinkToSubscriptionsAndroid(options: NitroDeepLinkOptionsAndroid): Promise<Unit> {
792
852
  return Promise.async {
793
853
  try {
794
- initConnection().await()
854
+ initConnection(null).await()
795
855
  OpenIapDeepLinkOptions(
796
856
  skuAndroid = options.skuAndroid,
797
857
  packageNameAndroid = options.packageNameAndroid
@@ -989,9 +1049,132 @@ class HybridRnIap : HybridRnIapSpec() {
989
1049
  }
990
1050
  }
991
1051
 
1052
+ // -------------------------------------------------------------------------
1053
+ // Alternative Billing (Android)
1054
+ // -------------------------------------------------------------------------
1055
+
1056
+ override fun checkAlternativeBillingAvailabilityAndroid(): Promise<Boolean> {
1057
+ return Promise.async {
1058
+ RnIapLog.payload("checkAlternativeBillingAvailabilityAndroid", null)
1059
+ try {
1060
+ val isAvailable = withContext(Dispatchers.Main) {
1061
+ openIap.checkAlternativeBillingAvailability()
1062
+ }
1063
+ RnIapLog.result("checkAlternativeBillingAvailabilityAndroid", isAvailable)
1064
+ isAvailable
1065
+ } catch (err: Throwable) {
1066
+ RnIapLog.failure("checkAlternativeBillingAvailabilityAndroid", err)
1067
+ val errorType = parseOpenIapError(err)
1068
+ throw Exception(toErrorJson(errorType, debugMessage = err.message))
1069
+ }
1070
+ }
1071
+ }
1072
+
1073
+ override fun showAlternativeBillingDialogAndroid(): Promise<Boolean> {
1074
+ return Promise.async {
1075
+ RnIapLog.payload("showAlternativeBillingDialogAndroid", null)
1076
+ try {
1077
+ val activity = context.currentActivity
1078
+ ?: throw Exception(toErrorJson(OpenIAPError.DeveloperError, debugMessage = "Activity not available"))
1079
+
1080
+ val userAccepted = withContext(Dispatchers.Main) {
1081
+ openIap.setActivity(activity)
1082
+ openIap.showAlternativeBillingInformationDialog(activity)
1083
+ }
1084
+ RnIapLog.result("showAlternativeBillingDialogAndroid", userAccepted)
1085
+ userAccepted
1086
+ } catch (err: Throwable) {
1087
+ RnIapLog.failure("showAlternativeBillingDialogAndroid", err)
1088
+ val errorType = parseOpenIapError(err)
1089
+ throw Exception(toErrorJson(errorType, debugMessage = err.message))
1090
+ }
1091
+ }
1092
+ }
1093
+
1094
+ override fun createAlternativeBillingTokenAndroid(sku: String?): Promise<String?> {
1095
+ return Promise.async {
1096
+ RnIapLog.payload("createAlternativeBillingTokenAndroid", mapOf("sku" to sku))
1097
+ try {
1098
+ // Note: OpenIapModule.createAlternativeBillingReportingToken() doesn't accept sku parameter
1099
+ // The sku parameter is ignored for now - may be used in future versions
1100
+ val token = withContext(Dispatchers.Main) {
1101
+ openIap.createAlternativeBillingReportingToken()
1102
+ }
1103
+ RnIapLog.result("createAlternativeBillingTokenAndroid", token)
1104
+ token
1105
+ } catch (err: Throwable) {
1106
+ RnIapLog.failure("createAlternativeBillingTokenAndroid", err)
1107
+ val errorType = parseOpenIapError(err)
1108
+ throw Exception(toErrorJson(errorType, debugMessage = err.message))
1109
+ }
1110
+ }
1111
+ }
1112
+
1113
+ // User Choice Billing listener
1114
+ override fun addUserChoiceBillingListenerAndroid(listener: (UserChoiceBillingDetails) -> Unit) {
1115
+ synchronized(userChoiceBillingListenersAndroid) {
1116
+ userChoiceBillingListenersAndroid.add(listener)
1117
+ }
1118
+ }
1119
+
1120
+ override fun removeUserChoiceBillingListenerAndroid(listener: (UserChoiceBillingDetails) -> Unit) {
1121
+ synchronized(userChoiceBillingListenersAndroid) {
1122
+ userChoiceBillingListenersAndroid.remove(listener)
1123
+ }
1124
+ }
1125
+
1126
+ private fun sendUserChoiceBilling(details: UserChoiceBillingDetails) {
1127
+ synchronized(userChoiceBillingListenersAndroid) {
1128
+ userChoiceBillingListenersAndroid.forEach { it(details) }
1129
+ }
1130
+ }
1131
+
1132
+ // -------------------------------------------------------------------------
1133
+ // External Purchase (iOS) - Not supported on Android
1134
+ // -------------------------------------------------------------------------
1135
+
1136
+ override fun canPresentExternalPurchaseNoticeIOS(): Promise<Boolean> {
1137
+ return Promise.async {
1138
+ throw Exception(toErrorJson(OpenIAPError.NotSupported))
1139
+ }
1140
+ }
1141
+
1142
+ override fun presentExternalPurchaseNoticeSheetIOS(): Promise<ExternalPurchaseNoticeResultIOS> {
1143
+ return Promise.async {
1144
+ throw Exception(toErrorJson(OpenIAPError.NotSupported))
1145
+ }
1146
+ }
1147
+
1148
+ override fun presentExternalPurchaseLinkIOS(url: String): Promise<ExternalPurchaseLinkResultIOS> {
1149
+ return Promise.async {
1150
+ throw Exception(toErrorJson(OpenIAPError.NotSupported))
1151
+ }
1152
+ }
1153
+
992
1154
  // ---------------------------------------------------------------------
993
1155
  // OpenIAP error helpers: unify error codes/messages from library
994
1156
  // ---------------------------------------------------------------------
1157
+ private fun parseOpenIapError(err: Throwable): OpenIAPError {
1158
+ // Try to extract OpenIAPError from the exception chain
1159
+ var cause: Throwable? = err
1160
+ while (cause != null) {
1161
+ val message = cause.message ?: ""
1162
+ // Check if message contains OpenIAP error patterns
1163
+ when {
1164
+ message.contains("not prepared", ignoreCase = true) ||
1165
+ message.contains("not initialized", ignoreCase = true) -> return OpenIAPError.NotPrepared
1166
+ message.contains("developer error", ignoreCase = true) ||
1167
+ message.contains("activity not available", ignoreCase = true) -> return OpenIAPError.DeveloperError
1168
+ message.contains("network", ignoreCase = true) -> return OpenIAPError.NetworkError
1169
+ message.contains("service unavailable", ignoreCase = true) ||
1170
+ message.contains("billing unavailable", ignoreCase = true) -> return OpenIAPError.ServiceUnavailable
1171
+ }
1172
+ cause = cause.cause
1173
+ }
1174
+ // Default to ServiceUnavailable if we can't determine the error type
1175
+ return OpenIAPError.ServiceUnavailable
1176
+ }
1177
+
995
1178
  private fun toErrorJson(
996
1179
  error: OpenIAPError,
997
1180
  productId: String? = null,
@@ -38,9 +38,9 @@ class HybridRnIap: HybridRnIapSpec {
38
38
 
39
39
 
40
40
 
41
- func initConnection() throws -> Promise<Bool> {
41
+ func initConnection(config: InitConnectionConfig?) throws -> Promise<Bool> {
42
42
  return Promise.async {
43
- RnIapLog.payload("initConnection", nil)
43
+ RnIapLog.payload("initConnection", config?.alternativeBillingModeAndroid)
44
44
  self.attachListenersIfNeeded()
45
45
 
46
46
  if self.isInitialized || self.isInitializing {
@@ -51,6 +51,8 @@ class HybridRnIap: HybridRnIapSpec {
51
51
  self.isInitializing = true
52
52
 
53
53
  do {
54
+ // Note: iOS doesn't support alternative billing config parameter
55
+ // Config is ignored on iOS platform
54
56
  let ok = try await OpenIapModule.shared.initConnection()
55
57
  RnIapLog.result("initConnection", ok)
56
58
  self.isInitialized = ok
@@ -928,4 +930,115 @@ class HybridRnIap: HybridRnIapSpec {
928
930
  throw PurchaseError.make(code: .featureNotSupported)
929
931
  }
930
932
  }
933
+
934
+ // MARK: - Alternative Billing (Android) - Not supported on iOS
935
+
936
+ func checkAlternativeBillingAvailabilityAndroid() throws -> Promise<Bool> {
937
+ return Promise.async {
938
+ throw PurchaseError.make(code: .featureNotSupported)
939
+ }
940
+ }
941
+
942
+ func showAlternativeBillingDialogAndroid() throws -> Promise<Bool> {
943
+ return Promise.async {
944
+ throw PurchaseError.make(code: .featureNotSupported)
945
+ }
946
+ }
947
+
948
+ func createAlternativeBillingTokenAndroid(sku: String?) throws -> Promise<String?> {
949
+ return Promise.async {
950
+ throw PurchaseError.make(code: .featureNotSupported)
951
+ }
952
+ }
953
+
954
+ func addUserChoiceBillingListenerAndroid(listener: @escaping (UserChoiceBillingDetails) -> Void) throws {
955
+ // No-op on iOS
956
+ }
957
+
958
+ func removeUserChoiceBillingListenerAndroid(listener: @escaping (UserChoiceBillingDetails) -> Void) throws {
959
+ // No-op on iOS
960
+ }
961
+
962
+ // MARK: - External Purchase (iOS 16.0+)
963
+
964
+ func canPresentExternalPurchaseNoticeIOS() throws -> Promise<Bool> {
965
+ return Promise.async {
966
+ RnIapLog.payload("canPresentExternalPurchaseNoticeIOS", nil)
967
+
968
+ if #available(iOS 16.0, *) {
969
+ try self.ensureConnection()
970
+ do {
971
+ let canPresent = try await OpenIapModule.shared.canPresentExternalPurchaseNoticeIOS()
972
+ RnIapLog.result("canPresentExternalPurchaseNoticeIOS", canPresent)
973
+ return canPresent
974
+ } catch {
975
+ RnIapLog.failure("canPresentExternalPurchaseNoticeIOS", error: error)
976
+ throw PurchaseError.make(code: .serviceError, message: error.localizedDescription)
977
+ }
978
+ } else {
979
+ let err = PurchaseError.make(code: .featureNotSupported, message: "External purchase notice requires iOS 16.0 or later")
980
+ RnIapLog.failure("canPresentExternalPurchaseNoticeIOS", error: err)
981
+ throw err
982
+ }
983
+ }
984
+ }
985
+
986
+ func presentExternalPurchaseNoticeSheetIOS() throws -> Promise<ExternalPurchaseNoticeResultIOS> {
987
+ return Promise.async {
988
+ RnIapLog.payload("presentExternalPurchaseNoticeSheetIOS", nil)
989
+
990
+ if #available(iOS 16.0, *) {
991
+ try self.ensureConnection()
992
+ do {
993
+ let result = try await OpenIapModule.shared.presentExternalPurchaseNoticeSheetIOS()
994
+
995
+ // Convert OpenIAP action to Nitro action via raw value
996
+ let actionString = result.result.rawValue
997
+ guard let nitroAction = ExternalPurchaseNoticeAction(fromString: actionString) else {
998
+ throw PurchaseError.make(code: .serviceError, message: "Invalid action: \(actionString)")
999
+ }
1000
+
1001
+ let nitroResult = ExternalPurchaseNoticeResultIOS(
1002
+ error: result.error,
1003
+ result: nitroAction
1004
+ )
1005
+ RnIapLog.result("presentExternalPurchaseNoticeSheetIOS", result)
1006
+ return nitroResult
1007
+ } catch {
1008
+ RnIapLog.failure("presentExternalPurchaseNoticeSheetIOS", error: error)
1009
+ throw PurchaseError.make(code: .serviceError, message: error.localizedDescription)
1010
+ }
1011
+ } else {
1012
+ let err = PurchaseError.make(code: .featureNotSupported, message: "External purchase notice requires iOS 16.0 or later")
1013
+ RnIapLog.failure("presentExternalPurchaseNoticeSheetIOS", error: err)
1014
+ throw err
1015
+ }
1016
+ }
1017
+ }
1018
+
1019
+ func presentExternalPurchaseLinkIOS(url: String) throws -> Promise<ExternalPurchaseLinkResultIOS> {
1020
+ return Promise.async {
1021
+ RnIapLog.payload("presentExternalPurchaseLinkIOS", ["url": url])
1022
+
1023
+ if #available(iOS 16.0, *) {
1024
+ try self.ensureConnection()
1025
+ do {
1026
+ let result = try await OpenIapModule.shared.presentExternalPurchaseLinkIOS(url)
1027
+ let nitroResult = ExternalPurchaseLinkResultIOS(
1028
+ error: result.error,
1029
+ success: result.success
1030
+ )
1031
+ RnIapLog.result("presentExternalPurchaseLinkIOS", result)
1032
+ return nitroResult
1033
+ } catch {
1034
+ RnIapLog.failure("presentExternalPurchaseLinkIOS", error: error)
1035
+ throw PurchaseError.make(code: .serviceError, message: error.localizedDescription)
1036
+ }
1037
+ } else {
1038
+ let err = PurchaseError.make(code: .featureNotSupported, message: "External purchase link requires iOS 16.0 or later")
1039
+ RnIapLog.failure("presentExternalPurchaseLinkIOS", error: err)
1040
+ throw err
1041
+ }
1042
+ }
1043
+ }
931
1044
  }
@@ -65,6 +65,12 @@ enum RnIapHelper {
65
65
  if let typeIOS = dictionary["typeIOS"] as? String { product.typeIOS = typeIOS }
66
66
  if let familyShareable = boolValue(dictionary["isFamilyShareableIOS"]) { product.isFamilyShareableIOS = familyShareable }
67
67
  if let jsonRepresentation = dictionary["jsonRepresentationIOS"] as? String { product.jsonRepresentationIOS = jsonRepresentation }
68
+ if let discounts = dictionary["discountsIOS"] as? [[String: Any]] {
69
+ if let jsonData = try? JSONSerialization.data(withJSONObject: discounts, options: []),
70
+ let jsonString = String(data: jsonData, encoding: .utf8) {
71
+ product.discountsIOS = jsonString
72
+ }
73
+ }
68
74
  if let subscriptionUnit = dictionary["subscriptionPeriodUnitIOS"] as? String { product.subscriptionPeriodUnitIOS = subscriptionUnit }
69
75
  if let subscriptionNumber = doubleValue(dictionary["subscriptionPeriodNumberIOS"]) { product.subscriptionPeriodNumberIOS = subscriptionNumber }
70
76
  if let introductoryPrice = dictionary["introductoryPriceIOS"] as? String { product.introductoryPriceIOS = introductoryPrice }
@@ -98,11 +104,36 @@ enum RnIapHelper {
98
104
  purchase.purchaseState = state
99
105
  }
100
106
  if let isAutoRenewing = boolValue(dictionary["isAutoRenewing"]) { purchase.isAutoRenewing = isAutoRenewing }
107
+
108
+ // iOS specific fields
101
109
  if let quantityIOS = doubleValue(dictionary["quantityIOS"]) { purchase.quantityIOS = quantityIOS }
102
110
  if let originalDate = doubleValue(dictionary["originalTransactionDateIOS"]) { purchase.originalTransactionDateIOS = originalDate }
103
111
  if let originalIdentifier = dictionary["originalTransactionIdentifierIOS"] as? String { purchase.originalTransactionIdentifierIOS = originalIdentifier }
104
112
  if let appAccountToken = dictionary["appAccountToken"] as? String { purchase.appAccountToken = appAccountToken }
105
-
113
+ if let appBundleId = dictionary["appBundleIdIOS"] as? String { purchase.appBundleIdIOS = appBundleId }
114
+ if let countryCode = dictionary["countryCodeIOS"] as? String { purchase.countryCodeIOS = countryCode }
115
+ if let currencyCode = dictionary["currencyCodeIOS"] as? String { purchase.currencyCodeIOS = currencyCode }
116
+ if let currencySymbol = dictionary["currencySymbolIOS"] as? String { purchase.currencySymbolIOS = currencySymbol }
117
+ if let environment = dictionary["environmentIOS"] as? String { purchase.environmentIOS = environment }
118
+ if let expirationDate = doubleValue(dictionary["expirationDateIOS"]) { purchase.expirationDateIOS = expirationDate }
119
+ if let isUpgraded = boolValue(dictionary["isUpgradedIOS"]) { purchase.isUpgradedIOS = isUpgraded }
120
+ if let offer = dictionary["offerIOS"] as? [String: Any] {
121
+ if let jsonData = try? JSONSerialization.data(withJSONObject: offer, options: []),
122
+ let jsonString = String(data: jsonData, encoding: .utf8) {
123
+ purchase.offerIOS = jsonString
124
+ }
125
+ }
126
+ if let ownershipType = dictionary["ownershipTypeIOS"] as? String { purchase.ownershipTypeIOS = ownershipType }
127
+ if let reason = dictionary["reasonIOS"] as? String { purchase.reasonIOS = reason }
128
+ if let reasonString = dictionary["reasonStringRepresentationIOS"] as? String { purchase.reasonStringRepresentationIOS = reasonString }
129
+ if let revocationDate = doubleValue(dictionary["revocationDateIOS"]) { purchase.revocationDateIOS = revocationDate }
130
+ if let revocationReason = dictionary["revocationReasonIOS"] as? String { purchase.revocationReasonIOS = revocationReason }
131
+ if let storefrontCountryCode = dictionary["storefrontCountryCodeIOS"] as? String { purchase.storefrontCountryCodeIOS = storefrontCountryCode }
132
+ if let subscriptionGroupId = dictionary["subscriptionGroupIdIOS"] as? String { purchase.subscriptionGroupIdIOS = subscriptionGroupId }
133
+ if let transactionReason = dictionary["transactionReasonIOS"] as? String { purchase.transactionReasonIOS = transactionReason }
134
+ if let webOrderLineItemId = dictionary["webOrderLineItemIdIOS"] as? String { purchase.webOrderLineItemIdIOS = webOrderLineItemId }
135
+
136
+ // Android specific fields
106
137
  if let purchaseTokenAndroid = dictionary["purchaseTokenAndroid"] as? String { purchase.purchaseTokenAndroid = purchaseTokenAndroid }
107
138
  if let dataAndroid = dictionary["dataAndroid"] as? String { purchase.dataAndroid = dataAndroid }
108
139
  if let signatureAndroid = dictionary["signatureAndroid"] as? String { purchase.signatureAndroid = signatureAndroid }
@@ -6,7 +6,7 @@ import { Platform } from 'react-native';
6
6
  import { RnIapConsole } from "../utils/debug.js";
7
7
 
8
8
  // Internal modules
9
- import { initConnection, purchaseErrorListener, purchaseUpdatedListener, promotedProductListenerIOS, getAvailablePurchases, finishTransaction as finishTransactionInternal, requestPurchase as requestPurchaseInternal, fetchProducts, validateReceipt as validateReceiptInternal, getActiveSubscriptions, hasActiveSubscriptions, restorePurchases as restorePurchasesTopLevel, getPromotedProductIOS, requestPurchaseOnPromotedProductIOS } from "../index.js";
9
+ import { initConnection, purchaseErrorListener, purchaseUpdatedListener, promotedProductListenerIOS, getAvailablePurchases, finishTransaction as finishTransactionInternal, requestPurchase as requestPurchaseInternal, fetchProducts, validateReceipt as validateReceiptInternal, getActiveSubscriptions, hasActiveSubscriptions, restorePurchases as restorePurchasesTopLevel, getPromotedProductIOS, requestPurchaseOnPromotedProductIOS, checkAlternativeBillingAvailabilityAndroid, showAlternativeBillingDialogAndroid, createAlternativeBillingTokenAndroid, userChoiceBillingListenerAndroid } from "../index.js";
10
10
 
11
11
  // Types
12
12
  import { ErrorCode } from "../types.js";
@@ -174,7 +174,21 @@ export function useIAP(options) {
174
174
  }
175
175
  });
176
176
  }
177
- const result = await initConnection();
177
+
178
+ // Add user choice billing listener for Android (if provided)
179
+ if (Platform.OS === 'android' && optionsRef.current?.onUserChoiceBillingAndroid) {
180
+ subscriptionsRef.current.userChoiceBillingAndroid = userChoiceBillingListenerAndroid(details => {
181
+ if (optionsRef.current?.onUserChoiceBillingAndroid) {
182
+ optionsRef.current.onUserChoiceBillingAndroid(details);
183
+ }
184
+ });
185
+ }
186
+
187
+ // Initialize connection with config
188
+ const config = Platform.OS === 'android' && optionsRef.current?.alternativeBillingModeAndroid ? {
189
+ alternativeBillingModeAndroid: optionsRef.current.alternativeBillingModeAndroid
190
+ } : undefined;
191
+ const result = await initConnection(config);
178
192
  setConnected(result);
179
193
  if (!result) {
180
194
  // Clean up some listeners but leave purchaseError for potential retries
@@ -190,6 +204,7 @@ export function useIAP(options) {
190
204
  currentSubscriptions.purchaseUpdate?.remove();
191
205
  currentSubscriptions.purchaseError?.remove();
192
206
  currentSubscriptions.promotedProductIOS?.remove();
207
+ currentSubscriptions.userChoiceBillingAndroid?.remove();
193
208
  // Keep connection alive across screens to avoid race conditions
194
209
  setConnected(false);
195
210
  };
@@ -217,7 +232,13 @@ export function useIAP(options) {
217
232
  getPromotedProductIOS,
218
233
  requestPurchaseOnPromotedProductIOS,
219
234
  getActiveSubscriptions: getActiveSubscriptionsInternal,
220
- hasActiveSubscriptions: hasActiveSubscriptionsInternal
235
+ hasActiveSubscriptions: hasActiveSubscriptionsInternal,
236
+ // Alternative billing (Android only)
237
+ ...(Platform.OS === 'android' ? {
238
+ checkAlternativeBillingAvailabilityAndroid,
239
+ showAlternativeBillingDialogAndroid,
240
+ createAlternativeBillingTokenAndroid
241
+ } : {})
221
242
  };
222
243
  }
223
244
  //# sourceMappingURL=useIAP.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["useCallback","useEffect","useState","useRef","Platform","RnIapConsole","initConnection","purchaseErrorListener","purchaseUpdatedListener","promotedProductListenerIOS","getAvailablePurchases","finishTransaction","finishTransactionInternal","requestPurchase","requestPurchaseInternal","fetchProducts","validateReceipt","validateReceiptInternal","getActiveSubscriptions","hasActiveSubscriptions","restorePurchases","restorePurchasesTopLevel","getPromotedProductIOS","requestPurchaseOnPromotedProductIOS","ErrorCode","normalizeErrorCodeFromNative","useIAP","options","connected","setConnected","products","setProducts","subscriptions","setSubscriptions","availablePurchases","setAvailablePurchases","promotedProductIOS","setPromotedProductIOS","activeSubscriptions","setActiveSubscriptions","optionsRef","connectedRef","mergeWithDuplicateCheck","existingItems","newItems","getKey","merged","forEach","newItem","isDuplicate","some","existingItem","push","current","subscriptionsRef","subscriptionsRefState","fetchProductsInternal","params","warn","requestType","type","debug","skus","result","items","prevSubscriptions","subscription","id","newProducts","filter","item","newSubscriptions","prevProducts","product","error","getAvailablePurchasesInternal","_skus","alsoPublishToEventListenerIOS","onlyIncludeActiveItemsIOS","getActiveSubscriptionsInternal","subscriptionIds","hasActiveSubscriptionsInternal","args","err","requestObj","sku","androidOptions","initIapWithSubscriptions","purchaseUpdate","purchase","e","onPurchaseSuccess","purchaseError","mappedError","code","message","productId","undefined","InitConnection","onPurchaseError","OS","onPromotedProductIOS","remove","currentSubscriptions"],"sourceRoot":"../../../src","sources":["hooks/useIAP.ts"],"mappings":";;AAAA;AACA,SAAQA,WAAW,EAAEC,SAAS,EAAEC,QAAQ,EAAEC,MAAM,QAAO,OAAO;AAC9D,SAAQC,QAAQ,QAAO,cAAc;AACrC,SAAQC,YAAY,QAAO,mBAAgB;;AAE3C;AACA,SACEC,cAAc,EACdC,qBAAqB,EACrBC,uBAAuB,EACvBC,0BAA0B,EAC1BC,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sBAAsB,EAAE8D;EAC1B,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"names":["useCallback","useEffect","useState","useRef","Platform","RnIapConsole","initConnection","purchaseErrorListener","purchaseUpdatedListener","promotedProductListenerIOS","getAvailablePurchases","finishTransaction","finishTransactionInternal","requestPurchase","requestPurchaseInternal","fetchProducts","validateReceipt","validateReceiptInternal","getActiveSubscriptions","hasActiveSubscriptions","restorePurchases","restorePurchasesTopLevel","getPromotedProductIOS","requestPurchaseOnPromotedProductIOS","checkAlternativeBillingAvailabilityAndroid","showAlternativeBillingDialogAndroid","createAlternativeBillingTokenAndroid","userChoiceBillingListenerAndroid","ErrorCode","normalizeErrorCodeFromNative","useIAP","options","connected","setConnected","products","setProducts","subscriptions","setSubscriptions","availablePurchases","setAvailablePurchases","promotedProductIOS","setPromotedProductIOS","activeSubscriptions","setActiveSubscriptions","optionsRef","connectedRef","mergeWithDuplicateCheck","existingItems","newItems","getKey","merged","forEach","newItem","isDuplicate","some","existingItem","push","current","subscriptionsRef","subscriptionsRefState","fetchProductsInternal","params","warn","requestType","type","debug","skus","result","items","prevSubscriptions","subscription","id","newProducts","filter","item","newSubscriptions","prevProducts","product","error","getAvailablePurchasesInternal","_skus","alsoPublishToEventListenerIOS","onlyIncludeActiveItemsIOS","getActiveSubscriptionsInternal","subscriptionIds","hasActiveSubscriptionsInternal","args","err","requestObj","sku","androidOptions","initIapWithSubscriptions","purchaseUpdate","purchase","e","onPurchaseSuccess","purchaseError","mappedError","code","message","productId","undefined","InitConnection","onPurchaseError","OS","onPromotedProductIOS","onUserChoiceBillingAndroid","userChoiceBillingAndroid","details","config","alternativeBillingModeAndroid","remove","currentSubscriptions"],"sourceRoot":"../../../src","sources":["hooks/useIAP.ts"],"mappings":";;AAAA;AACA,SAAQA,WAAW,EAAEC,SAAS,EAAEC,QAAQ,EAAEC,MAAM,QAAO,OAAO;AAC9D,SAAQC,QAAQ,QAAO,cAAc;AACrC,SAAQC,YAAY,QAAO,mBAAgB;;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