react-native-iap 15.4.0-rc.2 → 15.4.0

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 (165) hide show
  1. package/README.md +23 -25
  2. package/android/src/main/java/com/margelo/nitro/iap/HybridRnIap.kt +250 -168
  3. package/android/src/main/java/com/margelo/nitro/iap/ProductSerialization.kt +98 -0
  4. package/ios/HybridRnIap.swift +19 -1
  5. package/ios/RnIapHelper.swift +30 -2
  6. package/lib/module/hooks/useIAP.js +19 -3
  7. package/lib/module/hooks/useIAP.js.map +1 -1
  8. package/lib/module/index.js +104 -18
  9. package/lib/module/index.js.map +1 -1
  10. package/lib/module/index.kepler.js +3 -0
  11. package/lib/module/index.kepler.js.map +1 -1
  12. package/lib/module/types.js +67 -6
  13. package/lib/module/types.js.map +1 -1
  14. package/lib/module/utils/type-bridge.js +22 -3
  15. package/lib/module/utils/type-bridge.js.map +1 -1
  16. package/lib/module/vega-adapter.js +24 -2
  17. package/lib/module/vega-adapter.js.map +1 -1
  18. package/lib/typescript/src/hooks/useIAP.d.ts +25 -2
  19. package/lib/typescript/src/hooks/useIAP.d.ts.map +1 -1
  20. package/lib/typescript/src/index.d.ts +50 -10
  21. package/lib/typescript/src/index.d.ts.map +1 -1
  22. package/lib/typescript/src/index.kepler.d.ts +3 -0
  23. package/lib/typescript/src/index.kepler.d.ts.map +1 -1
  24. package/lib/typescript/src/specs/RnIap.nitro.d.ts +79 -9
  25. package/lib/typescript/src/specs/RnIap.nitro.d.ts.map +1 -1
  26. package/lib/typescript/src/types.d.ts +223 -35
  27. package/lib/typescript/src/types.d.ts.map +1 -1
  28. package/lib/typescript/src/utils/type-bridge.d.ts.map +1 -1
  29. package/lib/typescript/src/vega-adapter.d.ts.map +1 -1
  30. package/nitrogen/generated/android/NitroIap+autolinking.cmake +3 -0
  31. package/nitrogen/generated/android/c++/JBillingChoiceImageLayoutAndroid.hpp +61 -0
  32. package/nitrogen/generated/android/c++/JBillingChoiceScreenTypeAndroid.hpp +61 -0
  33. package/nitrogen/generated/android/c++/JBillingProgramAndroid.hpp +3 -0
  34. package/nitrogen/generated/android/c++/JDeveloperBillingLaunchModeAndroid.hpp +61 -0
  35. package/nitrogen/generated/android/c++/JDeveloperBillingOptionParamsAndroid.hpp +78 -0
  36. package/nitrogen/generated/android/c++/JDeveloperBillingTypeAndroid.hpp +61 -0
  37. package/nitrogen/generated/android/c++/JDeveloperProvidedBillingDetailsAndroid.hpp +45 -5
  38. package/nitrogen/generated/android/c++/JDeveloperProvidedBillingProductAndroid.hpp +72 -0
  39. package/nitrogen/generated/android/c++/JFunc_void_DeveloperProvidedBillingDetailsAndroid.hpp +10 -0
  40. package/nitrogen/generated/android/c++/JHybridRnIapSpec.cpp +118 -3
  41. package/nitrogen/generated/android/c++/JHybridRnIapSpec.hpp +4 -1
  42. package/nitrogen/generated/android/c++/JInAppMessageCategoryAndroid.hpp +58 -0
  43. package/nitrogen/generated/android/c++/JInAppMessageResponseCodeAndroid.hpp +58 -0
  44. package/nitrogen/generated/android/c++/JInitConnectionConfig.hpp +7 -1
  45. package/nitrogen/generated/android/c++/JNitroBillingChoiceInfoAndroid.hpp +66 -0
  46. package/nitrogen/generated/android/c++/JNitroBillingProgramAvailabilityResultAndroid.hpp +18 -3
  47. package/nitrogen/generated/android/c++/JNitroBillingProgramInformationDialogParamsAndroid.hpp +63 -0
  48. package/nitrogen/generated/android/c++/JNitroBillingResultAndroid.hpp +72 -0
  49. package/nitrogen/generated/android/c++/JNitroGetBillingChoiceInfoParamsAndroid.hpp +74 -0
  50. package/nitrogen/generated/android/c++/JNitroInAppMessageParamsAndroid.hpp +64 -0
  51. package/nitrogen/generated/android/c++/JNitroInAppMessageResultAndroid.hpp +68 -0
  52. package/nitrogen/generated/android/c++/JNitroLaunchExternalLinkParamsAndroid.hpp +10 -1
  53. package/nitrogen/generated/android/c++/JNitroOneTimePurchaseOfferDetail.hpp +5 -1
  54. package/nitrogen/generated/android/c++/JNitroProduct.hpp +13 -1
  55. package/nitrogen/generated/android/c++/JNitroPurchaseRequest.hpp +7 -0
  56. package/nitrogen/generated/android/c++/JNitroRequestPurchaseAndroid.hpp +16 -1
  57. package/nitrogen/generated/android/c++/JProductType.hpp +58 -0
  58. package/nitrogen/generated/android/c++/JSubResponseCodeAndroid.hpp +61 -0
  59. package/nitrogen/generated/android/c++/JVariant_NullType_Array_InAppMessageCategoryAndroid_.cpp +35 -0
  60. package/nitrogen/generated/android/c++/JVariant_NullType_Array_InAppMessageCategoryAndroid_.hpp +81 -0
  61. package/nitrogen/generated/android/c++/JVariant_NullType_DeveloperBillingOptionParamsAndroid.cpp +26 -0
  62. package/nitrogen/generated/android/c++/JVariant_NullType_DeveloperBillingOptionParamsAndroid.hpp +78 -0
  63. package/nitrogen/generated/android/c++/JVariant_NullType_InitConnectionConfig.hpp +2 -0
  64. package/nitrogen/generated/android/c++/JVariant_NullType_NitroInAppMessageParamsAndroid.cpp +26 -0
  65. package/nitrogen/generated/android/c++/JVariant_NullType_NitroInAppMessageParamsAndroid.hpp +76 -0
  66. package/nitrogen/generated/android/c++/JVariant_NullType_NitroRequestPurchaseAndroid.hpp +7 -0
  67. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/BillingChoiceImageLayoutAndroid.kt +24 -0
  68. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/BillingChoiceScreenTypeAndroid.kt +24 -0
  69. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/BillingProgramAndroid.kt +2 -1
  70. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/DeveloperBillingLaunchModeAndroid.kt +24 -0
  71. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/DeveloperBillingOptionParamsAndroid.kt +47 -0
  72. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/DeveloperBillingTypeAndroid.kt +24 -0
  73. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/DeveloperProvidedBillingDetailsAndroid.kt +13 -4
  74. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/DeveloperProvidedBillingProductAndroid.kt +44 -0
  75. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/HybridRnIapSpec.kt +13 -1
  76. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/InAppMessageCategoryAndroid.kt +23 -0
  77. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/InAppMessageResponseCodeAndroid.kt +23 -0
  78. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/InitConnectionConfig.kt +5 -2
  79. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroBillingChoiceInfoAndroid.kt +41 -0
  80. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroBillingProgramAvailabilityResultAndroid.kt +10 -4
  81. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroBillingProgramInformationDialogParamsAndroid.kt +41 -0
  82. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroBillingResultAndroid.kt +44 -0
  83. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroGetBillingChoiceInfoParamsAndroid.kt +44 -0
  84. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroInAppMessageParamsAndroid.kt +38 -0
  85. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroInAppMessageResultAndroid.kt +41 -0
  86. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroLaunchExternalLinkParamsAndroid.kt +6 -3
  87. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroOneTimePurchaseOfferDetail.kt +5 -2
  88. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroProduct.kt +11 -2
  89. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroRequestPurchaseAndroid.kt +8 -2
  90. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/ProductType.kt +23 -0
  91. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/SubResponseCodeAndroid.kt +24 -0
  92. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/Variant_NullType_Array_InAppMessageCategoryAndroid_.kt +53 -0
  93. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/Variant_NullType_DeveloperBillingOptionParamsAndroid.kt +53 -0
  94. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/Variant_NullType_NitroInAppMessageParamsAndroid.kt +53 -0
  95. package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Bridge.cpp +24 -0
  96. package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Bridge.hpp +382 -0
  97. package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Umbrella.hpp +48 -0
  98. package/nitrogen/generated/ios/c++/HybridRnIapSpecSwift.hpp +74 -2
  99. package/nitrogen/generated/ios/swift/BillingChoiceImageLayoutAndroid.swift +44 -0
  100. package/nitrogen/generated/ios/swift/BillingChoiceScreenTypeAndroid.swift +44 -0
  101. package/nitrogen/generated/ios/swift/BillingProgramAndroid.swift +4 -0
  102. package/nitrogen/generated/ios/swift/DeveloperBillingLaunchModeAndroid.swift +44 -0
  103. package/nitrogen/generated/ios/swift/DeveloperBillingOptionParamsAndroid.swift +114 -0
  104. package/nitrogen/generated/ios/swift/DeveloperBillingTypeAndroid.swift +44 -0
  105. package/nitrogen/generated/ios/swift/DeveloperProvidedBillingDetailsAndroid.swift +121 -4
  106. package/nitrogen/generated/ios/swift/DeveloperProvidedBillingProductAndroid.swift +71 -0
  107. package/nitrogen/generated/ios/swift/Func_void_NitroBillingChoiceInfoAndroid.swift +46 -0
  108. package/nitrogen/generated/ios/swift/Func_void_NitroBillingResultAndroid.swift +46 -0
  109. package/nitrogen/generated/ios/swift/Func_void_NitroInAppMessageResultAndroid.swift +46 -0
  110. package/nitrogen/generated/ios/swift/HybridRnIapSpec.swift +4 -1
  111. package/nitrogen/generated/ios/swift/HybridRnIapSpec_cxx.swift +78 -2
  112. package/nitrogen/generated/ios/swift/InAppMessageCategoryAndroid.swift +40 -0
  113. package/nitrogen/generated/ios/swift/InAppMessageResponseCodeAndroid.swift +40 -0
  114. package/nitrogen/generated/ios/swift/InitConnectionConfig.swift +12 -1
  115. package/nitrogen/generated/ios/swift/NitroBillingChoiceInfoAndroid.swift +66 -0
  116. package/nitrogen/generated/ios/swift/NitroBillingProgramAvailabilityResultAndroid.swift +50 -2
  117. package/nitrogen/generated/ios/swift/NitroBillingProgramInformationDialogParamsAndroid.swift +34 -0
  118. package/nitrogen/generated/ios/swift/NitroBillingResultAndroid.swift +77 -0
  119. package/nitrogen/generated/ios/swift/NitroGetBillingChoiceInfoParamsAndroid.swift +71 -0
  120. package/nitrogen/generated/ios/swift/NitroInAppMessageParamsAndroid.swift +67 -0
  121. package/nitrogen/generated/ios/swift/NitroInAppMessageResultAndroid.swift +66 -0
  122. package/nitrogen/generated/ios/swift/NitroLaunchExternalLinkParamsAndroid.swift +39 -2
  123. package/nitrogen/generated/ios/swift/NitroOneTimePurchaseOfferDetail.swift +39 -2
  124. package/nitrogen/generated/ios/swift/NitroProduct.swift +113 -2
  125. package/nitrogen/generated/ios/swift/NitroRequestPurchaseAndroid.swift +75 -1
  126. package/nitrogen/generated/ios/swift/ProductType.swift +40 -0
  127. package/nitrogen/generated/ios/swift/SubResponseCodeAndroid.swift +44 -0
  128. package/nitrogen/generated/ios/swift/Variant_NullType_DeveloperBillingOptionParamsAndroid.swift +18 -0
  129. package/nitrogen/generated/ios/swift/Variant_NullType_NitroInAppMessageParamsAndroid.swift +18 -0
  130. package/nitrogen/generated/ios/swift/Variant_NullType__InAppMessageCategoryAndroid_.swift +18 -0
  131. package/nitrogen/generated/shared/c++/BillingChoiceImageLayoutAndroid.hpp +80 -0
  132. package/nitrogen/generated/shared/c++/BillingChoiceScreenTypeAndroid.hpp +80 -0
  133. package/nitrogen/generated/shared/c++/BillingProgramAndroid.hpp +4 -0
  134. package/nitrogen/generated/shared/c++/DeveloperBillingLaunchModeAndroid.hpp +80 -0
  135. package/nitrogen/generated/shared/c++/DeveloperBillingOptionParamsAndroid.hpp +103 -0
  136. package/nitrogen/generated/shared/c++/DeveloperBillingTypeAndroid.hpp +80 -0
  137. package/nitrogen/generated/shared/c++/DeveloperProvidedBillingDetailsAndroid.hpp +24 -6
  138. package/nitrogen/generated/shared/c++/DeveloperProvidedBillingProductAndroid.hpp +96 -0
  139. package/nitrogen/generated/shared/c++/HybridRnIapSpec.cpp +3 -0
  140. package/nitrogen/generated/shared/c++/HybridRnIapSpec.hpp +25 -1
  141. package/nitrogen/generated/shared/c++/InAppMessageCategoryAndroid.hpp +76 -0
  142. package/nitrogen/generated/shared/c++/InAppMessageResponseCodeAndroid.hpp +76 -0
  143. package/nitrogen/generated/shared/c++/InitConnectionConfig.hpp +8 -1
  144. package/nitrogen/generated/shared/c++/NitroBillingChoiceInfoAndroid.hpp +90 -0
  145. package/nitrogen/generated/shared/c++/NitroBillingProgramAvailabilityResultAndroid.hpp +16 -2
  146. package/nitrogen/generated/shared/c++/NitroBillingProgramInformationDialogParamsAndroid.hpp +89 -0
  147. package/nitrogen/generated/shared/c++/NitroBillingResultAndroid.hpp +96 -0
  148. package/nitrogen/generated/shared/c++/NitroGetBillingChoiceInfoParamsAndroid.hpp +99 -0
  149. package/nitrogen/generated/shared/c++/NitroInAppMessageParamsAndroid.hpp +88 -0
  150. package/nitrogen/generated/shared/c++/NitroInAppMessageResultAndroid.hpp +92 -0
  151. package/nitrogen/generated/shared/c++/NitroLaunchExternalLinkParamsAndroid.hpp +9 -2
  152. package/nitrogen/generated/shared/c++/NitroOneTimePurchaseOfferDetail.hpp +5 -1
  153. package/nitrogen/generated/shared/c++/NitroProduct.hpp +13 -1
  154. package/nitrogen/generated/shared/c++/NitroRequestPurchaseAndroid.hpp +12 -1
  155. package/nitrogen/generated/shared/c++/ProductType.hpp +76 -0
  156. package/nitrogen/generated/shared/c++/SubResponseCodeAndroid.hpp +80 -0
  157. package/openiap-versions.json +3 -3
  158. package/package.json +1 -1
  159. package/src/hooks/useIAP.ts +63 -0
  160. package/src/index.kepler.ts +9 -0
  161. package/src/index.ts +223 -95
  162. package/src/specs/RnIap.nitro.ts +116 -8
  163. package/src/types.ts +238 -35
  164. package/src/utils/type-bridge.ts +26 -2
  165. package/src/vega-adapter.ts +46 -11
package/src/types.ts CHANGED
@@ -26,6 +26,7 @@ export interface ActiveSubscription {
26
26
  * pending upgrades/downgrades, and auto-renewal preferences.
27
27
  */
28
28
  renewalInfoIOS?: (RenewalInfoIOS | null);
29
+ /** Unix timestamp in milliseconds since January 1, 1970 UTC. */
29
30
  transactionDate: number;
30
31
  transactionId: string;
31
32
  /**
@@ -118,10 +119,35 @@ export interface AppTransaction {
118
119
  }
119
120
 
120
121
  /**
121
- * Billing program types for external content links, external offers, and external payments (Android)
122
- * Available in Google Play Billing Library 8.2.0+, EXTERNAL_PAYMENTS added in 8.3.0
122
+ * Play Billing choice image layout (Android)
123
+ * Available in OpenIAP Spec 2.1.0 / openiap-google 2.3.0 (requires Play Billing 9.1.0+).
123
124
  */
124
- export type BillingProgramAndroid = 'unspecified' | 'user-choice-billing' | 'external-content-link' | 'external-offer' | 'external-payments';
125
+ export type BillingChoiceImageLayoutAndroid = 'rectangular-four-by-one' | 'rectangular-three-by-one' | 'rectangular-two-by-two';
126
+
127
+ /**
128
+ * Display information for developer-rendered Billing Choice screens (Android)
129
+ * Available in OpenIAP Spec 2.1.0 / openiap-google 2.3.0 (requires Play Billing 9.1.0+).
130
+ */
131
+ export interface BillingChoiceInfoAndroid {
132
+ /** URL for the Play Billing choice image matching the requested layout. */
133
+ playBillingChoiceImageUrl: string;
134
+ /** Play Loyalty information for the user. */
135
+ playBillingLoyaltyInfo?: (string | null);
136
+ }
137
+
138
+ /**
139
+ * Choice screen renderer for Billing Choice availability (Android)
140
+ * Available in OpenIAP Spec 2.1.0 / openiap-google 2.3.0 (requires Play Billing 9.1.0+).
141
+ */
142
+ export type BillingChoiceScreenTypeAndroid = 'unspecified' | 'developer-rendered' | 'google-rendered';
143
+
144
+ /**
145
+ * Billing program types for Google Play Billing Programs (Android)
146
+ * Available in Google Play Billing Library 8.2.0+, EXTERNAL_PAYMENTS added in 8.3.0,
147
+ * BILLING_CHOICE added in OpenIAP Spec 2.1.0 / openiap-google 2.3.0
148
+ * (requires Play Billing 9.1.0+).
149
+ */
150
+ export type BillingProgramAndroid = 'unspecified' | 'user-choice-billing' | 'external-content-link' | 'external-offer' | 'external-payments' | 'billing-choice';
125
151
 
126
152
  /**
127
153
  * Result of checking billing program availability (Android)
@@ -130,8 +156,30 @@ export type BillingProgramAndroid = 'unspecified' | 'user-choice-billing' | 'ext
130
156
  export interface BillingProgramAvailabilityResultAndroid {
131
157
  /** The billing program that was checked */
132
158
  billingProgram: BillingProgramAndroid;
159
+ /**
160
+ * Billing Choice screen renderer. Populated only for available BILLING_CHOICE results.
161
+ * Available in OpenIAP Spec 2.1.0 / openiap-google 2.3.0.
162
+ */
163
+ choiceScreenType?: (BillingChoiceScreenTypeAndroid | null);
133
164
  /** Whether the billing program is available for the user */
134
165
  isAvailable: boolean;
166
+ /**
167
+ * Whether external-link payment is available for Billing Choice.
168
+ * Populated only for available BILLING_CHOICE results.
169
+ * Available in OpenIAP Spec 2.1.0 / openiap-google 2.3.0.
170
+ */
171
+ isExternalLinkAvailable?: (boolean | null);
172
+ }
173
+
174
+ /**
175
+ * Parameters for showing a billing program information dialog (Android)
176
+ * Available in OpenIAP Spec 2.1.0 / openiap-google 2.3.0 (requires Play Billing 9.1.0+).
177
+ */
178
+ export interface BillingProgramInformationDialogParamsAndroid {
179
+ /** Billing program. Currently only BILLING_CHOICE is supported. */
180
+ billingProgram?: BillingProgramAndroid;
181
+ /** External transaction token returned by the Billing Choice reporting-details flow. */
182
+ externalTransactionToken: string;
135
183
  }
136
184
 
137
185
  /**
@@ -180,19 +228,38 @@ export interface DeepLinkOptions {
180
228
  export type DeveloperBillingLaunchModeAndroid = 'unspecified' | 'launch-in-external-browser-or-app' | 'caller-will-launch-link';
181
229
 
182
230
  /**
183
- * Parameters for developer billing option in purchase flow (Android)
184
- * Used with BillingFlowParams to enable external payments flow
185
- * Available in Google Play Billing Library 8.3.0+
231
+ * Parameters for a developer billing option in a purchase flow (Android).
232
+ * Used with BillingFlowParams for external payments (8.3.0+) and Billing Choice
233
+ * (OpenIAP Spec 2.1.0 / openiap-google 2.3.0; requires Play Billing 9.1.0+).
234
+ * Only billingProgram is required; link fields are used when the selected program
235
+ * links outside the app.
186
236
  */
187
237
  export interface DeveloperBillingOptionParamsAndroid {
188
- /** The billing program (should be EXTERNAL_PAYMENTS for external payments flow) */
238
+ /** The billing program. Use EXTERNAL_PAYMENTS or BILLING_CHOICE. */
189
239
  billingProgram: BillingProgramAndroid;
190
- /** The launch mode for the external payment link */
191
- launchMode: DeveloperBillingLaunchModeAndroid;
192
- /** The URI where the external payment will be processed */
193
- linkUri: string;
240
+ /**
241
+ * A pre-generated external transaction token for a Billing Choice external-link
242
+ * flow. Omit it when Google Play should provide the token in the callback.
243
+ */
244
+ externalTransactionToken?: (string | null);
245
+ /**
246
+ * The launch mode for the external payment link.
247
+ * Required only when the selected billing program links outside the app.
248
+ */
249
+ launchMode?: (DeveloperBillingLaunchModeAndroid | null);
250
+ /**
251
+ * The URI where the external payment will be processed.
252
+ * Required only when the selected billing program links outside the app.
253
+ */
254
+ linkUri?: (string | null);
194
255
  }
195
256
 
257
+ /**
258
+ * Developer-provided billing destination type for Billing Program reporting details (Android)
259
+ * Available in OpenIAP Spec 2.1.0 / openiap-google 2.3.0 (requires Play Billing 9.1.0+).
260
+ */
261
+ export type DeveloperBillingTypeAndroid = 'developer-billing-type-unspecified' | 'in-app' | 'external-link';
262
+
196
263
  /**
197
264
  * Details provided when user selects developer billing option (Android)
198
265
  * Received via DeveloperProvidedBillingListener callback
@@ -201,10 +268,31 @@ export interface DeveloperBillingOptionParamsAndroid {
201
268
  export interface DeveloperProvidedBillingDetailsAndroid {
202
269
  /**
203
270
  * External transaction token used to report transactions made through developer billing.
204
- * This token must be used when reporting the external transaction to Google Play.
205
- * Must be reported within 24 hours of the transaction.
271
+ * Nullable for flows such as external payments where no token is returned.
206
272
  */
207
- externalTransactionToken: string;
273
+ externalTransactionToken?: (string | null);
274
+ /**
275
+ * URI to launch for an external-link Billing Choice flow, when provided by
276
+ * Google Play.
277
+ */
278
+ linkUri?: (string | null);
279
+ /**
280
+ * Original external transaction ID when replacing a subscription that was
281
+ * purchased through developer billing.
282
+ */
283
+ originalExternalTransactionId?: (string | null);
284
+ /** Products selected for the developer billing flow. */
285
+ products: DeveloperProvidedBillingProductAndroid[];
286
+ }
287
+
288
+ /** Product selected for developer-provided billing (Android 9.0+). */
289
+ export interface DeveloperProvidedBillingProductAndroid {
290
+ /** Product identifier. */
291
+ id: string;
292
+ /** Subscription offer token, when applicable. */
293
+ offerToken?: (string | null);
294
+ /** Google Play product type (in-app or subscription). */
295
+ type: ProductType;
208
296
  }
209
297
 
210
298
  /**
@@ -507,6 +595,19 @@ export interface ExternalPurchaseNoticeResultIOS {
507
595
 
508
596
  export type FetchProductsResult = ProductOrSubscription[] | Product[] | ProductSubscription[] | null;
509
597
 
598
+ /**
599
+ * Parameters for fetching Billing Choice display information (Android)
600
+ * Available in OpenIAP Spec 2.1.0 / openiap-google 2.3.0 (requires Play Billing 9.1.0+).
601
+ */
602
+ export interface GetBillingChoiceInfoParamsAndroid {
603
+ /** Billing program. Currently only BILLING_CHOICE is supported. */
604
+ billingProgram?: BillingProgramAndroid;
605
+ /** Desired Play Billing choice image layout. */
606
+ playBillingChoiceImageLayout?: BillingChoiceImageLayoutAndroid;
607
+ /** BCP 47 locale tag. If omitted, Play Billing uses the user's default locale. */
608
+ userLocale?: (string | null);
609
+ }
610
+
510
611
  export type IapEvent = 'purchase-updated' | 'purchase-error' | 'promoted-product-ios' | 'user-choice-billing-android' | 'developer-provided-billing-android' | 'subscription-billing-issue';
511
612
 
512
613
  export type IapPlatform = 'ios' | 'android';
@@ -516,6 +617,42 @@ export type IapStore = 'unknown' | 'apple' | 'google' | 'horizon' | 'amazon';
516
617
  /** Unified purchase states from IAPKit verification response. */
517
618
  export type IapkitPurchaseState = 'entitled' | 'pending-acknowledgment' | 'pending' | 'canceled' | 'expired' | 'ready-to-consume' | 'consumed' | 'unknown' | 'inauthentic';
518
619
 
620
+ /**
621
+ * High-level in-app message category (Android)
622
+ * Available in OpenIAP Spec 2.1.0 / openiap-google 2.3.0
623
+ * (upstream API available since Play Billing 4.1.0).
624
+ */
625
+ export type InAppMessageCategoryAndroid = 'unknown-in-app-message-category-id' | 'transactional';
626
+
627
+ /**
628
+ * Parameters for showing Play billing in-app messages (Android)
629
+ * Available in OpenIAP Spec 2.1.0 / openiap-google 2.3.0
630
+ * (upstream API available since Play Billing 4.1.0).
631
+ */
632
+ export interface InAppMessageParamsAndroid {
633
+ /** In-app message categories to show. Defaults to transactional messages. */
634
+ categories?: (InAppMessageCategoryAndroid[] | null);
635
+ }
636
+
637
+ /**
638
+ * Response code from Play billing in-app messages (Android)
639
+ * Available in OpenIAP Spec 2.1.0 / openiap-google 2.3.0
640
+ * (upstream API available since Play Billing 4.1.0).
641
+ */
642
+ export type InAppMessageResponseCodeAndroid = 'no-action-needed' | 'subscription-status-updated';
643
+
644
+ /**
645
+ * Result from showing Play billing in-app messages (Android)
646
+ * Available in OpenIAP Spec 2.1.0 / openiap-google 2.3.0
647
+ * (upstream API available since Play Billing 4.1.0).
648
+ */
649
+ export interface InAppMessageResultAndroid {
650
+ /** Purchase token returned when a subscription status changed. */
651
+ purchaseToken?: (string | null);
652
+ /** Response code for the in-app messaging flow. */
653
+ responseCode: InAppMessageResponseCodeAndroid;
654
+ }
655
+
519
656
  /** Connection initialization configuration */
520
657
  export interface InitConnectionConfig {
521
658
  /**
@@ -525,6 +662,16 @@ export interface InitConnectionConfig {
525
662
  * Use USER_CHOICE_BILLING for user choice billing, EXTERNAL_OFFER for alternative only.
526
663
  */
527
664
  alternativeBillingModeAndroid?: (AlternativeBillingModeAndroid | null);
665
+ /**
666
+ * Billing Choice renderer configured in Play Console. Available in OpenIAP
667
+ * Spec 2.1.0 / openiap-google 2.3.0 (requires Play Billing 9.1.0+).
668
+ * GOOGLE_RENDERED registers the developer-provided billing listener so OpenIAP
669
+ * can emit the selection event. DEVELOPER_RENDERED omits that listener so the
670
+ * app can render its own choice screen and use the reporting/dialog/link APIs.
671
+ * Must match choiceScreenType returned by isBillingProgramAvailableAndroid.
672
+ * Defaults to GOOGLE_RENDERED.
673
+ */
674
+ billingChoiceScreenTypeAndroid?: (BillingChoiceScreenTypeAndroid | null);
528
675
  /**
529
676
  * Enable a specific billing program for Android (7.0+)
530
677
  * When set, enables the specified billing program for external transactions.
@@ -532,6 +679,8 @@ export interface InitConnectionConfig {
532
679
  * - EXTERNAL_CONTENT_LINK: Link to external content (8.2.0+)
533
680
  * - EXTERNAL_OFFER: External offers for digital content (8.2.0+)
534
681
  * - EXTERNAL_PAYMENTS: Developer provided billing, Japan only (8.3.0+)
682
+ * - BILLING_CHOICE: Google-rendered or developer-rendered billing choice
683
+ * (OpenIAP Spec 2.1.0 / openiap-google 2.3.0; requires Play Billing 9.1.0+)
535
684
  */
536
685
  enableBillingProgramAndroid?: (BillingProgramAndroid | null);
537
686
  }
@@ -559,12 +708,19 @@ export interface InstallmentPlanDetailsAndroid {
559
708
 
560
709
  /**
561
710
  * Parameters for launching an external link (Android)
562
- * Used with launchExternalLink to initiate external offer or app install flows
711
+ * Used with launchExternalLink to initiate external offer, app install, or
712
+ * developer-rendered Billing Choice flows
563
713
  * Available in Google Play Billing Library 8.2.0+
564
714
  */
565
715
  export interface LaunchExternalLinkParamsAndroid {
566
- /** The billing program (EXTERNAL_CONTENT_LINK or EXTERNAL_OFFER) */
716
+ /** The billing program (EXTERNAL_CONTENT_LINK, EXTERNAL_OFFER, or BILLING_CHOICE) */
567
717
  billingProgram: BillingProgramAndroid;
718
+ /**
719
+ * External transaction token for a developer-rendered Billing Choice external-link
720
+ * flow. Available in OpenIAP Spec 2.1.0 / openiap-google 2.3.0
721
+ * (requires Play Billing 9.1.0+). Generate it with createBillingProgramReportingDetailsAndroid.
722
+ */
723
+ externalTransactionToken?: (string | null);
568
724
  /** The external link launch mode */
569
725
  launchMode: ExternalLinkLaunchModeAndroid;
570
726
  /** The type of the external link */
@@ -597,7 +753,6 @@ export interface Mutation {
597
753
  beginRefundRequestIOS?: Promise<(string | null)>;
598
754
  /**
599
755
  * Check whether alternative billing is available for the user. Step 1 of the alternative billing flow.
600
- *
601
756
  * Returns true if available, false otherwise.
602
757
  * Throws OpenIapError.NotPrepared if billing client not ready.
603
758
  * See: https://openiap.dev/docs/apis/android/check-alternative-billing-availability-android
@@ -617,7 +772,6 @@ export interface Mutation {
617
772
  * Create a reporting token for an alternative billing flow. Step 3 of the alternative billing flow.
618
773
  * Must be called AFTER successful payment in your payment system.
619
774
  * Token must be reported to Google Play backend within 24 hours.
620
- *
621
775
  * Returns token string, or null if creation failed.
622
776
  * Throws OpenIapError.NotPrepared if billing client not ready.
623
777
  * See: https://openiap.dev/docs/apis/android/create-alternative-billing-token-android
@@ -626,8 +780,11 @@ export interface Mutation {
626
780
  /**
627
781
  * Create the reporting payload Google requires after a Developer-Provided Billing transaction (Play Billing 8.3.0+).
628
782
  * Replaces the deprecated createExternalOfferReportingDetailsAsync API.
629
- *
630
783
  * Returns external transaction token needed for reporting external transactions.
784
+ * developerBillingType is optional. When program is BILLING_CHOICE and developerBillingType is omitted,
785
+ * native Android defaults it to IN_APP.
786
+ * The Billing Choice extension is available in OpenIAP Spec 2.1.0 /
787
+ * openiap-google 2.3.0 (requires Play Billing 9.1.0+).
631
788
  * Throws OpenIapError.NotPrepared if billing client not ready.
632
789
  * See: https://openiap.dev/docs/apis/android/create-billing-program-reporting-details-android
633
790
  */
@@ -655,7 +812,6 @@ export interface Mutation {
655
812
  /**
656
813
  * Check whether a billing program (e.g., External Payments) is available for the current user.
657
814
  * Replaces the deprecated isExternalOfferAvailableAsync API.
658
- *
659
815
  * Available in Google Play Billing Library 8.2.0+.
660
816
  * Returns availability result with isAvailable flag.
661
817
  * Throws OpenIapError.NotPrepared if billing client not ready.
@@ -663,9 +819,11 @@ export interface Mutation {
663
819
  */
664
820
  isBillingProgramAvailableAndroid: Promise<BillingProgramAvailabilityResultAndroid>;
665
821
  /**
666
- * Launch an external content/offer link from inside the Billing Programs flow (Play Billing 8.2.0+).
822
+ * Launch an external content/offer link from inside the Billing Programs flow (Play Billing 8.2.0+),
823
+ * including developer-rendered Billing Choice external-link flows.
824
+ * Billing Choice availability: OpenIAP Spec 2.1.0 / openiap-google 2.3.0
825
+ * (requires Play Billing 9.1.0+).
667
826
  * Replaces the deprecated showExternalOfferInformationDialog API.
668
- *
669
827
  * Shows Play Store dialog and optionally launches external URL.
670
828
  * Throws OpenIapError.NotPrepared if billing client not ready.
671
829
  * See: https://openiap.dev/docs/apis/android/launch-external-link-android
@@ -711,12 +869,19 @@ export interface Mutation {
711
869
  /**
712
870
  * Display Google's alternative billing information dialog. Step 2 of the alternative billing flow.
713
871
  * Must be called BEFORE processing payment in your payment system.
714
- *
715
872
  * Returns true if user accepted, false if user canceled.
716
873
  * Throws OpenIapError.NotPrepared if billing client not ready.
717
874
  * See: https://openiap.dev/docs/apis/android/show-alternative-billing-dialog-android
718
875
  */
719
876
  showAlternativeBillingDialogAndroid: Promise<boolean>;
877
+ /**
878
+ * Show Google's mandatory information dialog before a developer-rendered,
879
+ * in-app Billing Choice screen.
880
+ * OpenIAP availability: Spec 2.1.0 / openiap-google 2.3.0 (requires Play Billing 9.1.0+).
881
+ * Throws OpenIapError.NotPrepared if billing client not ready.
882
+ * See: https://openiap.dev/docs/apis/android/show-billing-program-information-dialog-android
883
+ */
884
+ showBillingProgramInformationDialogAndroid: Promise<BillingResultAndroid>;
720
885
  /**
721
886
  * Present the disclosure sheet required before linking out via ExternalPurchaseCustomLink (iOS 18.1+).
722
887
  * Call this after a deliberate customer interaction before linking out to external purchases.
@@ -724,6 +889,15 @@ export interface Mutation {
724
889
  * See: https://openiap.dev/docs/apis/ios/show-external-purchase-custom-link-notice-ios
725
890
  */
726
891
  showExternalPurchaseCustomLinkNoticeIOS: Promise<ExternalPurchaseCustomLinkNoticeResultIOS>;
892
+ /**
893
+ * Overlay Play billing in-app messages, such as payment issues or subscription price-change confirmations.
894
+ * OpenIAP availability: Spec 2.1.0 / openiap-google 2.3.0
895
+ * (upstream API available since Play Billing 4.1.0).
896
+ * Returns a response code and, when the subscription status changes, the related purchase token.
897
+ * Throws OpenIapError.NotPrepared if billing client not ready.
898
+ * See: https://openiap.dev/docs/apis/android/show-in-app-messages-android
899
+ */
900
+ showInAppMessagesAndroid: Promise<InAppMessageResultAndroid>;
727
901
  /**
728
902
  * Present the manage-subscriptions sheet and return changed purchases (iOS 15+).
729
903
  * See: https://openiap.dev/docs/apis/ios/show-manage-subscriptions-ios
@@ -766,7 +940,11 @@ export type MutationBeginRefundRequestIosArgs = string;
766
940
 
767
941
  export type MutationConsumePurchaseAndroidArgs = string;
768
942
 
769
- export type MutationCreateBillingProgramReportingDetailsAndroidArgs = BillingProgramAndroid;
943
+ export interface MutationCreateBillingProgramReportingDetailsAndroidArgs {
944
+ developerBillingType?: (DeveloperBillingTypeAndroid | null);
945
+ program: BillingProgramAndroid;
946
+ }
947
+
770
948
 
771
949
  export type MutationDeepLinkToSubscriptionsArgs = (DeepLinkOptions | null) | undefined;
772
950
 
@@ -801,8 +979,12 @@ export type MutationRequestPurchaseArgs =
801
979
  };
802
980
 
803
981
 
982
+ export type MutationShowBillingProgramInformationDialogAndroidArgs = BillingProgramInformationDialogParamsAndroid;
983
+
804
984
  export type MutationShowExternalPurchaseCustomLinkNoticeIosArgs = ExternalPurchaseCustomLinkNoticeTypeIOS;
805
985
 
986
+ export type MutationShowInAppMessagesAndroidArgs = (InAppMessageParamsAndroid | null) | undefined;
987
+
806
988
  export type MutationValidateReceiptArgs = VerifyPurchaseProps;
807
989
 
808
990
  export type MutationVerifyPurchaseArgs = VerifyPurchaseProps;
@@ -1197,6 +1379,7 @@ export interface PurchaseAndroid extends PurchaseCommon {
1197
1379
  signatureAndroid?: (string | null);
1198
1380
  /** Store where purchase was made */
1199
1381
  store: IapStore;
1382
+ /** Unix timestamp in milliseconds since January 1, 1970 UTC. */
1200
1383
  transactionDate: number;
1201
1384
  transactionId?: (string | null);
1202
1385
  }
@@ -1221,6 +1404,7 @@ export interface PurchaseCommon {
1221
1404
  quantity: number;
1222
1405
  /** Store where purchase was made */
1223
1406
  store: IapStore;
1407
+ /** Unix timestamp in milliseconds since January 1, 1970 UTC. */
1224
1408
  transactionDate: number;
1225
1409
  }
1226
1410
 
@@ -1278,6 +1462,7 @@ export interface PurchaseIOS extends PurchaseCommon {
1278
1462
  store: IapStore;
1279
1463
  storefrontCountryCodeIOS?: (string | null);
1280
1464
  subscriptionGroupIdIOS?: (string | null);
1465
+ /** Unix timestamp in milliseconds since January 1, 1970 UTC. */
1281
1466
  transactionDate: number;
1282
1467
  transactionId: string;
1283
1468
  transactionReasonIOS?: (string | null);
@@ -1359,6 +1544,13 @@ export interface Query {
1359
1544
  * See: https://openiap.dev/docs/apis/get-available-purchases
1360
1545
  */
1361
1546
  getAvailablePurchases: Promise<Purchase[]>;
1547
+ /**
1548
+ * Fetch Play Billing assets and loyalty text for developer-rendered Billing Choice screens.
1549
+ * OpenIAP availability: Spec 2.1.0 / openiap-google 2.3.0 (requires Play Billing 9.1.0+).
1550
+ * Throws OpenIapError.NotPrepared if billing client is not ready.
1551
+ * See: https://openiap.dev/docs/apis/android/get-billing-choice-info-android
1552
+ */
1553
+ getBillingChoiceInfoAndroid: Promise<BillingChoiceInfoAndroid>;
1362
1554
  /**
1363
1555
  * Fetch a token for Apple's External Purchase Server reporting API (iOS 18.1+).
1364
1556
  * Use this token to report transactions made through ExternalPurchaseCustomLink.
@@ -1447,6 +1639,8 @@ export type QueryGetActiveSubscriptionsArgs = (string[] | null) | undefined;
1447
1639
 
1448
1640
  export type QueryGetAvailablePurchasesArgs = (PurchaseOptions | null) | undefined;
1449
1641
 
1642
+ export type QueryGetBillingChoiceInfoAndroidArgs = GetBillingChoiceInfoParamsAndroid;
1643
+
1450
1644
  export type QueryGetExternalPurchaseCustomLinkTokenIosArgs = ExternalPurchaseCustomLinkTokenTypeIOS;
1451
1645
 
1452
1646
  export type QueryGetTransactionJwsIosArgs = string;
@@ -1546,9 +1740,9 @@ export interface RentalDetailsAndroid {
1546
1740
 
1547
1741
  export interface RequestPurchaseAndroidProps {
1548
1742
  /**
1549
- * Developer billing option parameters for external payments flow (8.3.0+).
1550
- * When provided, the purchase flow will show a side-by-side choice between
1551
- * Google Play Billing and the developer's external payment option.
1743
+ * Developer billing option parameters for external payments and Billing Choice.
1744
+ * Billing Choice is available in OpenIAP Spec 2.1.0 / openiap-google 2.3.0
1745
+ * (requires Play Billing 9.1.0+).
1552
1746
  */
1553
1747
  developerBillingOption?: (DeveloperBillingOptionParamsAndroid | null);
1554
1748
  /**
@@ -1633,9 +1827,9 @@ export type RequestPurchaseResult = Purchase | Purchase[] | null;
1633
1827
 
1634
1828
  export interface RequestSubscriptionAndroidProps {
1635
1829
  /**
1636
- * Developer billing option parameters for external payments flow (8.3.0+).
1637
- * When provided, the purchase flow will show a side-by-side choice between
1638
- * Google Play Billing and the developer's external payment option.
1830
+ * Developer billing option parameters for external payments and Billing Choice.
1831
+ * Billing Choice is available in OpenIAP Spec 2.1.0 / openiap-google 2.3.0
1832
+ * (requires Play Billing 9.1.0+).
1639
1833
  */
1640
1834
  developerBillingOption?: (DeveloperBillingOptionParamsAndroid | null);
1641
1835
  /**
@@ -1647,6 +1841,12 @@ export interface RequestSubscriptionAndroidProps {
1647
1841
  obfuscatedAccountId?: (string | null);
1648
1842
  /** Obfuscated profile ID */
1649
1843
  obfuscatedProfileId?: (string | null);
1844
+ /**
1845
+ * Original external transaction ID for replacing a subscription that was
1846
+ * purchased through developer billing. Available in OpenIAP Spec 2.1.0 /
1847
+ * openiap-google 2.3.0 (requires Play Billing 9.1.0+).
1848
+ */
1849
+ originalExternalTransactionId?: (string | null);
1650
1850
  /** Purchase token for upgrades/downgrades */
1651
1851
  purchaseToken?: (string | null);
1652
1852
  /**
@@ -1782,11 +1982,11 @@ export type SubResponseCodeAndroid = 'no-applicable-sub-response-code' | 'paymen
1782
1982
 
1783
1983
  export interface Subscription {
1784
1984
  /**
1785
- * Fires when a user selects developer billing in the External Payments flow (Android only)
1786
- * Triggered when the user chooses to pay via the developer's external payment option
1787
- * instead of Google Play Billing in the side-by-side choice dialog.
1788
- * Contains the externalTransactionToken needed to report the transaction.
1789
- * Available in Google Play Billing Library 8.3.0+
1985
+ * Fires when a user selects developer billing in an External Payments or
1986
+ * Billing Choice flow (Android only). The payload can contain an external
1987
+ * transaction token, link URI, original transaction ID, and selected products.
1988
+ * Billing Choice payload fields are available in OpenIAP Spec 2.1.0 /
1989
+ * openiap-google 2.3.0 (requires Play Billing 9.1.0+).
1790
1990
  */
1791
1991
  developerProvidedBillingAndroid: DeveloperProvidedBillingDetailsAndroid;
1792
1992
  /** Fires when the App Store surfaces a promoted product (iOS only) */
@@ -2235,6 +2435,7 @@ export type QueryArgsMap = {
2235
2435
  getAllTransactionsIOS: never;
2236
2436
  getAppTransactionIOS: never;
2237
2437
  getAvailablePurchases: QueryGetAvailablePurchasesArgs;
2438
+ getBillingChoiceInfoAndroid: QueryGetBillingChoiceInfoAndroidArgs;
2238
2439
  getExternalPurchaseCustomLinkTokenIOS: QueryGetExternalPurchaseCustomLinkTokenIosArgs;
2239
2440
  getPendingTransactionsIOS: never;
2240
2441
  getPromotedProductIOS: never;
@@ -2285,7 +2486,9 @@ export type MutationArgsMap = {
2285
2486
  requestPurchaseOnPromotedProductIOS: never;
2286
2487
  restorePurchases: never;
2287
2488
  showAlternativeBillingDialogAndroid: never;
2489
+ showBillingProgramInformationDialogAndroid: MutationShowBillingProgramInformationDialogAndroidArgs;
2288
2490
  showExternalPurchaseCustomLinkNoticeIOS: MutationShowExternalPurchaseCustomLinkNoticeIosArgs;
2491
+ showInAppMessagesAndroid: MutationShowInAppMessagesAndroidArgs;
2289
2492
  showManageSubscriptionsIOS: never;
2290
2493
  syncIOS: never;
2291
2494
  validateReceipt: MutationValidateReceiptArgs;
@@ -232,7 +232,7 @@ export function convertNitroProductToProduct(
232
232
  displayPrice: nitroProduct.displayPrice ?? '',
233
233
  currency: nitroProduct.currency ?? '',
234
234
  price: toNullableNumber(nitroProduct.price),
235
- debugDescription: null,
235
+ debugDescription: nitroProduct.debugDescription ?? null,
236
236
  platform,
237
237
  };
238
238
 
@@ -244,7 +244,6 @@ export function convertNitroProductToProduct(
244
244
  jsonRepresentationIOS:
245
245
  nitroProduct.jsonRepresentationIOS ?? DEFAULT_JSON_REPR,
246
246
  typeIOS: normalizeProductTypeIOS(nitroProduct.typeIOS),
247
- subscriptionInfoIOS: undefined,
248
247
  };
249
248
 
250
249
  iosProduct.introductoryPriceAsAmountIOS = toNullableString(
@@ -284,6 +283,31 @@ export function convertNitroProductToProduct(
284
283
  iosProduct.discountsIOS = null;
285
284
  }
286
285
 
286
+ if (nitroProduct.pricingTermsIOS) {
287
+ try {
288
+ const parsed = JSON.parse(nitroProduct.pricingTermsIOS);
289
+ iosProduct.pricingTermsIOS = Array.isArray(parsed) ? parsed : null;
290
+ } catch {
291
+ iosProduct.pricingTermsIOS = null;
292
+ }
293
+ } else {
294
+ iosProduct.pricingTermsIOS = null;
295
+ }
296
+
297
+ if (nitroProduct.subscriptionInfoIOS) {
298
+ try {
299
+ const parsed = JSON.parse(nitroProduct.subscriptionInfoIOS);
300
+ iosProduct.subscriptionInfoIOS =
301
+ typeof parsed === 'object' && parsed !== null && !Array.isArray(parsed)
302
+ ? parsed
303
+ : null;
304
+ } catch {
305
+ iosProduct.subscriptionInfoIOS = null;
306
+ }
307
+ } else {
308
+ iosProduct.subscriptionInfoIOS = null;
309
+ }
310
+
287
311
  // Parse standardized subscriptionOffers (cross-platform, OpenIAP 1.3.10+)
288
312
  if (nitroProduct.subscriptionOffers) {
289
313
  try {
@@ -21,6 +21,7 @@ const IAPKIT_VERIFY_TIMEOUT_MS = 10_000;
21
21
  const MAX_IAPKIT_ERROR_DEPTH = 5;
22
22
  const MAX_PRODUCT_DATA_BATCH_SIZE = 100;
23
23
  const MAX_PURCHASE_UPDATE_PAGES = 100;
24
+ const NOTIFY_FULFILLMENT_ATTEMPT_TIMEOUT_MS = 2_000;
24
25
  const NOTIFY_FULFILLMENT_MAX_ATTEMPTS = 15;
25
26
  const NOTIFY_FULFILLMENT_RETRY_DELAY_MS = 1_000;
26
27
  const PURCHASE_UPDATES_MAX_ATTEMPTS = 5;
@@ -207,6 +208,26 @@ function delay(ms: number): Promise<void> {
207
208
  });
208
209
  }
209
210
 
211
+ function withTimeout<T>(
212
+ operation: Promise<T>,
213
+ timeoutMs: number,
214
+ timeoutError: Error,
215
+ ): Promise<T> {
216
+ return new Promise((resolve, reject) => {
217
+ const timeoutId = setTimeout(() => reject(timeoutError), timeoutMs);
218
+ operation.then(
219
+ (value) => {
220
+ clearTimeout(timeoutId);
221
+ resolve(value);
222
+ },
223
+ (error) => {
224
+ clearTimeout(timeoutId);
225
+ reject(error);
226
+ },
227
+ );
228
+ });
229
+ }
230
+
210
231
  function isSuccess(
211
232
  operation: ResponseOperation,
212
233
  responseCode: unknown,
@@ -860,10 +881,17 @@ export function createVegaIapModule(service: VegaPurchasingService): RnIap {
860
881
  attempt <= NOTIFY_FULFILLMENT_MAX_ATTEMPTS;
861
882
  attempt += 1
862
883
  ) {
863
- const response = await service.notifyFulfillment({
864
- fulfillmentResult: FULFILLMENT_RESULT_FULFILLED,
865
- receiptId: purchaseToken,
866
- });
884
+ const response = await withTimeout(
885
+ service.notifyFulfillment({
886
+ fulfillmentResult: FULFILLMENT_RESULT_FULFILLED,
887
+ receiptId: purchaseToken,
888
+ }),
889
+ NOTIFY_FULFILLMENT_ATTEMPT_TIMEOUT_MS,
890
+ createVegaError(
891
+ ErrorCode.ServiceTimeout,
892
+ 'Amazon Vega notifyFulfillment timed out.',
893
+ ),
894
+ );
867
895
  if (isSuccess('notify-fulfillment', response?.responseCode)) {
868
896
  return {
869
897
  responseCode: 0,
@@ -872,7 +900,6 @@ export function createVegaIapModule(service: VegaPurchasingService): RnIap {
872
900
  purchaseToken,
873
901
  };
874
902
  }
875
-
876
903
  lastResponse = response;
877
904
  if (attempt < NOTIFY_FULFILLMENT_MAX_ATTEMPTS) {
878
905
  await delay(NOTIFY_FULFILLMENT_RETRY_DELAY_MS);
@@ -909,7 +936,8 @@ export function createVegaIapModule(service: VegaPurchasingService): RnIap {
909
936
  const purchaseTimestamp = toTimestamp(receipt.purchaseDate);
910
937
  if (
911
938
  options?.minPurchaseDateMs != null &&
912
- (purchaseTimestamp === 0 || purchaseTimestamp < options.minPurchaseDateMs)
939
+ (purchaseTimestamp === 0 ||
940
+ purchaseTimestamp < options.minPurchaseDateMs)
913
941
  ) {
914
942
  continue;
915
943
  }
@@ -1286,11 +1314,7 @@ export function createVegaIapModule(service: VegaPurchasingService): RnIap {
1286
1314
  if (!response.receipt) return [];
1287
1315
 
1288
1316
  cachedUserData = response.userData ?? cachedUserData;
1289
- const purchase = mapReceipt(
1290
- response.receipt,
1291
- fallbackProductType,
1292
- sku,
1293
- );
1317
+ const purchase = mapReceipt(response.receipt, fallbackProductType, sku);
1294
1318
  emitPurchaseUpdated(purchase);
1295
1319
  return [purchase];
1296
1320
  } catch (error) {
@@ -1469,11 +1493,22 @@ export function createVegaIapModule(service: VegaPurchasingService): RnIap {
1469
1493
  async isBillingProgramAvailableAndroid(): Promise<never> {
1470
1494
  return throwUnsupportedFeature('isBillingProgramAvailableAndroid');
1471
1495
  },
1496
+ async getBillingChoiceInfoAndroid(): Promise<never> {
1497
+ return throwUnsupportedFeature('getBillingChoiceInfoAndroid');
1498
+ },
1472
1499
  async createBillingProgramReportingDetailsAndroid(): Promise<never> {
1473
1500
  return throwUnsupportedFeature(
1474
1501
  'createBillingProgramReportingDetailsAndroid',
1475
1502
  );
1476
1503
  },
1504
+ async showBillingProgramInformationDialogAndroid(): Promise<never> {
1505
+ return throwUnsupportedFeature(
1506
+ 'showBillingProgramInformationDialogAndroid',
1507
+ );
1508
+ },
1509
+ async showInAppMessagesAndroid(): Promise<never> {
1510
+ return throwUnsupportedFeature('showInAppMessagesAndroid');
1511
+ },
1477
1512
  async launchExternalLinkAndroid(): Promise<boolean> {
1478
1513
  return throwUnsupportedFeature('launchExternalLinkAndroid');
1479
1514
  },