react-native-iap 14.5.1-rc.1 → 14.6.0-rc.2

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 (81) hide show
  1. package/README.md +1 -0
  2. package/android/src/main/java/com/margelo/nitro/iap/HybridRnIap.kt +198 -36
  3. package/ios/HybridRnIap.swift +32 -2
  4. package/lib/module/hooks/useIAP.js +1 -6
  5. package/lib/module/hooks/useIAP.js.map +1 -1
  6. package/lib/module/index.js +228 -10
  7. package/lib/module/index.js.map +1 -1
  8. package/lib/module/types.js +116 -0
  9. package/lib/module/types.js.map +1 -1
  10. package/lib/typescript/plugin/src/withIAP.d.ts +6 -0
  11. package/lib/typescript/plugin/src/withIAP.d.ts.map +1 -1
  12. package/lib/typescript/src/hooks/useIAP.d.ts +5 -7
  13. package/lib/typescript/src/hooks/useIAP.d.ts.map +1 -1
  14. package/lib/typescript/src/index.d.ts +144 -2
  15. package/lib/typescript/src/index.d.ts.map +1 -1
  16. package/lib/typescript/src/specs/RnIap.nitro.d.ts +90 -8
  17. package/lib/typescript/src/specs/RnIap.nitro.d.ts.map +1 -1
  18. package/lib/typescript/src/types.d.ts +194 -10
  19. package/lib/typescript/src/types.d.ts.map +1 -1
  20. package/nitrogen/generated/android/c++/JBillingProgramAndroid.hpp +62 -0
  21. package/nitrogen/generated/android/c++/JExternalLinkLaunchModeAndroid.hpp +62 -0
  22. package/nitrogen/generated/android/c++/JExternalLinkTypeAndroid.hpp +62 -0
  23. package/nitrogen/generated/android/c++/JHybridRnIapSpec.cpp +88 -4
  24. package/nitrogen/generated/android/c++/JHybridRnIapSpec.hpp +4 -0
  25. package/nitrogen/generated/android/c++/JNitroBillingProgramAvailabilityResultAndroid.hpp +62 -0
  26. package/nitrogen/generated/android/c++/JNitroBillingProgramReportingDetailsAndroid.hpp +63 -0
  27. package/nitrogen/generated/android/c++/JNitroLaunchExternalLinkParamsAndroid.hpp +75 -0
  28. package/nitrogen/generated/android/c++/JNitroReceiptValidationAppleOptions.hpp +57 -0
  29. package/nitrogen/generated/android/c++/{JNitroReceiptValidationAndroidOptions.hpp → JNitroReceiptValidationGoogleOptions.hpp} +18 -14
  30. package/nitrogen/generated/android/c++/JNitroReceiptValidationHorizonOptions.hpp +65 -0
  31. package/nitrogen/generated/android/c++/JNitroReceiptValidationParams.hpp +19 -11
  32. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/BillingProgramAndroid.kt +22 -0
  33. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/ExternalLinkLaunchModeAndroid.kt +22 -0
  34. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/ExternalLinkTypeAndroid.kt +22 -0
  35. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/HybridRnIapSpec.kt +16 -0
  36. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroBillingProgramAvailabilityResultAndroid.kt +39 -0
  37. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroBillingProgramReportingDetailsAndroid.kt +39 -0
  38. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroLaunchExternalLinkParamsAndroid.kt +45 -0
  39. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroReceiptValidationAppleOptions.kt +36 -0
  40. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/{NitroReceiptValidationAndroidOptions.kt → NitroReceiptValidationGoogleOptions.kt} +9 -6
  41. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroReceiptValidationHorizonOptions.kt +42 -0
  42. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroReceiptValidationParams.kt +7 -4
  43. package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Bridge.cpp +16 -0
  44. package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Bridge.hpp +141 -10
  45. package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Umbrella.hpp +27 -3
  46. package/nitrogen/generated/ios/c++/HybridRnIapSpecSwift.hpp +57 -3
  47. package/nitrogen/generated/ios/swift/BillingProgramAndroid.swift +44 -0
  48. package/nitrogen/generated/ios/swift/ExternalLinkLaunchModeAndroid.swift +44 -0
  49. package/nitrogen/generated/ios/swift/ExternalLinkTypeAndroid.swift +44 -0
  50. package/nitrogen/generated/ios/swift/Func_void_NitroBillingProgramAvailabilityResultAndroid.swift +47 -0
  51. package/nitrogen/generated/ios/swift/Func_void_NitroBillingProgramReportingDetailsAndroid.swift +47 -0
  52. package/nitrogen/generated/ios/swift/HybridRnIapSpec.swift +4 -0
  53. package/nitrogen/generated/ios/swift/HybridRnIapSpec_cxx.swift +68 -0
  54. package/nitrogen/generated/ios/swift/NitroBillingProgramAvailabilityResultAndroid.swift +46 -0
  55. package/nitrogen/generated/ios/swift/NitroBillingProgramReportingDetailsAndroid.swift +46 -0
  56. package/nitrogen/generated/ios/swift/NitroLaunchExternalLinkParamsAndroid.swift +68 -0
  57. package/nitrogen/generated/ios/swift/NitroReceiptValidationAppleOptions.swift +35 -0
  58. package/nitrogen/generated/ios/swift/{NitroReceiptValidationAndroidOptions.swift → NitroReceiptValidationGoogleOptions.swift} +21 -10
  59. package/nitrogen/generated/ios/swift/NitroReceiptValidationHorizonOptions.swift +57 -0
  60. package/nitrogen/generated/ios/swift/NitroReceiptValidationParams.swift +46 -11
  61. package/nitrogen/generated/shared/c++/BillingProgramAndroid.hpp +80 -0
  62. package/nitrogen/generated/shared/c++/ExternalLinkLaunchModeAndroid.hpp +80 -0
  63. package/nitrogen/generated/shared/c++/ExternalLinkTypeAndroid.hpp +80 -0
  64. package/nitrogen/generated/shared/c++/HybridRnIapSpec.cpp +4 -0
  65. package/nitrogen/generated/shared/c++/HybridRnIapSpec.hpp +16 -0
  66. package/nitrogen/generated/shared/c++/NitroBillingProgramAvailabilityResultAndroid.hpp +80 -0
  67. package/nitrogen/generated/shared/c++/NitroBillingProgramReportingDetailsAndroid.hpp +81 -0
  68. package/nitrogen/generated/shared/c++/NitroLaunchExternalLinkParamsAndroid.hpp +95 -0
  69. package/nitrogen/generated/shared/c++/NitroReceiptValidationAppleOptions.hpp +75 -0
  70. package/nitrogen/generated/shared/c++/{NitroReceiptValidationAndroidOptions.hpp → NitroReceiptValidationGoogleOptions.hpp} +18 -14
  71. package/nitrogen/generated/shared/c++/NitroReceiptValidationHorizonOptions.hpp +83 -0
  72. package/nitrogen/generated/shared/c++/NitroReceiptValidationParams.hpp +22 -13
  73. package/openiap-versions.json +3 -3
  74. package/package.json +1 -1
  75. package/plugin/build/withIAP.d.ts +6 -0
  76. package/plugin/build/withIAP.js +46 -2
  77. package/plugin/src/withIAP.ts +67 -2
  78. package/src/hooks/useIAP.ts +8 -23
  79. package/src/index.ts +297 -14
  80. package/src/specs/RnIap.nitro.ts +125 -10
  81. package/src/types.ts +207 -10
@@ -14,8 +14,9 @@ import type {
14
14
  ProductCommon,
15
15
  PurchaseCommon,
16
16
  PurchaseOptions,
17
- VerifyPurchaseAndroidOptions,
18
- VerifyPurchaseProps,
17
+ VerifyPurchaseAppleOptions,
18
+ VerifyPurchaseGoogleOptions,
19
+ VerifyPurchaseHorizonOptions,
19
20
  VerifyPurchaseResultAndroid,
20
21
  RequestPurchaseIosProps,
21
22
  RequestPurchaseResult,
@@ -44,22 +45,50 @@ export type IapStore = 'unknown' | 'apple' | 'google' | 'horizon';
44
45
  // Note: Nitro requires at least 2 values for union types
45
46
  export type PurchaseVerificationProvider = 'iapkit' | 'none';
46
47
 
48
+ // Billing Programs API types (Android 8.2.0+)
49
+ export type BillingProgramAndroid =
50
+ | 'unspecified'
51
+ | 'external-content-link'
52
+ | 'external-offer';
53
+
54
+ export type ExternalLinkLaunchModeAndroid =
55
+ | 'unspecified'
56
+ | 'launch-in-external-browser-or-app'
57
+ | 'caller-will-launch-link';
58
+
59
+ export type ExternalLinkTypeAndroid =
60
+ | 'unspecified'
61
+ | 'link-to-digital-content-offer'
62
+ | 'link-to-app-download';
63
+
47
64
  // ╔══════════════════════════════════════════════════════════════════════════╗
48
65
  // ║ PARAMS ║
49
66
  // ╚══════════════════════════════════════════════════════════════════════════╝
50
67
 
51
- // Receipt validation parameters
68
+ // Receipt validation parameters (platform-specific)
52
69
 
53
- export interface NitroReceiptValidationAndroidOptions {
54
- accessToken: VerifyPurchaseAndroidOptions['accessToken'];
55
- isSub?: VerifyPurchaseAndroidOptions['isSub'];
56
- packageName: VerifyPurchaseAndroidOptions['packageName'];
57
- productToken: VerifyPurchaseAndroidOptions['productToken'];
70
+ export interface NitroReceiptValidationAppleOptions {
71
+ sku: VerifyPurchaseAppleOptions['sku'];
72
+ }
73
+
74
+ export interface NitroReceiptValidationGoogleOptions {
75
+ accessToken: VerifyPurchaseGoogleOptions['accessToken'];
76
+ isSub?: VerifyPurchaseGoogleOptions['isSub'];
77
+ packageName: VerifyPurchaseGoogleOptions['packageName'];
78
+ purchaseToken: VerifyPurchaseGoogleOptions['purchaseToken'];
79
+ sku: VerifyPurchaseGoogleOptions['sku'];
80
+ }
81
+
82
+ export interface NitroReceiptValidationHorizonOptions {
83
+ accessToken: VerifyPurchaseHorizonOptions['accessToken'];
84
+ sku: VerifyPurchaseHorizonOptions['sku'];
85
+ userId: VerifyPurchaseHorizonOptions['userId'];
58
86
  }
59
87
 
60
88
  export interface NitroReceiptValidationParams {
61
- sku: VerifyPurchaseProps['sku'];
62
- androidOptions?: NitroReceiptValidationAndroidOptions | null;
89
+ apple?: NitroReceiptValidationAppleOptions | null;
90
+ google?: NitroReceiptValidationGoogleOptions | null;
91
+ horizon?: NitroReceiptValidationHorizonOptions | null;
63
92
  }
64
93
 
65
94
  // Purchase request parameters
@@ -147,6 +176,20 @@ export interface NitroDeepLinkOptionsAndroid {
147
176
  packageNameAndroid?: DeepLinkOptions['packageNameAndroid'];
148
177
  }
149
178
 
179
+ /**
180
+ * Parameters for launching an external link (Android 8.2.0+)
181
+ */
182
+ export interface NitroLaunchExternalLinkParamsAndroid {
183
+ /** The billing program (external-content-link or external-offer) */
184
+ billingProgram: BillingProgramAndroid;
185
+ /** The external link launch mode */
186
+ launchMode: ExternalLinkLaunchModeAndroid;
187
+ /** The type of the external link */
188
+ linkType: ExternalLinkTypeAndroid;
189
+ /** The URI where the content will be accessed from */
190
+ linkUri: string;
191
+ }
192
+
150
193
  // ╔══════════════════════════════════════════════════════════════════════════╗
151
194
  // ║ TYPES ║
152
195
  // ╚══════════════════════════════════════════════════════════════════════════╝
@@ -251,6 +294,26 @@ export interface NitroVerifyPurchaseWithProviderResult {
251
294
  provider: PurchaseVerificationProvider;
252
295
  }
253
296
 
297
+ /**
298
+ * Result of checking billing program availability (Android 8.2.0+)
299
+ */
300
+ export interface NitroBillingProgramAvailabilityResultAndroid {
301
+ /** The billing program that was checked */
302
+ billingProgram: BillingProgramAndroid;
303
+ /** Whether the billing program is available for the user */
304
+ isAvailable: boolean;
305
+ }
306
+
307
+ /**
308
+ * Reporting details for external transactions (Android 8.2.0+)
309
+ */
310
+ export interface NitroBillingProgramReportingDetailsAndroid {
311
+ /** The billing program that the reporting details are associated with */
312
+ billingProgram: BillingProgramAndroid;
313
+ /** External transaction token used to report transactions to Google */
314
+ externalTransactionToken: string;
315
+ }
316
+
254
317
  /**
255
318
  * Discount amount details for one-time purchase offers (Android)
256
319
  */
@@ -772,6 +835,7 @@ export interface RnIap extends HybridObject<{ios: 'swift'; android: 'kotlin'}> {
772
835
 
773
836
  /**
774
837
  * Validate a receipt on the appropriate platform
838
+ * @deprecated Use `verifyPurchase` instead. This function will be removed in a future version.
775
839
  * @param params - Receipt validation parameters including SKU and platform-specific options
776
840
  * @returns Promise<NitroReceiptValidationResultIOS | NitroReceiptValidationResultAndroid> - Platform-specific validation result
777
841
  */
@@ -870,6 +934,57 @@ export interface RnIap extends HybridObject<{ios: 'swift'; android: 'kotlin'}> {
870
934
  listener: (details: UserChoiceBillingDetails) => void,
871
935
  ): void;
872
936
 
937
+ // ╔════════════════════════════════════════════════════════════════════════╗
938
+ // ║ BILLING PROGRAMS API (Android 8.2.0+) ║
939
+ // ╚════════════════════════════════════════════════════════════════════════╝
940
+
941
+ /**
942
+ * Enable a billing program before initConnection (Android only).
943
+ * Must be called BEFORE initConnection() to configure the BillingClient.
944
+ *
945
+ * @param program - The billing program to enable
946
+ * @platform Android
947
+ * @since Billing Library 8.2.0+
948
+ */
949
+ enableBillingProgramAndroid(program: BillingProgramAndroid): void;
950
+
951
+ /**
952
+ * Check if a billing program is available for this user/device (Android only).
953
+ *
954
+ * @param program - The billing program to check
955
+ * @returns Promise with availability result
956
+ * @platform Android
957
+ * @since Billing Library 8.2.0+
958
+ */
959
+ isBillingProgramAvailableAndroid(
960
+ program: BillingProgramAndroid,
961
+ ): Promise<NitroBillingProgramAvailabilityResultAndroid>;
962
+
963
+ /**
964
+ * Create billing program reporting details for external transactions (Android only).
965
+ * Used to get the external transaction token needed for reporting to Google.
966
+ *
967
+ * @param program - The billing program to create reporting details for
968
+ * @returns Promise with reporting details including external transaction token
969
+ * @platform Android
970
+ * @since Billing Library 8.2.0+
971
+ */
972
+ createBillingProgramReportingDetailsAndroid(
973
+ program: BillingProgramAndroid,
974
+ ): Promise<NitroBillingProgramReportingDetailsAndroid>;
975
+
976
+ /**
977
+ * Launch external link for external offers or app download (Android only).
978
+ *
979
+ * @param params - Parameters for launching the external link
980
+ * @returns Promise<boolean> - true if user accepted, false otherwise
981
+ * @platform Android
982
+ * @since Billing Library 8.2.0+
983
+ */
984
+ launchExternalLinkAndroid(
985
+ params: NitroLaunchExternalLinkParamsAndroid,
986
+ ): Promise<boolean>;
987
+
873
988
  // ╔════════════════════════════════════════════════════════════════════════╗
874
989
  // ║ EXTERNAL PURCHASE LINKS (iOS 16.0+) ║
875
990
  // ╚════════════════════════════════════════════════════════════════════════╝
package/src/types.ts CHANGED
@@ -65,6 +65,38 @@ export interface AppTransaction {
65
65
  signedDate: number;
66
66
  }
67
67
 
68
+ /**
69
+ * Billing program types for external content links and external offers (Android)
70
+ * Available in Google Play Billing Library 8.2.0+
71
+ */
72
+ export type BillingProgramAndroid = 'unspecified' | 'external-content-link' | 'external-offer';
73
+
74
+ /**
75
+ * Result of checking billing program availability (Android)
76
+ * Available in Google Play Billing Library 8.2.0+
77
+ */
78
+ export interface BillingProgramAvailabilityResultAndroid {
79
+ /** The billing program that was checked */
80
+ billingProgram: BillingProgramAndroid;
81
+ /** Whether the billing program is available for the user */
82
+ isAvailable: boolean;
83
+ }
84
+
85
+ /**
86
+ * Reporting details for transactions made outside of Google Play Billing (Android)
87
+ * Contains the external transaction token needed for reporting
88
+ * Available in Google Play Billing Library 8.2.0+
89
+ */
90
+ export interface BillingProgramReportingDetailsAndroid {
91
+ /** The billing program that the reporting details are associated with */
92
+ billingProgram: BillingProgramAndroid;
93
+ /**
94
+ * External transaction token used to report transactions made outside of Google Play Billing.
95
+ * This token must be used when reporting the external transaction to Google.
96
+ */
97
+ externalTransactionToken: string;
98
+ }
99
+
68
100
  export interface DeepLinkOptions {
69
101
  /** Android package name to target (required on Android) */
70
102
  packageNameAndroid?: (string | null);
@@ -183,6 +215,40 @@ export enum ErrorCode {
183
215
  UserError = 'user-error'
184
216
  }
185
217
 
218
+ /**
219
+ * Launch mode for external link flow (Android)
220
+ * Determines how the external URL is launched
221
+ * Available in Google Play Billing Library 8.2.0+
222
+ */
223
+ export type ExternalLinkLaunchModeAndroid = 'unspecified' | 'launch-in-external-browser-or-app' | 'caller-will-launch-link';
224
+
225
+ /**
226
+ * Link type for external link flow (Android)
227
+ * Specifies the type of external link destination
228
+ * Available in Google Play Billing Library 8.2.0+
229
+ */
230
+ export type ExternalLinkTypeAndroid = 'unspecified' | 'link-to-digital-content-offer' | 'link-to-app-download';
231
+
232
+ /**
233
+ * External offer availability result (Android)
234
+ * @deprecated Use BillingProgramAvailabilityResultAndroid with isBillingProgramAvailableAsync instead
235
+ * Available in Google Play Billing Library 6.2.0+, deprecated in 8.2.0
236
+ */
237
+ export interface ExternalOfferAvailabilityResultAndroid {
238
+ /** Whether external offers are available for the user */
239
+ isAvailable: boolean;
240
+ }
241
+
242
+ /**
243
+ * External offer reporting details (Android)
244
+ * @deprecated Use BillingProgramReportingDetailsAndroid with createBillingProgramReportingDetailsAsync instead
245
+ * Available in Google Play Billing Library 6.2.0+, deprecated in 8.2.0
246
+ */
247
+ export interface ExternalOfferReportingDetailsAndroid {
248
+ /** External transaction token for reporting external offer transactions */
249
+ externalTransactionToken: string;
250
+ }
251
+
186
252
  /** Result of presenting an external purchase link (iOS 18.2+) */
187
253
  export interface ExternalPurchaseLinkResultIOS {
188
254
  /** Optional error message if the presentation failed */
@@ -222,6 +288,22 @@ export interface InitConnectionConfig {
222
288
  alternativeBillingModeAndroid?: (AlternativeBillingModeAndroid | null);
223
289
  }
224
290
 
291
+ /**
292
+ * Parameters for launching an external link (Android)
293
+ * Used with launchExternalLink to initiate external offer or app install flows
294
+ * Available in Google Play Billing Library 8.2.0+
295
+ */
296
+ export interface LaunchExternalLinkParamsAndroid {
297
+ /** The billing program (EXTERNAL_CONTENT_LINK or EXTERNAL_OFFER) */
298
+ billingProgram: BillingProgramAndroid;
299
+ /** The external link launch mode */
300
+ launchMode: ExternalLinkLaunchModeAndroid;
301
+ /** The type of the external link */
302
+ linkType: ExternalLinkTypeAndroid;
303
+ /** The URI where the content will be accessed from */
304
+ linkUri: string;
305
+ }
306
+
225
307
  /**
226
308
  * Limited quantity information for one-time purchase offers (Android)
227
309
  * Available in Google Play Billing Library 7.0+
@@ -835,6 +917,14 @@ export type RequestPurchaseProps =
835
917
  useAlternativeBilling?: boolean | null;
836
918
  };
837
919
 
920
+ /**
921
+ * Platform-specific purchase request parameters.
922
+ *
923
+ * Note: "Platforms" refers to the SDK/OS level (apple, google), not the store.
924
+ * - apple: Always targets App Store
925
+ * - google: Targets Play Store by default, or Horizon when built with horizon flavor
926
+ * (determined at build time, not runtime)
927
+ */
838
928
  export interface RequestPurchasePropsByPlatforms {
839
929
  /** @deprecated Use google instead */
840
930
  android?: (RequestPurchaseAndroidProps | null);
@@ -857,12 +947,20 @@ export interface RequestSubscriptionAndroidProps {
857
947
  obfuscatedProfileIdAndroid?: (string | null);
858
948
  /** Purchase token for upgrades/downgrades */
859
949
  purchaseTokenAndroid?: (string | null);
860
- /** Replacement mode for subscription changes */
950
+ /**
951
+ * Replacement mode for subscription changes
952
+ * @deprecated Use subscriptionProductReplacementParams instead for item-level replacement (8.1.0+)
953
+ */
861
954
  replacementModeAndroid?: (number | null);
862
955
  /** List of subscription SKUs */
863
956
  skus: string[];
864
957
  /** Subscription offers */
865
958
  subscriptionOffers?: (AndroidSubscriptionOfferInput[] | null);
959
+ /**
960
+ * Product-level replacement parameters (8.1.0+)
961
+ * Use this instead of replacementModeAndroid for item-level replacement
962
+ */
963
+ subscriptionProductReplacementParams?: (SubscriptionProductReplacementParamsAndroid | null);
866
964
  }
867
965
 
868
966
  export interface RequestSubscriptionIosProps {
@@ -873,6 +971,14 @@ export interface RequestSubscriptionIosProps {
873
971
  withOffer?: (DiscountOfferInputIOS | null);
874
972
  }
875
973
 
974
+ /**
975
+ * Platform-specific subscription request parameters.
976
+ *
977
+ * Note: "Platforms" refers to the SDK/OS level (apple, google), not the store.
978
+ * - apple: Always targets App Store
979
+ * - google: Targets Play Store by default, or Horizon when built with horizon flavor
980
+ * (determined at build time, not runtime)
981
+ */
876
982
  export interface RequestSubscriptionPropsByPlatforms {
877
983
  /** @deprecated Use google instead */
878
984
  android?: (RequestSubscriptionAndroidProps | null);
@@ -894,12 +1000,18 @@ export interface RequestVerifyPurchaseWithIapkitGoogleProps {
894
1000
  purchaseToken: string;
895
1001
  }
896
1002
 
1003
+ /**
1004
+ * Platform-specific verification parameters for IAPKit.
1005
+ *
1006
+ * - apple: Verifies via App Store (JWS token)
1007
+ * - google: Verifies via Play Store (purchase token)
1008
+ */
897
1009
  export interface RequestVerifyPurchaseWithIapkitProps {
898
1010
  /** API key used for the Authorization header (Bearer {apiKey}). */
899
1011
  apiKey?: (string | null);
900
- /** Apple verification parameters. */
1012
+ /** Apple App Store verification parameters. */
901
1013
  apple?: (RequestVerifyPurchaseWithIapkitAppleProps | null);
902
- /** Google verification parameters. */
1014
+ /** Google Play Store verification parameters. */
903
1015
  google?: (RequestVerifyPurchaseWithIapkitGoogleProps | null);
904
1016
  }
905
1017
 
@@ -952,6 +1064,25 @@ export interface SubscriptionPeriodValueIOS {
952
1064
  value: number;
953
1065
  }
954
1066
 
1067
+ /**
1068
+ * Product-level subscription replacement parameters (Android)
1069
+ * Used with setSubscriptionProductReplacementParams in BillingFlowParams.ProductDetailsParams
1070
+ * Available in Google Play Billing Library 8.1.0+
1071
+ */
1072
+ export interface SubscriptionProductReplacementParamsAndroid {
1073
+ /** The old product ID that needs to be replaced */
1074
+ oldProductId: string;
1075
+ /** The replacement mode for this product change */
1076
+ replacementMode: SubscriptionReplacementModeAndroid;
1077
+ }
1078
+
1079
+ /**
1080
+ * Replacement mode for subscription changes (Android)
1081
+ * These modes determine how the subscription replacement affects billing.
1082
+ * Available in Google Play Billing Library 8.1.0+
1083
+ */
1084
+ export type SubscriptionReplacementModeAndroid = 'unknown-replacement-mode' | 'with-time-proration' | 'charge-prorated-price' | 'charge-full-price' | 'without-proration' | 'deferred' | 'keep-existing';
1085
+
955
1086
  export interface SubscriptionStatusIOS {
956
1087
  renewalInfo?: (RenewalInfoIOS | null);
957
1088
  state: string;
@@ -979,21 +1110,76 @@ export interface ValidTimeWindowAndroid {
979
1110
  startTimeMillis: string;
980
1111
  }
981
1112
 
982
- export interface VerifyPurchaseAndroidOptions {
1113
+ /**
1114
+ * Apple App Store verification parameters.
1115
+ * Used for server-side receipt validation via App Store Server API.
1116
+ */
1117
+ export interface VerifyPurchaseAppleOptions {
1118
+ /** Product SKU to validate */
1119
+ sku: string;
1120
+ }
1121
+
1122
+ /**
1123
+ * Google Play Store verification parameters.
1124
+ * Used for server-side receipt validation via Google Play Developer API.
1125
+ *
1126
+ * ⚠️ SECURITY: Contains sensitive tokens (accessToken, purchaseToken). Do not log or persist this data.
1127
+ */
1128
+ export interface VerifyPurchaseGoogleOptions {
1129
+ /**
1130
+ * Google OAuth2 access token for API authentication.
1131
+ * ⚠️ Sensitive: Do not log this value.
1132
+ */
983
1133
  accessToken: string;
1134
+ /** Whether this is a subscription purchase (affects API endpoint used) */
984
1135
  isSub?: (boolean | null);
1136
+ /** Android package name (e.g., com.example.app) */
985
1137
  packageName: string;
986
- productToken: string;
1138
+ /**
1139
+ * Purchase token from the purchase response.
1140
+ * ⚠️ Sensitive: Do not log this value.
1141
+ */
1142
+ purchaseToken: string;
1143
+ /** Product SKU to validate */
1144
+ sku: string;
987
1145
  }
988
1146
 
989
- export interface VerifyPurchaseProps {
990
- /** Android-specific validation options */
991
- androidOptions?: (VerifyPurchaseAndroidOptions | null);
992
- /** Product SKU to validate */
1147
+ /**
1148
+ * Meta Horizon (Quest) verification parameters.
1149
+ * Used for server-side entitlement verification via Meta's S2S API.
1150
+ * POST https://graph.oculus.com/$APP_ID/verify_entitlement
1151
+ *
1152
+ * ⚠️ SECURITY: Contains sensitive token (accessToken). Do not log or persist this data.
1153
+ */
1154
+ export interface VerifyPurchaseHorizonOptions {
1155
+ /**
1156
+ * Access token for Meta API authentication (OC|$APP_ID|$APP_SECRET or User Access Token).
1157
+ * ⚠️ Sensitive: Do not log this value.
1158
+ */
1159
+ accessToken: string;
1160
+ /** The SKU for the add-on item, defined in Meta Developer Dashboard */
993
1161
  sku: string;
1162
+ /** The user ID of the user whose purchase you want to verify */
1163
+ userId: string;
994
1164
  }
995
1165
 
996
- export type VerifyPurchaseResult = VerifyPurchaseResultAndroid | VerifyPurchaseResultIOS;
1166
+ /**
1167
+ * Platform-specific purchase verification parameters.
1168
+ *
1169
+ * - apple: Verifies via App Store Server API
1170
+ * - google: Verifies via Google Play Developer API
1171
+ * - horizon: Verifies via Meta's S2S API (verify_entitlement endpoint)
1172
+ */
1173
+ export interface VerifyPurchaseProps {
1174
+ /** Apple App Store verification parameters. */
1175
+ apple?: (VerifyPurchaseAppleOptions | null);
1176
+ /** Google Play Store verification parameters. */
1177
+ google?: (VerifyPurchaseGoogleOptions | null);
1178
+ /** Meta Horizon (Quest) verification parameters. */
1179
+ horizon?: (VerifyPurchaseHorizonOptions | null);
1180
+ }
1181
+
1182
+ export type VerifyPurchaseResult = VerifyPurchaseResultAndroid | VerifyPurchaseResultHorizon | VerifyPurchaseResultIOS;
997
1183
 
998
1184
  export interface VerifyPurchaseResultAndroid {
999
1185
  autoRenewing: boolean;
@@ -1016,6 +1202,17 @@ export interface VerifyPurchaseResultAndroid {
1016
1202
  testTransaction: boolean;
1017
1203
  }
1018
1204
 
1205
+ /**
1206
+ * Result from Meta Horizon verify_entitlement API.
1207
+ * Returns verification status and grant time for the entitlement.
1208
+ */
1209
+ export interface VerifyPurchaseResultHorizon {
1210
+ /** Unix timestamp (seconds) when the entitlement was granted. */
1211
+ grantTime?: (number | null);
1212
+ /** Whether the entitlement verification succeeded. */
1213
+ success: boolean;
1214
+ }
1215
+
1019
1216
  export interface VerifyPurchaseResultIOS {
1020
1217
  /** Whether the receipt is valid */
1021
1218
  isValid: boolean;