react-native-iap 14.4.26 → 14.4.28

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 (152) hide show
  1. package/android/src/main/java/com/margelo/nitro/iap/HybridRnIap.kt +1 -1
  2. package/ios/RnIapHelper.swift +7 -1
  3. package/lib/module/index.js +3 -0
  4. package/lib/module/index.js.map +1 -1
  5. package/lib/module/utils/type-bridge.js +2 -1
  6. package/lib/module/utils/type-bridge.js.map +1 -1
  7. package/lib/typescript/src/index.d.ts.map +1 -1
  8. package/lib/typescript/src/specs/RnIap.nitro.d.ts +52 -8
  9. package/lib/typescript/src/specs/RnIap.nitro.d.ts.map +1 -1
  10. package/lib/typescript/src/types.d.ts +1 -1
  11. package/lib/typescript/src/types.d.ts.map +1 -1
  12. package/lib/typescript/src/utils/type-bridge.d.ts.map +1 -1
  13. package/nitrogen/generated/android/c++/JAndroidSubscriptionOfferInput.hpp +5 -1
  14. package/nitrogen/generated/android/c++/JExternalPurchaseLinkResultIOS.hpp +5 -1
  15. package/nitrogen/generated/android/c++/JExternalPurchaseNoticeResultIOS.hpp +5 -1
  16. package/nitrogen/generated/android/c++/JFunc_void_NitroProduct.hpp +2 -0
  17. package/nitrogen/generated/android/c++/JHybridRnIapSpec.cpp +4 -0
  18. package/nitrogen/generated/android/c++/JInitConnectionConfig.hpp +5 -1
  19. package/nitrogen/generated/android/c++/JNitroActiveSubscription.hpp +5 -1
  20. package/nitrogen/generated/android/c++/JNitroAvailablePurchasesAndroidOptions.hpp +5 -1
  21. package/nitrogen/generated/android/c++/JNitroAvailablePurchasesIosOptions.hpp +5 -1
  22. package/nitrogen/generated/android/c++/JNitroAvailablePurchasesOptions.hpp +5 -1
  23. package/nitrogen/generated/android/c++/JNitroDeepLinkOptionsAndroid.hpp +5 -1
  24. package/nitrogen/generated/android/c++/JNitroFinishTransactionAndroidParams.hpp +5 -1
  25. package/nitrogen/generated/android/c++/JNitroFinishTransactionIosParams.hpp +5 -1
  26. package/nitrogen/generated/android/c++/JNitroFinishTransactionParams.hpp +5 -1
  27. package/nitrogen/generated/android/c++/JNitroOneTimePurchaseOfferDetail.hpp +5 -1
  28. package/nitrogen/generated/android/c++/JNitroProduct.hpp +11 -5
  29. package/nitrogen/generated/android/c++/JNitroPurchase.hpp +5 -1
  30. package/nitrogen/generated/android/c++/JNitroPurchaseRequest.hpp +5 -1
  31. package/nitrogen/generated/android/c++/JNitroPurchaseResult.hpp +5 -1
  32. package/nitrogen/generated/android/c++/JNitroReceiptValidationAndroidOptions.hpp +5 -1
  33. package/nitrogen/generated/android/c++/JNitroReceiptValidationParams.hpp +5 -1
  34. package/nitrogen/generated/android/c++/JNitroReceiptValidationResultAndroid.hpp +5 -1
  35. package/nitrogen/generated/android/c++/JNitroReceiptValidationResultIOS.hpp +5 -1
  36. package/nitrogen/generated/android/c++/JNitroRenewalInfoIOS.hpp +5 -1
  37. package/nitrogen/generated/android/c++/JNitroRequestPurchaseAndroid.hpp +5 -1
  38. package/nitrogen/generated/android/c++/JNitroRequestPurchaseIos.hpp +5 -1
  39. package/nitrogen/generated/android/c++/JNitroSubscriptionRenewalInfo.hpp +5 -1
  40. package/nitrogen/generated/android/c++/JNitroSubscriptionStatus.hpp +5 -1
  41. package/nitrogen/generated/android/c++/JPaymentModeIOS.hpp +65 -0
  42. package/nitrogen/generated/android/c++/JPurchaseAndroid.hpp +5 -1
  43. package/nitrogen/generated/android/c++/JPurchaseIOS.hpp +5 -1
  44. package/nitrogen/generated/android/c++/JPurchaseOfferIOS.hpp +5 -1
  45. package/nitrogen/generated/android/c++/JRenewalInfoIOS.hpp +5 -1
  46. package/nitrogen/generated/android/c++/JUserChoiceBillingDetails.hpp +5 -1
  47. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/AndroidSubscriptionOfferInput.kt +16 -9
  48. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/ExternalPurchaseLinkResultIOS.kt +16 -9
  49. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/ExternalPurchaseNoticeResultIOS.kt +16 -9
  50. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/Func_void_NitroProduct.kt +0 -1
  51. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/Func_void_NitroPurchase.kt +0 -1
  52. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/Func_void_NitroPurchaseResult.kt +0 -1
  53. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/Func_void_UserChoiceBillingDetails.kt +0 -1
  54. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/HybridRnIapSpec.kt +3 -2
  55. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/InitConnectionConfig.kt +13 -6
  56. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroActiveSubscription.kt +52 -45
  57. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroAvailablePurchasesAndroidOptions.kt +13 -6
  58. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroAvailablePurchasesIosOptions.kt +22 -15
  59. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroAvailablePurchasesOptions.kt +16 -9
  60. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroDeepLinkOptionsAndroid.kt +16 -9
  61. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroFinishTransactionAndroidParams.kt +16 -9
  62. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroFinishTransactionIosParams.kt +13 -6
  63. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroFinishTransactionParams.kt +16 -9
  64. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroOneTimePurchaseOfferDetail.kt +19 -12
  65. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroProduct.kt +102 -95
  66. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroPurchase.kt +132 -125
  67. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroPurchaseRequest.kt +16 -9
  68. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroPurchaseResult.kt +25 -18
  69. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroReceiptValidationAndroidOptions.kt +22 -15
  70. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroReceiptValidationParams.kt +16 -9
  71. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroReceiptValidationResultAndroid.kt +66 -59
  72. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroReceiptValidationResultIOS.kt +22 -15
  73. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroRenewalInfoIOS.kt +43 -36
  74. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroRequestPurchaseAndroid.kt +31 -24
  75. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroRequestPurchaseIos.kt +25 -18
  76. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroSubscriptionRenewalInfo.kt +28 -21
  77. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroSubscriptionStatus.kt +19 -12
  78. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/PaymentModeIOS.kt +23 -0
  79. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/Purchase.kt +18 -1
  80. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/PurchaseAndroid.kt +69 -62
  81. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/PurchaseIOS.kt +111 -104
  82. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/PurchaseOfferIOS.kt +19 -12
  83. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/RenewalInfoIOS.kt +43 -36
  84. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/RequestPurchaseResult.kt +23 -1
  85. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/UserChoiceBillingDetails.kt +16 -9
  86. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/Variant_Boolean_NitroPurchaseResult.kt +18 -1
  87. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/Variant_NitroReceiptValidationResultIOS_NitroReceiptValidationResultAndroid.kt +18 -1
  88. package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Bridge.cpp +22 -22
  89. package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Bridge.hpp +26 -22
  90. package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Umbrella.hpp +3 -0
  91. package/nitrogen/generated/ios/c++/HybridRnIapSpecSwift.hpp +7 -4
  92. package/nitrogen/generated/ios/swift/Func_void_std__optional_NitroProduct_.swift +1 -8
  93. package/nitrogen/generated/ios/swift/Func_void_std__optional_NitroPurchase_.swift +1 -8
  94. package/nitrogen/generated/ios/swift/HybridRnIapSpec.swift +1 -0
  95. package/nitrogen/generated/ios/swift/HybridRnIapSpec_cxx.swift +3 -16
  96. package/nitrogen/generated/ios/swift/NitroActiveSubscription.swift +17 -10
  97. package/nitrogen/generated/ios/swift/NitroAvailablePurchasesIosOptions.swift +32 -4
  98. package/nitrogen/generated/ios/swift/NitroAvailablePurchasesOptions.swift +2 -16
  99. package/nitrogen/generated/ios/swift/NitroFinishTransactionAndroidParams.swift +8 -1
  100. package/nitrogen/generated/ios/swift/NitroFinishTransactionParams.swift +2 -16
  101. package/nitrogen/generated/ios/swift/NitroProduct.swift +14 -33
  102. package/nitrogen/generated/ios/swift/NitroPurchase.swift +25 -11
  103. package/nitrogen/generated/ios/swift/NitroPurchaseRequest.swift +2 -16
  104. package/nitrogen/generated/ios/swift/NitroReceiptValidationAndroidOptions.swift +8 -1
  105. package/nitrogen/generated/ios/swift/NitroReceiptValidationParams.swift +1 -8
  106. package/nitrogen/generated/ios/swift/NitroReceiptValidationResultIOS.swift +1 -8
  107. package/nitrogen/generated/ios/swift/NitroRenewalInfoIOS.swift +8 -1
  108. package/nitrogen/generated/ios/swift/NitroRequestPurchaseAndroid.swift +8 -1
  109. package/nitrogen/generated/ios/swift/NitroRequestPurchaseIos.swift +8 -1
  110. package/nitrogen/generated/ios/swift/NitroSubscriptionStatus.swift +1 -8
  111. package/nitrogen/generated/ios/swift/PaymentModeIOS.swift +48 -0
  112. package/nitrogen/generated/ios/swift/PurchaseAndroid.swift +16 -2
  113. package/nitrogen/generated/ios/swift/PurchaseIOS.swift +10 -17
  114. package/nitrogen/generated/ios/swift/RenewalInfoIOS.swift +8 -1
  115. package/nitrogen/generated/shared/c++/AndroidSubscriptionOfferInput.hpp +8 -0
  116. package/nitrogen/generated/shared/c++/ExternalPurchaseLinkResultIOS.hpp +8 -0
  117. package/nitrogen/generated/shared/c++/ExternalPurchaseNoticeResultIOS.hpp +8 -0
  118. package/nitrogen/generated/shared/c++/InitConnectionConfig.hpp +8 -0
  119. package/nitrogen/generated/shared/c++/NitroActiveSubscription.hpp +8 -0
  120. package/nitrogen/generated/shared/c++/NitroAvailablePurchasesAndroidOptions.hpp +8 -0
  121. package/nitrogen/generated/shared/c++/NitroAvailablePurchasesIosOptions.hpp +8 -0
  122. package/nitrogen/generated/shared/c++/NitroAvailablePurchasesOptions.hpp +8 -0
  123. package/nitrogen/generated/shared/c++/NitroDeepLinkOptionsAndroid.hpp +8 -0
  124. package/nitrogen/generated/shared/c++/NitroFinishTransactionAndroidParams.hpp +8 -0
  125. package/nitrogen/generated/shared/c++/NitroFinishTransactionIosParams.hpp +8 -0
  126. package/nitrogen/generated/shared/c++/NitroFinishTransactionParams.hpp +8 -0
  127. package/nitrogen/generated/shared/c++/NitroOneTimePurchaseOfferDetail.hpp +8 -0
  128. package/nitrogen/generated/shared/c++/NitroProduct.hpp +16 -5
  129. package/nitrogen/generated/shared/c++/NitroPurchase.hpp +8 -0
  130. package/nitrogen/generated/shared/c++/NitroPurchaseRequest.hpp +8 -0
  131. package/nitrogen/generated/shared/c++/NitroPurchaseResult.hpp +8 -0
  132. package/nitrogen/generated/shared/c++/NitroReceiptValidationAndroidOptions.hpp +8 -0
  133. package/nitrogen/generated/shared/c++/NitroReceiptValidationParams.hpp +8 -0
  134. package/nitrogen/generated/shared/c++/NitroReceiptValidationResultAndroid.hpp +8 -0
  135. package/nitrogen/generated/shared/c++/NitroReceiptValidationResultIOS.hpp +8 -0
  136. package/nitrogen/generated/shared/c++/NitroRenewalInfoIOS.hpp +8 -0
  137. package/nitrogen/generated/shared/c++/NitroRequestPurchaseAndroid.hpp +8 -0
  138. package/nitrogen/generated/shared/c++/NitroRequestPurchaseIos.hpp +8 -0
  139. package/nitrogen/generated/shared/c++/NitroSubscriptionRenewalInfo.hpp +8 -0
  140. package/nitrogen/generated/shared/c++/NitroSubscriptionStatus.hpp +8 -0
  141. package/nitrogen/generated/shared/c++/PaymentModeIOS.hpp +84 -0
  142. package/nitrogen/generated/shared/c++/PurchaseAndroid.hpp +8 -0
  143. package/nitrogen/generated/shared/c++/PurchaseIOS.hpp +8 -0
  144. package/nitrogen/generated/shared/c++/PurchaseOfferIOS.hpp +8 -0
  145. package/nitrogen/generated/shared/c++/RenewalInfoIOS.hpp +8 -0
  146. package/nitrogen/generated/shared/c++/UserChoiceBillingDetails.hpp +8 -0
  147. package/openiap-versions.json +2 -2
  148. package/package.json +4 -4
  149. package/src/index.ts +18 -0
  150. package/src/specs/RnIap.nitro.ts +52 -7
  151. package/src/types.ts +1 -1
  152. package/src/utils/type-bridge.ts +2 -1
@@ -17,6 +17,11 @@
17
17
  #else
18
18
  #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
19
19
  #endif
20
+ #if __has_include(<NitroModules/JSIHelpers.hpp>)
21
+ #include <NitroModules/JSIHelpers.hpp>
22
+ #else
23
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
24
+ #endif
20
25
 
21
26
  // Forward declaration of `NitroSubscriptionRenewalInfo` to properly resolve imports.
22
27
  namespace margelo::nitro::iap { struct NitroSubscriptionRenewalInfo; }
@@ -68,6 +73,9 @@ namespace margelo::nitro {
68
73
  return false;
69
74
  }
70
75
  jsi::Object obj = value.getObject(runtime);
76
+ if (!nitro::isPlainObject(runtime, obj)) {
77
+ return false;
78
+ }
71
79
  if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "state"))) return false;
72
80
  if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "platform"))) return false;
73
81
  if (!JSIConverter<std::optional<margelo::nitro::iap::NitroSubscriptionRenewalInfo>>::canConvert(runtime, obj.getProperty(runtime, "renewalInfo"))) return false;
@@ -0,0 +1,84 @@
1
+ ///
2
+ /// PaymentModeIOS.hpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2025 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #pragma once
9
+
10
+ #if __has_include(<NitroModules/NitroHash.hpp>)
11
+ #include <NitroModules/NitroHash.hpp>
12
+ #else
13
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
14
+ #endif
15
+ #if __has_include(<NitroModules/JSIConverter.hpp>)
16
+ #include <NitroModules/JSIConverter.hpp>
17
+ #else
18
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
19
+ #endif
20
+ #if __has_include(<NitroModules/NitroDefines.hpp>)
21
+ #include <NitroModules/NitroDefines.hpp>
22
+ #else
23
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
24
+ #endif
25
+
26
+ namespace margelo::nitro::iap {
27
+
28
+ /**
29
+ * An enum which can be represented as a JavaScript union (PaymentModeIOS).
30
+ */
31
+ enum class PaymentModeIOS {
32
+ EMPTY SWIFT_NAME(empty) = 0,
33
+ FREE_TRIAL SWIFT_NAME(freeTrial) = 1,
34
+ PAY_AS_YOU_GO SWIFT_NAME(payAsYouGo) = 2,
35
+ PAY_UP_FRONT SWIFT_NAME(payUpFront) = 3,
36
+ } CLOSED_ENUM;
37
+
38
+ } // namespace margelo::nitro::iap
39
+
40
+ namespace margelo::nitro {
41
+
42
+ // C++ PaymentModeIOS <> JS PaymentModeIOS (union)
43
+ template <>
44
+ struct JSIConverter<margelo::nitro::iap::PaymentModeIOS> final {
45
+ static inline margelo::nitro::iap::PaymentModeIOS fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
46
+ std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, arg);
47
+ switch (hashString(unionValue.c_str(), unionValue.size())) {
48
+ case hashString("empty"): return margelo::nitro::iap::PaymentModeIOS::EMPTY;
49
+ case hashString("free-trial"): return margelo::nitro::iap::PaymentModeIOS::FREE_TRIAL;
50
+ case hashString("pay-as-you-go"): return margelo::nitro::iap::PaymentModeIOS::PAY_AS_YOU_GO;
51
+ case hashString("pay-up-front"): return margelo::nitro::iap::PaymentModeIOS::PAY_UP_FRONT;
52
+ default: [[unlikely]]
53
+ throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum PaymentModeIOS - invalid value!");
54
+ }
55
+ }
56
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::iap::PaymentModeIOS arg) {
57
+ switch (arg) {
58
+ case margelo::nitro::iap::PaymentModeIOS::EMPTY: return JSIConverter<std::string>::toJSI(runtime, "empty");
59
+ case margelo::nitro::iap::PaymentModeIOS::FREE_TRIAL: return JSIConverter<std::string>::toJSI(runtime, "free-trial");
60
+ case margelo::nitro::iap::PaymentModeIOS::PAY_AS_YOU_GO: return JSIConverter<std::string>::toJSI(runtime, "pay-as-you-go");
61
+ case margelo::nitro::iap::PaymentModeIOS::PAY_UP_FRONT: return JSIConverter<std::string>::toJSI(runtime, "pay-up-front");
62
+ default: [[unlikely]]
63
+ throw std::invalid_argument("Cannot convert PaymentModeIOS to JS - invalid value: "
64
+ + std::to_string(static_cast<int>(arg)) + "!");
65
+ }
66
+ }
67
+ static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
68
+ if (!value.isString()) {
69
+ return false;
70
+ }
71
+ std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, value);
72
+ switch (hashString(unionValue.c_str(), unionValue.size())) {
73
+ case hashString("empty"):
74
+ case hashString("free-trial"):
75
+ case hashString("pay-as-you-go"):
76
+ case hashString("pay-up-front"):
77
+ return true;
78
+ default:
79
+ return false;
80
+ }
81
+ }
82
+ };
83
+
84
+ } // namespace margelo::nitro
@@ -17,6 +17,11 @@
17
17
  #else
18
18
  #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
19
19
  #endif
20
+ #if __has_include(<NitroModules/JSIHelpers.hpp>)
21
+ #include <NitroModules/JSIHelpers.hpp>
22
+ #else
23
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
24
+ #endif
20
25
 
21
26
  // Forward declaration of `IapPlatform` to properly resolve imports.
22
27
  namespace margelo::nitro::iap { enum class IapPlatform; }
@@ -120,6 +125,9 @@ namespace margelo::nitro {
120
125
  return false;
121
126
  }
122
127
  jsi::Object obj = value.getObject(runtime);
128
+ if (!nitro::isPlainObject(runtime, obj)) {
129
+ return false;
130
+ }
123
131
  if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, "autoRenewingAndroid"))) return false;
124
132
  if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "currentPlanId"))) return false;
125
133
  if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "dataAndroid"))) return false;
@@ -17,6 +17,11 @@
17
17
  #else
18
18
  #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
19
19
  #endif
20
+ #if __has_include(<NitroModules/JSIHelpers.hpp>)
21
+ #include <NitroModules/JSIHelpers.hpp>
22
+ #else
23
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
24
+ #endif
20
25
 
21
26
  // Forward declaration of `PurchaseOfferIOS` to properly resolve imports.
22
27
  namespace margelo::nitro::iap { struct PurchaseOfferIOS; }
@@ -168,6 +173,9 @@ namespace margelo::nitro {
168
173
  return false;
169
174
  }
170
175
  jsi::Object obj = value.getObject(runtime);
176
+ if (!nitro::isPlainObject(runtime, obj)) {
177
+ return false;
178
+ }
171
179
  if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "appAccountToken"))) return false;
172
180
  if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "appBundleIdIOS"))) return false;
173
181
  if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "countryCodeIOS"))) return false;
@@ -17,6 +17,11 @@
17
17
  #else
18
18
  #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
19
19
  #endif
20
+ #if __has_include(<NitroModules/JSIHelpers.hpp>)
21
+ #include <NitroModules/JSIHelpers.hpp>
22
+ #else
23
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
24
+ #endif
20
25
 
21
26
 
22
27
 
@@ -65,6 +70,9 @@ namespace margelo::nitro {
65
70
  return false;
66
71
  }
67
72
  jsi::Object obj = value.getObject(runtime);
73
+ if (!nitro::isPlainObject(runtime, obj)) {
74
+ return false;
75
+ }
68
76
  if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "id"))) return false;
69
77
  if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "paymentMode"))) return false;
70
78
  if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "type"))) return false;
@@ -17,6 +17,11 @@
17
17
  #else
18
18
  #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
19
19
  #endif
20
+ #if __has_include(<NitroModules/JSIHelpers.hpp>)
21
+ #include <NitroModules/JSIHelpers.hpp>
22
+ #else
23
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
24
+ #endif
20
25
 
21
26
 
22
27
 
@@ -90,6 +95,9 @@ namespace margelo::nitro {
90
95
  return false;
91
96
  }
92
97
  jsi::Object obj = value.getObject(runtime);
98
+ if (!nitro::isPlainObject(runtime, obj)) {
99
+ return false;
100
+ }
93
101
  if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "autoRenewPreference"))) return false;
94
102
  if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "expirationReason"))) return false;
95
103
  if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, "gracePeriodExpirationDate"))) return false;
@@ -17,6 +17,11 @@
17
17
  #else
18
18
  #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
19
19
  #endif
20
+ #if __has_include(<NitroModules/JSIHelpers.hpp>)
21
+ #include <NitroModules/JSIHelpers.hpp>
22
+ #else
23
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
24
+ #endif
20
25
 
21
26
 
22
27
 
@@ -63,6 +68,9 @@ namespace margelo::nitro {
63
68
  return false;
64
69
  }
65
70
  jsi::Object obj = value.getObject(runtime);
71
+ if (!nitro::isPlainObject(runtime, obj)) {
72
+ return false;
73
+ }
66
74
  if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "externalTransactionToken"))) return false;
67
75
  if (!JSIConverter<std::vector<std::string>>::canConvert(runtime, obj.getProperty(runtime, "products"))) return false;
68
76
  return true;
@@ -1,5 +1,5 @@
1
1
  {
2
- "apple": "1.2.27",
2
+ "apple": "1.2.29",
3
3
  "google": "1.3.2",
4
- "gql": "1.2.2"
4
+ "gql": "1.2.3"
5
5
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-iap",
3
- "version": "14.4.26",
3
+ "version": "14.4.28",
4
4
  "description": "React Native In-App Purchases module for iOS and Android using Nitro",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",
@@ -108,19 +108,19 @@
108
108
  "husky": "^8.0.3",
109
109
  "jest": "^30.1.1",
110
110
  "lint-staged": "^15.2.0",
111
- "nitrogen": "^0.29.6",
111
+ "nitrogen": "^0.31.1",
112
112
  "prettier": "^3.3.3",
113
113
  "react": "19.1.0",
114
114
  "react-native": "0.81.1",
115
115
  "react-native-builder-bob": "^0.38.4",
116
- "react-native-nitro-modules": "^0.29.6",
116
+ "react-native-nitro-modules": "^0.31.1",
117
117
  "react-test-renderer": "^19.1.1",
118
118
  "typescript": "^5.9.2"
119
119
  },
120
120
  "peerDependencies": {
121
121
  "react": "*",
122
122
  "react-native": "*",
123
- "react-native-nitro-modules": "^0.29.6"
123
+ "react-native-nitro-modules": "^0.31.1"
124
124
  },
125
125
  "workspaces": [
126
126
  "example"
package/src/index.ts CHANGED
@@ -827,6 +827,12 @@ export const getReceiptDataIOS: QueryField<'getReceiptDataIOS'> = async () => {
827
827
  throw new Error('getReceiptDataIOS is only available on iOS');
828
828
  }
829
829
 
830
+ RnIapConsole.warn(
831
+ '[getReceiptDataIOS] ⚠️ iOS receipts contain ALL transactions, not just the latest one. ' +
832
+ 'For individual purchase validation, use getTransactionJwsIOS(productId) instead. ' +
833
+ 'See: https://react-native-iap.hyo.dev/docs/guides/receipt-validation',
834
+ );
835
+
830
836
  try {
831
837
  return await IAP.instance.getReceiptDataIOS();
832
838
  } catch (error) {
@@ -841,6 +847,12 @@ export const getReceiptIOS = async (): Promise<string> => {
841
847
  throw new Error('getReceiptIOS is only available on iOS');
842
848
  }
843
849
 
850
+ RnIapConsole.warn(
851
+ '[getReceiptIOS] ⚠️ iOS receipts contain ALL transactions, not just the latest one. ' +
852
+ 'For individual purchase validation, use getTransactionJwsIOS(productId) instead. ' +
853
+ 'See: https://react-native-iap.hyo.dev/docs/guides/receipt-validation',
854
+ );
855
+
844
856
  try {
845
857
  if (typeof IAP.instance.getReceiptIOS === 'function') {
846
858
  return await IAP.instance.getReceiptIOS();
@@ -858,6 +870,12 @@ export const requestReceiptRefreshIOS = async (): Promise<string> => {
858
870
  throw new Error('requestReceiptRefreshIOS is only available on iOS');
859
871
  }
860
872
 
873
+ RnIapConsole.warn(
874
+ '[requestReceiptRefreshIOS] ⚠️ iOS receipts contain ALL transactions, not just the latest one. ' +
875
+ 'For individual purchase validation, use getTransactionJwsIOS(productId) instead. ' +
876
+ 'See: https://react-native-iap.hyo.dev/docs/guides/receipt-validation',
877
+ );
878
+
861
879
  try {
862
880
  if (typeof IAP.instance.requestReceiptRefreshIOS === 'function') {
863
881
  return await IAP.instance.requestReceiptRefreshIOS();
@@ -21,6 +21,7 @@ import type {
21
21
  RequestPurchaseResult,
22
22
  RequestSubscriptionAndroidProps,
23
23
  UserChoiceBillingDetails,
24
+ PaymentModeIOS,
24
25
  } from '../types';
25
26
 
26
27
  // ╔══════════════════════════════════════════════════════════════════════════╗
@@ -296,7 +297,7 @@ export interface NitroProduct {
296
297
  introductoryPriceIOS?: string | null;
297
298
  introductoryPriceAsAmountIOS?: number | null;
298
299
  introductoryPriceNumberOfPeriodsIOS?: number | null;
299
- introductoryPricePaymentModeIOS?: string | null;
300
+ introductoryPricePaymentModeIOS: PaymentModeIOS;
300
301
  introductoryPriceSubscriptionPeriodIOS?: string | null;
301
302
  subscriptionPeriodNumberIOS?: number | null;
302
303
  subscriptionPeriodUnitIOS?: string | null;
@@ -555,22 +556,49 @@ export interface RnIap extends HybridObject<{ios: 'swift'; android: 'kotlin'}> {
555
556
 
556
557
  /**
557
558
  * Get receipt data (iOS only)
558
- * @returns Promise<string> - Base64 encoded receipt data
559
+ *
560
+ * ⚠️ **IMPORTANT**: iOS receipts are cumulative and contain ALL transactions for the app,
561
+ * not just the most recent one. The receipt data does not change between purchases.
562
+ *
563
+ * **For individual purchase validation, use `getTransactionJwsIOS(productId)` instead.**
564
+ *
565
+ * This returns the App Store Receipt, which:
566
+ * - Contains all purchase history for the app
567
+ * - Does not update immediately after finishTransaction()
568
+ * - May be unavailable immediately after purchase (throws receipt-failed error)
569
+ * - Requires parsing to extract specific transactions
570
+ *
571
+ * @returns Promise<string> - Base64 encoded receipt data containing all app transactions
572
+ * @throws {Error} receipt-failed if receipt is not available (e.g., immediately after purchase)
559
573
  * @platform iOS
574
+ * @see getTransactionJwsIOS for validating individual transactions (recommended)
560
575
  */
561
576
  getReceiptDataIOS(): Promise<string>;
562
577
 
563
578
  /**
564
579
  * Alias for getReceiptDataIOS maintained for compatibility (iOS only)
565
- * @returns Promise<string> - Base64 encoded receipt data
580
+ *
581
+ * ⚠️ **IMPORTANT**: iOS receipts are cumulative and contain ALL transactions.
582
+ * For individual purchase validation, use `getTransactionJwsIOS(productId)` instead.
583
+ *
584
+ * @returns Promise<string> - Base64 encoded receipt data containing all app transactions
566
585
  * @platform iOS
586
+ * @see getReceiptDataIOS for full documentation
587
+ * @see getTransactionJwsIOS for validating individual transactions (recommended)
567
588
  */
568
589
  getReceiptIOS(): Promise<string>;
569
590
 
570
591
  /**
571
592
  * Request a refreshed receipt from the App Store (iOS only)
572
- * @returns Promise<string> - Updated Base64 encoded receipt data
593
+ *
594
+ * This calls syncIOS() to refresh the receipt from Apple's servers, then returns it.
595
+ *
596
+ * ⚠️ **IMPORTANT**: iOS receipts are cumulative and contain ALL transactions.
597
+ * For individual purchase validation, use `getTransactionJwsIOS(productId)` instead.
598
+ *
599
+ * @returns Promise<string> - Updated Base64 encoded receipt data containing all app transactions
573
600
  * @platform iOS
601
+ * @see getTransactionJwsIOS for validating individual transactions (recommended)
574
602
  */
575
603
  requestReceiptRefreshIOS(): Promise<string>;
576
604
 
@@ -583,10 +611,27 @@ export interface RnIap extends HybridObject<{ios: 'swift'; android: 'kotlin'}> {
583
611
  isTransactionVerifiedIOS(sku: string): Promise<boolean>;
584
612
 
585
613
  /**
586
- * Get transaction JWS representation (iOS only)
587
- * @param sku - The product SKU
588
- * @returns Promise<string | null> - JWS representation or null
614
+ * Get transaction JWS (JSON Web Signature) representation for a specific product (iOS only)
615
+ *
616
+ * **RECOMMENDED** for validating individual purchases with your backend.
617
+ *
618
+ * This returns a unique, cryptographically signed token for the specific transaction,
619
+ * unlike `getReceiptDataIOS()` which returns ALL transactions.
620
+ *
621
+ * Benefits:
622
+ * - Contains ONLY the requested transaction (not all historical purchases)
623
+ * - Cryptographically signed by Apple (can be verified)
624
+ * - Available immediately after purchase
625
+ * - Simpler to validate on your backend
626
+ *
627
+ * @param sku - The product SKU/ID to get the transaction JWS for
628
+ * @returns Promise<string | null> - JWS string for the transaction, or null if not found
589
629
  * @platform iOS
630
+ * @example
631
+ * ```typescript
632
+ * const jws = await getTransactionJwsIOS('com.example.product');
633
+ * // Send jws to your backend for validation
634
+ * ```
590
635
  */
591
636
  getTransactionJwsIOS(sku: string): Promise<string | null>;
592
637
 
package/src/types.ts CHANGED
@@ -399,7 +399,7 @@ export interface ProductSubscriptionIOS extends ProductCommon {
399
399
  introductoryPriceAsAmountIOS?: (string | null);
400
400
  introductoryPriceIOS?: (string | null);
401
401
  introductoryPriceNumberOfPeriodsIOS?: (string | null);
402
- introductoryPricePaymentModeIOS?: (PaymentModeIOS | null);
402
+ introductoryPricePaymentModeIOS: PaymentModeIOS;
403
403
  introductoryPriceSubscriptionPeriodIOS?: (SubscriptionPeriodIOS | null);
404
404
  isFamilyShareableIOS: boolean;
405
405
  jsonRepresentationIOS: string;
@@ -87,7 +87,7 @@ function normalizeProductTypeIOS(value?: Nullable<string>): ProductTypeIOS {
87
87
  }
88
88
  }
89
89
 
90
- function normalizePaymentMode(value?: Nullable<string>): PaymentModeIOS | null {
90
+ function normalizePaymentMode(value?: Nullable<string>): PaymentModeIOS {
91
91
  switch ((value ?? '').toUpperCase()) {
92
92
  case 'FREE_TRIAL':
93
93
  case 'FREETRIAL':
@@ -552,6 +552,7 @@ export function checkTypeSynchronization(): {
552
552
  displayPrice: '$1.00',
553
553
  currency: 'USD',
554
554
  price: 1,
555
+ introductoryPricePaymentModeIOS: PAYMENT_MODE_EMPTY,
555
556
  };
556
557
 
557
558
  const converted = convertNitroProductToProduct(testNitroProduct);