react-native-iap 15.6.2 → 16.0.1
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.
- package/android/src/main/java/com/margelo/nitro/iap/HybridRnIap.kt +34 -182
- package/android/src/main/java/com/margelo/nitro/iap/ProductSerialization.kt +0 -69
- package/android/src/main/java/com/margelo/nitro/iap/RnIapLog.kt +0 -13
- package/ios/HybridRnIap.swift +30 -95
- package/ios/RnIapHelper.swift +37 -48
- package/ios/RnIapLog.swift +0 -11
- package/lib/module/hooks/useIAP.js +6 -11
- package/lib/module/hooks/useIAP.js.map +1 -1
- package/lib/module/index.js +64 -380
- package/lib/module/index.js.map +1 -1
- package/lib/module/index.kepler.js +7 -82
- package/lib/module/index.kepler.js.map +1 -1
- package/lib/module/types.js +5 -57
- package/lib/module/types.js.map +1 -1
- package/lib/module/utils/errorMapping.js +13 -21
- package/lib/module/utils/errorMapping.js.map +1 -1
- package/lib/module/utils/type-bridge.js +39 -77
- package/lib/module/utils/type-bridge.js.map +1 -1
- package/lib/module/utils.js +5 -1
- package/lib/module/utils.js.map +1 -1
- package/lib/module/vega-adapter.js +10 -48
- package/lib/module/vega-adapter.js.map +1 -1
- package/lib/typescript/src/hooks/useIAP.d.ts +1 -49
- package/lib/typescript/src/hooks/useIAP.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +6 -175
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/index.kepler.d.ts +2 -54
- package/lib/typescript/src/index.kepler.d.ts.map +1 -1
- package/lib/typescript/src/specs/RnIap.nitro.d.ts +32 -173
- package/lib/typescript/src/specs/RnIap.nitro.d.ts.map +1 -1
- package/lib/typescript/src/types.d.ts +76 -284
- package/lib/typescript/src/types.d.ts.map +1 -1
- package/lib/typescript/src/utils/errorMapping.d.ts.map +1 -1
- package/lib/typescript/src/utils/type-bridge.d.ts.map +1 -1
- package/lib/typescript/src/utils.d.ts.map +1 -1
- package/lib/typescript/src/vega-adapter.d.ts.map +1 -1
- package/nitrogen/generated/android/NitroIap+autolinking.cmake +5 -12
- package/nitrogen/generated/android/c++/JFunc_void_NitroProduct.hpp +0 -22
- package/nitrogen/generated/android/c++/JFunc_void_NitroPurchase.hpp +0 -2
- package/nitrogen/generated/android/c++/JHybridRnIapSpec.cpp +38 -189
- package/nitrogen/generated/android/c++/JHybridRnIapSpec.hpp +2 -9
- package/nitrogen/generated/android/c++/JInitConnectionConfig.hpp +1 -7
- package/nitrogen/generated/android/c++/JNitroActiveSubscription.hpp +1 -5
- package/nitrogen/generated/android/c++/JNitroAvailablePurchasesAndroidType.hpp +3 -3
- package/nitrogen/generated/android/c++/JNitroProduct.hpp +5 -39
- package/nitrogen/generated/android/c++/JNitroPurchase.hpp +25 -7
- package/nitrogen/generated/android/c++/JNitroPurchaseRequest.hpp +1 -9
- package/nitrogen/generated/android/c++/{JNitroReceiptValidationAppleOptions.hpp → JNitroPurchaseVerificationAppleOptions.hpp} +10 -10
- package/nitrogen/generated/android/c++/{JNitroReceiptValidationGoogleOptions.hpp → JNitroPurchaseVerificationGoogleOptions.hpp} +10 -10
- package/nitrogen/generated/android/c++/{JNitroReceiptValidationHorizonOptions.hpp → JNitroPurchaseVerificationHorizonOptions.hpp} +10 -10
- package/nitrogen/generated/android/c++/JNitroPurchaseVerificationParams.hpp +79 -0
- package/nitrogen/generated/android/c++/{JNitroReceiptValidationResultAndroid.hpp → JNitroPurchaseVerificationResultAndroid.hpp} +10 -10
- package/nitrogen/generated/android/c++/{JNitroReceiptValidationResultIOS.hpp → JNitroPurchaseVerificationResultIOS.hpp} +10 -12
- package/nitrogen/generated/android/c++/JNitroRenewalInfoIOS.hpp +19 -3
- package/nitrogen/generated/android/c++/JNitroRequestPurchaseAndroid.hpp +1 -6
- package/nitrogen/generated/android/c++/JProductType.hpp +3 -3
- package/nitrogen/generated/android/c++/JPurchase.hpp +0 -2
- package/nitrogen/generated/android/c++/JPurchaseAndroid.hpp +1 -7
- package/nitrogen/generated/android/c++/JPurchaseIOS.hpp +25 -7
- package/nitrogen/generated/android/c++/JPurchaseVerificationProvider.hpp +3 -3
- package/nitrogen/generated/android/c++/JRenewalInfoIOS.hpp +19 -3
- package/nitrogen/generated/android/c++/JRequestPurchaseResult.hpp +0 -2
- package/nitrogen/generated/android/c++/JVariant_NitroPurchaseVerificationResultIOS_NitroPurchaseVerificationResultAndroid.cpp +26 -0
- package/nitrogen/generated/android/c++/{JVariant_NitroReceiptValidationResultIOS_NitroReceiptValidationResultAndroid.hpp → JVariant_NitroPurchaseVerificationResultIOS_NitroPurchaseVerificationResultAndroid.hpp} +26 -28
- package/nitrogen/generated/android/c++/JVariant_NullType_InitConnectionConfig.hpp +1 -3
- package/nitrogen/generated/android/c++/JVariant_NullType_NitroProduct.hpp +0 -22
- package/nitrogen/generated/android/c++/JVariant_NullType_NitroPurchase.hpp +0 -2
- package/nitrogen/generated/android/c++/JVariant_NullType_NitroPurchaseVerificationAppleOptions.cpp +26 -0
- package/nitrogen/generated/android/c++/JVariant_NullType_NitroPurchaseVerificationAppleOptions.hpp +72 -0
- package/nitrogen/generated/android/c++/JVariant_NullType_NitroPurchaseVerificationGoogleOptions.cpp +26 -0
- package/nitrogen/generated/android/c++/JVariant_NullType_NitroPurchaseVerificationGoogleOptions.hpp +74 -0
- package/nitrogen/generated/android/c++/JVariant_NullType_NitroPurchaseVerificationHorizonOptions.cpp +26 -0
- package/nitrogen/generated/android/c++/JVariant_NullType_NitroPurchaseVerificationHorizonOptions.hpp +72 -0
- package/nitrogen/generated/android/c++/JVariant_NullType_NitroRequestPurchaseAndroid.hpp +0 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/HybridRnIapSpec.kt +2 -30
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/InitConnectionConfig.kt +3 -8
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroActiveSubscription.kt +2 -7
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroAvailablePurchasesAndroidType.kt +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroProduct.kt +5 -20
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroPurchase.kt +32 -7
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroPurchaseRequest.kt +3 -13
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/{NitroReceiptValidationAppleOptions.kt → NitroPurchaseVerificationAppleOptions.kt} +6 -6
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/{NitroReceiptValidationGoogleOptions.kt → NitroPurchaseVerificationGoogleOptions.kt} +6 -6
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/{NitroReceiptValidationHorizonOptions.kt → NitroPurchaseVerificationHorizonOptions.kt} +6 -6
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/{NitroReceiptValidationParams.kt → NitroPurchaseVerificationParams.kt} +9 -9
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/{NitroReceiptValidationResultAndroid.kt → NitroPurchaseVerificationResultAndroid.kt} +6 -6
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/{NitroReceiptValidationResultIOS.kt → NitroPurchaseVerificationResultIOS.kt} +6 -6
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroRenewalInfoIOS.kt +24 -4
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroRequestPurchaseAndroid.kt +2 -7
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/ProductType.kt +2 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/PurchaseAndroid.kt +2 -7
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/PurchaseIOS.kt +30 -5
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/PurchaseVerificationProvider.kt +2 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/RenewalInfoIOS.kt +24 -4
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/Variant_NitroPurchaseVerificationResultIOS_NitroPurchaseVerificationResultAndroid.kt +62 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/{Variant_NullType_NitroReceiptValidationGoogleOptions.kt → Variant_NullType_NitroPurchaseVerificationAppleOptions.kt} +9 -9
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/{Variant_NullType_Array_NitroOneTimePurchaseOfferDetail_.kt → Variant_NullType_NitroPurchaseVerificationGoogleOptions.kt} +9 -9
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/{Variant_NullType_NitroReceiptValidationAppleOptions.kt → Variant_NullType_NitroPurchaseVerificationHorizonOptions.kt} +9 -9
- package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Bridge.cpp +16 -16
- package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Bridge.hpp +212 -570
- package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Umbrella.hpp +18 -42
- package/nitrogen/generated/ios/c++/HybridRnIapSpecSwift.hpp +21 -101
- package/nitrogen/generated/ios/swift/Func_void_std__variant_NitroPurchaseVerificationResultIOS__NitroPurchaseVerificationResultAndroid_.swift +58 -0
- package/nitrogen/generated/ios/swift/HybridRnIapSpec.swift +2 -9
- package/nitrogen/generated/ios/swift/HybridRnIapSpec_cxx.swift +22 -181
- package/nitrogen/generated/ios/swift/InitConnectionConfig.swift +2 -13
- package/nitrogen/generated/ios/swift/NitroActiveSubscription.swift +1 -38
- package/nitrogen/generated/ios/swift/NitroAvailablePurchasesAndroidType.swift +4 -4
- package/nitrogen/generated/ios/swift/NitroProduct.swift +5 -122
- package/nitrogen/generated/ios/swift/NitroPurchase.swift +224 -7
- package/nitrogen/generated/ios/swift/NitroPurchaseRequest.swift +1 -75
- package/nitrogen/generated/ios/swift/{NitroReceiptValidationAppleOptions.swift → NitroPurchaseVerificationAppleOptions.swift} +5 -5
- package/nitrogen/generated/ios/swift/{NitroReceiptValidationGoogleOptions.swift → NitroPurchaseVerificationGoogleOptions.swift} +5 -5
- package/nitrogen/generated/ios/swift/{NitroReceiptValidationHorizonOptions.swift → NitroPurchaseVerificationHorizonOptions.swift} +5 -5
- package/nitrogen/generated/ios/swift/{NitroReceiptValidationParams.swift → NitroPurchaseVerificationParams.swift} +36 -36
- package/nitrogen/generated/ios/swift/{NitroReceiptValidationResultAndroid.swift → NitroPurchaseVerificationResultAndroid.swift} +5 -5
- package/nitrogen/generated/ios/swift/{NitroReceiptValidationResultIOS.swift → NitroPurchaseVerificationResultIOS.swift} +5 -5
- package/nitrogen/generated/ios/swift/NitroRenewalInfoIOS.swift +149 -1
- package/nitrogen/generated/ios/swift/NitroRequestPurchaseAndroid.swift +1 -38
- package/nitrogen/generated/ios/swift/ProductType.swift +4 -4
- package/nitrogen/generated/ios/swift/PurchaseAndroid.swift +2 -7
- package/nitrogen/generated/ios/swift/PurchaseIOS.swift +221 -4
- package/nitrogen/generated/ios/swift/PurchaseVerificationProvider.swift +4 -4
- package/nitrogen/generated/ios/swift/RenewalInfoIOS.swift +150 -2
- package/nitrogen/generated/ios/swift/{Variant_NitroReceiptValidationResultIOS_NitroReceiptValidationResultAndroid.swift → Variant_NitroPurchaseVerificationResultIOS_NitroPurchaseVerificationResultAndroid.swift} +5 -5
- package/nitrogen/generated/ios/swift/{Variant_NullType_NitroLimitedQuantityInfoAndroid.swift → Variant_NullType_NitroPurchaseVerificationAppleOptions.swift} +4 -4
- package/nitrogen/generated/ios/swift/{Variant_NullType_NitroReceiptValidationAppleOptions.swift → Variant_NullType_NitroPurchaseVerificationGoogleOptions.swift} +4 -4
- package/nitrogen/generated/ios/swift/{Variant_NullType_NitroPreorderDetailsAndroid.swift → Variant_NullType_NitroPurchaseVerificationHorizonOptions.swift} +4 -4
- package/nitrogen/generated/shared/c++/HybridRnIapSpec.cpp +1 -8
- package/nitrogen/generated/shared/c++/HybridRnIapSpec.hpp +11 -18
- package/nitrogen/generated/shared/c++/InitConnectionConfig.hpp +2 -9
- package/nitrogen/generated/shared/c++/NitroActiveSubscription.hpp +1 -5
- package/nitrogen/generated/shared/c++/NitroAvailablePurchasesAndroidType.hpp +4 -4
- package/nitrogen/generated/shared/c++/NitroProduct.hpp +6 -22
- package/nitrogen/generated/shared/c++/NitroPurchase.hpp +25 -8
- package/nitrogen/generated/shared/c++/NitroPurchaseRequest.hpp +2 -10
- package/nitrogen/generated/shared/c++/{NitroReceiptValidationAppleOptions.hpp → NitroPurchaseVerificationAppleOptions.hpp} +11 -11
- package/nitrogen/generated/shared/c++/{NitroReceiptValidationGoogleOptions.hpp → NitroPurchaseVerificationGoogleOptions.hpp} +11 -11
- package/nitrogen/generated/shared/c++/{NitroReceiptValidationHorizonOptions.hpp → NitroPurchaseVerificationHorizonOptions.hpp} +11 -11
- package/nitrogen/generated/shared/c++/NitroPurchaseVerificationParams.hpp +101 -0
- package/nitrogen/generated/shared/c++/{NitroReceiptValidationResultAndroid.hpp → NitroPurchaseVerificationResultAndroid.hpp} +11 -11
- package/nitrogen/generated/shared/c++/{NitroReceiptValidationResultIOS.hpp → NitroPurchaseVerificationResultIOS.hpp} +11 -11
- package/nitrogen/generated/shared/c++/NitroRenewalInfoIOS.hpp +18 -2
- package/nitrogen/generated/shared/c++/NitroRequestPurchaseAndroid.hpp +1 -5
- package/nitrogen/generated/shared/c++/ProductType.hpp +5 -5
- package/nitrogen/generated/shared/c++/PurchaseAndroid.hpp +1 -8
- package/nitrogen/generated/shared/c++/PurchaseIOS.hpp +25 -8
- package/nitrogen/generated/shared/c++/PurchaseVerificationProvider.hpp +5 -5
- package/nitrogen/generated/shared/c++/RenewalInfoIOS.hpp +18 -2
- package/openiap-versions.json +3 -3
- package/package.json +1 -1
- package/src/hooks/useIAP.ts +5 -76
- package/src/index.kepler.ts +11 -96
- package/src/index.ts +80 -458
- package/src/specs/RnIap.nitro.ts +35 -196
- package/src/types.ts +77 -295
- package/src/utils/errorMapping.ts +21 -20
- package/src/utils/type-bridge.ts +53 -90
- package/src/utils.ts +8 -0
- package/src/vega-adapter.ts +11 -59
- package/lib/module/utils/deprecation.js +0 -15
- package/lib/module/utils/deprecation.js.map +0 -1
- package/lib/module/utils/platform-request.js +0 -28
- package/lib/module/utils/platform-request.js.map +0 -1
- package/lib/typescript/src/utils/deprecation.d.ts +0 -3
- package/lib/typescript/src/utils/deprecation.d.ts.map +0 -1
- package/lib/typescript/src/utils/platform-request.d.ts +0 -12
- package/lib/typescript/src/utils/platform-request.d.ts.map +0 -1
- package/nitrogen/generated/android/c++/JAlternativeBillingModeAndroid.hpp +0 -61
- package/nitrogen/generated/android/c++/JNitroDiscountAmountAndroid.hpp +0 -61
- package/nitrogen/generated/android/c++/JNitroDiscountDisplayInfoAndroid.hpp +0 -69
- package/nitrogen/generated/android/c++/JNitroLimitedQuantityInfoAndroid.hpp +0 -61
- package/nitrogen/generated/android/c++/JNitroOneTimePurchaseOfferDetail.hpp +0 -148
- package/nitrogen/generated/android/c++/JNitroPreorderDetailsAndroid.hpp +0 -61
- package/nitrogen/generated/android/c++/JNitroReceiptValidationParams.hpp +0 -79
- package/nitrogen/generated/android/c++/JNitroRentalDetailsAndroid.hpp +0 -66
- package/nitrogen/generated/android/c++/JNitroValidTimeWindowAndroid.hpp +0 -61
- package/nitrogen/generated/android/c++/JVariant_NitroReceiptValidationResultIOS_NitroReceiptValidationResultAndroid.cpp +0 -26
- package/nitrogen/generated/android/c++/JVariant_NullType_Array_NitroOneTimePurchaseOfferDetail_.cpp +0 -35
- package/nitrogen/generated/android/c++/JVariant_NullType_Array_NitroOneTimePurchaseOfferDetail_.hpp +0 -103
- package/nitrogen/generated/android/c++/JVariant_NullType_NitroDiscountAmountAndroid.cpp +0 -26
- package/nitrogen/generated/android/c++/JVariant_NullType_NitroDiscountAmountAndroid.hpp +0 -72
- package/nitrogen/generated/android/c++/JVariant_NullType_NitroDiscountDisplayInfoAndroid.cpp +0 -26
- package/nitrogen/generated/android/c++/JVariant_NullType_NitroDiscountDisplayInfoAndroid.hpp +0 -77
- package/nitrogen/generated/android/c++/JVariant_NullType_NitroLimitedQuantityInfoAndroid.cpp +0 -26
- package/nitrogen/generated/android/c++/JVariant_NullType_NitroLimitedQuantityInfoAndroid.hpp +0 -71
- package/nitrogen/generated/android/c++/JVariant_NullType_NitroPreorderDetailsAndroid.cpp +0 -26
- package/nitrogen/generated/android/c++/JVariant_NullType_NitroPreorderDetailsAndroid.hpp +0 -72
- package/nitrogen/generated/android/c++/JVariant_NullType_NitroReceiptValidationAppleOptions.cpp +0 -26
- package/nitrogen/generated/android/c++/JVariant_NullType_NitroReceiptValidationAppleOptions.hpp +0 -72
- package/nitrogen/generated/android/c++/JVariant_NullType_NitroReceiptValidationGoogleOptions.cpp +0 -26
- package/nitrogen/generated/android/c++/JVariant_NullType_NitroReceiptValidationGoogleOptions.hpp +0 -74
- package/nitrogen/generated/android/c++/JVariant_NullType_NitroReceiptValidationHorizonOptions.cpp +0 -26
- package/nitrogen/generated/android/c++/JVariant_NullType_NitroReceiptValidationHorizonOptions.hpp +0 -72
- package/nitrogen/generated/android/c++/JVariant_NullType_NitroRentalDetailsAndroid.cpp +0 -26
- package/nitrogen/generated/android/c++/JVariant_NullType_NitroRentalDetailsAndroid.hpp +0 -74
- package/nitrogen/generated/android/c++/JVariant_NullType_NitroValidTimeWindowAndroid.cpp +0 -26
- package/nitrogen/generated/android/c++/JVariant_NullType_NitroValidTimeWindowAndroid.hpp +0 -72
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/AlternativeBillingModeAndroid.kt +0 -24
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroDiscountAmountAndroid.kt +0 -56
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroDiscountDisplayInfoAndroid.kt +0 -56
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroLimitedQuantityInfoAndroid.kt +0 -56
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroOneTimePurchaseOfferDetail.kt +0 -111
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroPreorderDetailsAndroid.kt +0 -56
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroRentalDetailsAndroid.kt +0 -56
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroValidTimeWindowAndroid.kt +0 -56
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/Variant_NitroReceiptValidationResultIOS_NitroReceiptValidationResultAndroid.kt +0 -62
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/Variant_NullType_NitroDiscountAmountAndroid.kt +0 -62
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/Variant_NullType_NitroDiscountDisplayInfoAndroid.kt +0 -62
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/Variant_NullType_NitroLimitedQuantityInfoAndroid.kt +0 -62
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/Variant_NullType_NitroPreorderDetailsAndroid.kt +0 -62
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/Variant_NullType_NitroReceiptValidationHorizonOptions.kt +0 -62
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/Variant_NullType_NitroRentalDetailsAndroid.kt +0 -62
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/Variant_NullType_NitroValidTimeWindowAndroid.kt +0 -62
- package/nitrogen/generated/ios/swift/AlternativeBillingModeAndroid.swift +0 -44
- package/nitrogen/generated/ios/swift/Func_void_std__variant_NitroReceiptValidationResultIOS__NitroReceiptValidationResultAndroid_.swift +0 -58
- package/nitrogen/generated/ios/swift/NitroDiscountAmountAndroid.swift +0 -34
- package/nitrogen/generated/ios/swift/NitroDiscountDisplayInfoAndroid.swift +0 -98
- package/nitrogen/generated/ios/swift/NitroLimitedQuantityInfoAndroid.swift +0 -34
- package/nitrogen/generated/ios/swift/NitroOneTimePurchaseOfferDetail.swift +0 -351
- package/nitrogen/generated/ios/swift/NitroPreorderDetailsAndroid.swift +0 -34
- package/nitrogen/generated/ios/swift/NitroRentalDetailsAndroid.swift +0 -66
- package/nitrogen/generated/ios/swift/NitroValidTimeWindowAndroid.swift +0 -34
- package/nitrogen/generated/ios/swift/Variant_NullType_NitroDiscountAmountAndroid.swift +0 -30
- package/nitrogen/generated/ios/swift/Variant_NullType_NitroDiscountDisplayInfoAndroid.swift +0 -30
- package/nitrogen/generated/ios/swift/Variant_NullType_NitroReceiptValidationGoogleOptions.swift +0 -30
- package/nitrogen/generated/ios/swift/Variant_NullType_NitroReceiptValidationHorizonOptions.swift +0 -30
- package/nitrogen/generated/ios/swift/Variant_NullType_NitroRentalDetailsAndroid.swift +0 -30
- package/nitrogen/generated/ios/swift/Variant_NullType_NitroValidTimeWindowAndroid.swift +0 -30
- package/nitrogen/generated/ios/swift/Variant_NullType__NitroOneTimePurchaseOfferDetail_.swift +0 -30
- package/nitrogen/generated/shared/c++/AlternativeBillingModeAndroid.hpp +0 -80
- package/nitrogen/generated/shared/c++/NitroDiscountAmountAndroid.hpp +0 -87
- package/nitrogen/generated/shared/c++/NitroDiscountDisplayInfoAndroid.hpp +0 -91
- package/nitrogen/generated/shared/c++/NitroLimitedQuantityInfoAndroid.hpp +0 -87
- package/nitrogen/generated/shared/c++/NitroOneTimePurchaseOfferDetail.hpp +0 -149
- package/nitrogen/generated/shared/c++/NitroPreorderDetailsAndroid.hpp +0 -87
- package/nitrogen/generated/shared/c++/NitroReceiptValidationParams.hpp +0 -101
- package/nitrogen/generated/shared/c++/NitroRentalDetailsAndroid.hpp +0 -90
- package/nitrogen/generated/shared/c++/NitroValidTimeWindowAndroid.hpp +0 -87
- package/src/utils/deprecation.ts +0 -16
- package/src/utils/platform-request.ts +0 -37
package/src/index.ts
CHANGED
|
@@ -7,9 +7,9 @@ import {NitroModules} from 'react-native-nitro-modules';
|
|
|
7
7
|
// Internal modules
|
|
8
8
|
import type {
|
|
9
9
|
NitroActiveSubscription,
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
NitroPurchaseVerificationParams,
|
|
11
|
+
NitroPurchaseVerificationResultIOS,
|
|
12
|
+
NitroPurchaseVerificationResultAndroid,
|
|
13
13
|
NitroPurchaseUpdatedListenerOptions,
|
|
14
14
|
NitroSubscriptionStatus,
|
|
15
15
|
RnIap,
|
|
@@ -57,8 +57,6 @@ import {
|
|
|
57
57
|
DUPLICATE_PURCHASE_CODE,
|
|
58
58
|
} from './utils/errorMapping';
|
|
59
59
|
import {RnIapConsole} from './utils/debug';
|
|
60
|
-
import {warnLegacyOnce} from './utils/deprecation';
|
|
61
|
-
import {selectCanonicalPlatformRequest} from './utils/platform-request';
|
|
62
60
|
import {getSuccessFromPurchaseVariant} from './utils/purchase';
|
|
63
61
|
import {parseAppTransactionPayload} from './utils';
|
|
64
62
|
import {getVegaIapModule, isVegaOS} from './vega';
|
|
@@ -93,16 +91,8 @@ export * from './types';
|
|
|
93
91
|
export * from './utils/error';
|
|
94
92
|
export * from './vega';
|
|
95
93
|
|
|
96
|
-
/**
|
|
97
|
-
|
|
98
|
-
*
|
|
99
|
-
* Compatibility note: the `'inapp'` member is deprecated. Use `'in-app'`
|
|
100
|
-
* instead; the alias will be removed in react-native-iap 16.0.0.
|
|
101
|
-
*/
|
|
102
|
-
export type ProductTypeInput = 'inapp' | 'in-app' | 'subs';
|
|
103
|
-
|
|
104
|
-
const LEGACY_INAPP_WARNING =
|
|
105
|
-
"[react-native-iap] `type: 'inapp'` is deprecated and will be removed in react-native-iap 16.0.0. Use 'in-app' instead.";
|
|
94
|
+
/** Product type accepted by public query and purchase helpers. */
|
|
95
|
+
export type ProductTypeInput = 'in-app' | 'subs';
|
|
106
96
|
|
|
107
97
|
type NitroPurchaseRequest = Parameters<RnIap['requestPurchase']>[0];
|
|
108
98
|
type NitroAvailablePurchasesOptions = NonNullable<
|
|
@@ -461,6 +451,13 @@ export const purchaseUpdatedListener = (
|
|
|
461
451
|
return;
|
|
462
452
|
}
|
|
463
453
|
|
|
454
|
+
// StoreKit-backed Nitro listener disposal can abort in iOS release builds
|
|
455
|
+
// when a native modal is being popped. Keep the singleton native listener
|
|
456
|
+
// attached for the app session and only remove the JS callback above.
|
|
457
|
+
if (Platform.OS === 'ios') {
|
|
458
|
+
return;
|
|
459
|
+
}
|
|
460
|
+
|
|
464
461
|
const token = receiveDuplicateTransactionUpdatesIOS
|
|
465
462
|
? purchaseUpdateDuplicateNativeToken
|
|
466
463
|
: purchaseUpdateNativeToken;
|
|
@@ -508,7 +505,19 @@ export const purchaseErrorListener = (
|
|
|
508
505
|
return {
|
|
509
506
|
remove: () => {
|
|
510
507
|
purchaseErrorJsListeners.delete(listener);
|
|
511
|
-
if (purchaseErrorJsListeners.size
|
|
508
|
+
if (purchaseErrorJsListeners.size > 0) {
|
|
509
|
+
return;
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
// Same iOS policy as purchaseUpdatedListener: releasing the stored
|
|
513
|
+
// native callback from a JS unsubscribe can race an in-flight dispatch
|
|
514
|
+
// snapshot on another thread. Keep the singleton attached; endConnection
|
|
515
|
+
// owns native disposal.
|
|
516
|
+
if (Platform.OS === 'ios') {
|
|
517
|
+
return;
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
if (purchaseErrorNativeAttached) {
|
|
512
521
|
try {
|
|
513
522
|
IAP.instance.removePurchaseErrorListener(purchaseErrorNativeHandler);
|
|
514
523
|
purchaseErrorNativeAttached = false;
|
|
@@ -887,8 +896,7 @@ export const fetchProducts: QueryField<'fetchProducts'> = async (request) => {
|
|
|
887
896
|
})),
|
|
888
897
|
);
|
|
889
898
|
|
|
890
|
-
//
|
|
891
|
-
// On Android, check subscriptionOfferDetailsAndroid to determine if it's a real subscription
|
|
899
|
+
// The major schema uses the canonical `type` discriminator on every store.
|
|
892
900
|
const productItems: Product[] = [];
|
|
893
901
|
const subscriptionItems: ProductSubscription[] = [];
|
|
894
902
|
|
|
@@ -899,39 +907,7 @@ export const fetchProducts: QueryField<'fetchProducts'> = async (request) => {
|
|
|
899
907
|
return;
|
|
900
908
|
}
|
|
901
909
|
|
|
902
|
-
|
|
903
|
-
// For Android, check if subscription items have actual offers
|
|
904
|
-
if (
|
|
905
|
-
isAndroidStoreRuntime() &&
|
|
906
|
-
item.platform === 'android' &&
|
|
907
|
-
item.type === 'subs'
|
|
908
|
-
) {
|
|
909
|
-
// TypeScript now knows this is ProductSubscriptionAndroid
|
|
910
|
-
const hasSubscriptionOffers =
|
|
911
|
-
item.subscriptionOfferDetailsAndroid &&
|
|
912
|
-
Array.isArray(item.subscriptionOfferDetailsAndroid) &&
|
|
913
|
-
item.subscriptionOfferDetailsAndroid.length > 0;
|
|
914
|
-
|
|
915
|
-
RnIapConsole.debug(
|
|
916
|
-
`[fetchProducts] ${item.id}: type=${item.type}, hasOffers=${hasSubscriptionOffers}`,
|
|
917
|
-
);
|
|
918
|
-
|
|
919
|
-
if (hasSubscriptionOffers) {
|
|
920
|
-
subscriptionItems.push(item);
|
|
921
|
-
} else {
|
|
922
|
-
// Treat as product if no offers - convert type
|
|
923
|
-
const {subscriptionOfferDetailsAndroid: _, ...productFields} =
|
|
924
|
-
item as any;
|
|
925
|
-
productItems.push({
|
|
926
|
-
...productFields,
|
|
927
|
-
type: 'in-app' as const,
|
|
928
|
-
} as Product);
|
|
929
|
-
}
|
|
930
|
-
} else if (item.platform === 'ios' && item.type === 'subs') {
|
|
931
|
-
// iOS: type field is reliable with discriminated unions
|
|
932
|
-
// TypeScript now knows this is ProductSubscriptionIOS
|
|
933
|
-
subscriptionItems.push(item);
|
|
934
|
-
}
|
|
910
|
+
subscriptionItems.push(item);
|
|
935
911
|
});
|
|
936
912
|
|
|
937
913
|
RnIapConsole.debug(
|
|
@@ -1044,7 +1020,7 @@ export const getAvailablePurchases: QueryField<
|
|
|
1044
1020
|
|
|
1045
1021
|
// For Android Play/Horizon/Fire OS, query in-app items and subscriptions separately.
|
|
1046
1022
|
const inappNitroPurchases = await IAP.instance.getAvailablePurchases({
|
|
1047
|
-
android: {type: '
|
|
1023
|
+
android: {type: 'in-app', includeSuspended},
|
|
1048
1024
|
});
|
|
1049
1025
|
const subsNitroPurchases = await IAP.instance.getAvailablePurchases({
|
|
1050
1026
|
android: {type: 'subs', includeSuspended},
|
|
@@ -1084,10 +1060,7 @@ export const getPromotedProductIOS: QueryField<
|
|
|
1084
1060
|
}
|
|
1085
1061
|
|
|
1086
1062
|
try {
|
|
1087
|
-
const nitroProduct =
|
|
1088
|
-
typeof IAP.instance.getPromotedProductIOS === 'function'
|
|
1089
|
-
? await IAP.instance.getPromotedProductIOS()
|
|
1090
|
-
: await IAP.instance.requestPromotedProductIOS();
|
|
1063
|
+
const nitroProduct = await IAP.instance.getPromotedProductIOS();
|
|
1091
1064
|
if (!nitroProduct) {
|
|
1092
1065
|
return null;
|
|
1093
1066
|
}
|
|
@@ -1107,47 +1080,6 @@ export const getPromotedProductIOS: QueryField<
|
|
|
1107
1080
|
}
|
|
1108
1081
|
};
|
|
1109
1082
|
|
|
1110
|
-
/**
|
|
1111
|
-
* @deprecated Use `getPromotedProductIOS` instead. This compatibility alias
|
|
1112
|
-
* will be removed in react-native-iap 16.0.0.
|
|
1113
|
-
*/
|
|
1114
|
-
export const requestPromotedProductIOS = getPromotedProductIOS;
|
|
1115
|
-
|
|
1116
|
-
/**
|
|
1117
|
-
* Get the storefront identifier for the user's App Store account (iOS only)
|
|
1118
|
-
* @returns Promise<string> - The storefront identifier (e.g., 'USA' for United States)
|
|
1119
|
-
* @platform iOS
|
|
1120
|
-
*
|
|
1121
|
-
* @example
|
|
1122
|
-
* ```typescript
|
|
1123
|
-
* const storefront = await getStorefrontIOS();
|
|
1124
|
-
* console.log('User storefront:', storefront); // e.g., 'USA', 'GBR', 'KOR'
|
|
1125
|
-
* ```
|
|
1126
|
-
*
|
|
1127
|
-
* @see {@link https://openiap.dev/docs/apis/ios/get-storefront-ios}
|
|
1128
|
-
* @deprecated Use `getStorefront` instead. Scheduled for removal in
|
|
1129
|
-
* react-native-iap 16.0.0.
|
|
1130
|
-
*/
|
|
1131
|
-
export const getStorefrontIOS: QueryField<'getStorefrontIOS'> = async () => {
|
|
1132
|
-
if (Platform.OS !== 'ios') {
|
|
1133
|
-
throw new Error('getStorefrontIOS is only available on iOS');
|
|
1134
|
-
}
|
|
1135
|
-
|
|
1136
|
-
try {
|
|
1137
|
-
const storefront = await IAP.instance.getStorefrontIOS();
|
|
1138
|
-
if (typeof storefront !== 'string' || storefront.trim().length === 0) {
|
|
1139
|
-
throw createPurchaseError({
|
|
1140
|
-
code: ErrorCode.ServiceError,
|
|
1141
|
-
message: 'Storefront lookup returned no country code.',
|
|
1142
|
-
});
|
|
1143
|
-
}
|
|
1144
|
-
return storefront;
|
|
1145
|
-
} catch (error) {
|
|
1146
|
-
RnIapConsole.error('Failed to get storefront:', error);
|
|
1147
|
-
throw error;
|
|
1148
|
-
}
|
|
1149
|
-
};
|
|
1150
|
-
|
|
1151
1083
|
/**
|
|
1152
1084
|
* Return the user's storefront country code.
|
|
1153
1085
|
*
|
|
@@ -1161,21 +1093,9 @@ export const getStorefront: QueryField<'getStorefront'> = async () => {
|
|
|
1161
1093
|
});
|
|
1162
1094
|
}
|
|
1163
1095
|
|
|
1164
|
-
const hasUnifiedMethod = typeof IAP.instance.getStorefront === 'function';
|
|
1165
|
-
|
|
1166
|
-
if (!hasUnifiedMethod && Platform.OS !== 'ios') {
|
|
1167
|
-
throw createPurchaseError({
|
|
1168
|
-
code: ErrorCode.FeatureNotSupported,
|
|
1169
|
-
message: 'Native getStorefront is not available on this build.',
|
|
1170
|
-
platform: 'android',
|
|
1171
|
-
});
|
|
1172
|
-
}
|
|
1173
|
-
|
|
1174
1096
|
let storefront: string | null | undefined;
|
|
1175
1097
|
try {
|
|
1176
|
-
storefront =
|
|
1177
|
-
? await IAP.instance.getStorefront()
|
|
1178
|
-
: await getStorefrontIOS();
|
|
1098
|
+
storefront = await IAP.instance.getStorefront();
|
|
1179
1099
|
} catch (error) {
|
|
1180
1100
|
const parsedError = parseErrorAndLogIfNeeded(
|
|
1181
1101
|
`[getStorefront] Failed to get storefront on ${Platform.OS}:`,
|
|
@@ -1309,7 +1229,7 @@ export const currentEntitlementIOS: QueryField<
|
|
|
1309
1229
|
const nitroPurchase = await IAP.instance.currentEntitlementIOS(sku);
|
|
1310
1230
|
if (nitroPurchase) {
|
|
1311
1231
|
const converted = convertNitroPurchaseToPurchase(nitroPurchase);
|
|
1312
|
-
return converted.
|
|
1232
|
+
return converted.store === 'apple' ? (converted as PurchaseIOS) : null;
|
|
1313
1233
|
}
|
|
1314
1234
|
return null;
|
|
1315
1235
|
} catch (error) {
|
|
@@ -1345,7 +1265,7 @@ export const latestTransactionIOS: QueryField<'latestTransactionIOS'> = async (
|
|
|
1345
1265
|
const nitroPurchase = await IAP.instance.latestTransactionIOS(sku);
|
|
1346
1266
|
if (nitroPurchase) {
|
|
1347
1267
|
const converted = convertNitroPurchaseToPurchase(nitroPurchase);
|
|
1348
|
-
return converted.
|
|
1268
|
+
return converted.store === 'apple' ? (converted as PurchaseIOS) : null;
|
|
1349
1269
|
}
|
|
1350
1270
|
return null;
|
|
1351
1271
|
} catch (error) {
|
|
@@ -1381,7 +1301,7 @@ export const getPendingTransactionsIOS: QueryField<
|
|
|
1381
1301
|
return nitroPurchases
|
|
1382
1302
|
.map(convertNitroPurchaseToPurchase)
|
|
1383
1303
|
.filter(
|
|
1384
|
-
(purchase): purchase is PurchaseIOS => purchase.
|
|
1304
|
+
(purchase): purchase is PurchaseIOS => purchase.store === 'apple',
|
|
1385
1305
|
);
|
|
1386
1306
|
} catch (error) {
|
|
1387
1307
|
const parsedError = parseErrorAndLogIfNeeded(
|
|
@@ -1414,7 +1334,7 @@ export const getAllTransactionsIOS: QueryField<
|
|
|
1414
1334
|
return nitroPurchases
|
|
1415
1335
|
.map(convertNitroPurchaseToPurchase)
|
|
1416
1336
|
.filter(
|
|
1417
|
-
(purchase): purchase is PurchaseIOS => purchase.
|
|
1337
|
+
(purchase): purchase is PurchaseIOS => purchase.store === 'apple',
|
|
1418
1338
|
);
|
|
1419
1339
|
} catch (error) {
|
|
1420
1340
|
const parsedError = parseErrorAndLogIfNeeded(
|
|
@@ -1449,7 +1369,7 @@ export const showManageSubscriptionsIOS: MutationField<
|
|
|
1449
1369
|
return nitroPurchases
|
|
1450
1370
|
.map(convertNitroPurchaseToPurchase)
|
|
1451
1371
|
.filter(
|
|
1452
|
-
(purchase): purchase is PurchaseIOS => purchase.
|
|
1372
|
+
(purchase): purchase is PurchaseIOS => purchase.store === 'apple',
|
|
1453
1373
|
);
|
|
1454
1374
|
} catch (error) {
|
|
1455
1375
|
const parsedError = parseErrorAndLogIfNeeded(
|
|
@@ -1530,44 +1450,6 @@ export const getReceiptDataIOS: QueryField<'getReceiptDataIOS'> = async () => {
|
|
|
1530
1450
|
}
|
|
1531
1451
|
};
|
|
1532
1452
|
|
|
1533
|
-
/**
|
|
1534
|
-
* Legacy alias for `getReceiptDataIOS`.
|
|
1535
|
-
*
|
|
1536
|
-
* @deprecated Use `getReceiptDataIOS` for the cumulative App Store receipt or
|
|
1537
|
-
* `getTransactionJwsIOS(productId)` for one transaction. This alias will be
|
|
1538
|
-
* removed in react-native-iap 16.0.0.
|
|
1539
|
-
*/
|
|
1540
|
-
export const getReceiptIOS = async (): Promise<string> => {
|
|
1541
|
-
if (Platform.OS !== 'ios') {
|
|
1542
|
-
throw new Error('getReceiptIOS is only available on iOS');
|
|
1543
|
-
}
|
|
1544
|
-
|
|
1545
|
-
RnIapConsole.warn(
|
|
1546
|
-
'[getReceiptIOS] is deprecated and will be removed in react-native-iap 16.0.0. ' +
|
|
1547
|
-
'Use getReceiptDataIOS() for the cumulative receipt. iOS receipts contain ALL transactions, not just the latest one. ' +
|
|
1548
|
-
'For individual purchase validation, use getTransactionJwsIOS(productId) instead. ' +
|
|
1549
|
-
'See: https://react-native-iap.hyo.dev/docs/guides/receipt-validation',
|
|
1550
|
-
);
|
|
1551
|
-
|
|
1552
|
-
try {
|
|
1553
|
-
if (typeof IAP.instance.getReceiptIOS === 'function') {
|
|
1554
|
-
return await IAP.instance.getReceiptIOS();
|
|
1555
|
-
}
|
|
1556
|
-
return await IAP.instance.getReceiptDataIOS();
|
|
1557
|
-
} catch (error) {
|
|
1558
|
-
const parsedError = parseErrorAndLogIfNeeded(
|
|
1559
|
-
'[getReceiptIOS] Failed:',
|
|
1560
|
-
error,
|
|
1561
|
-
);
|
|
1562
|
-
throw createPurchaseError({
|
|
1563
|
-
code: parsedError.code,
|
|
1564
|
-
message: parsedError.message,
|
|
1565
|
-
responseCode: parsedError.responseCode,
|
|
1566
|
-
debugMessage: parsedError.debugMessage,
|
|
1567
|
-
});
|
|
1568
|
-
}
|
|
1569
|
-
};
|
|
1570
|
-
|
|
1571
1453
|
export const requestReceiptRefreshIOS = async (): Promise<string> => {
|
|
1572
1454
|
if (Platform.OS !== 'ios') {
|
|
1573
1455
|
throw new Error('requestReceiptRefreshIOS is only available on iOS');
|
|
@@ -1809,11 +1691,9 @@ export const requestPurchase: MutationField<'requestPurchase'> = async (
|
|
|
1809
1691
|
}
|
|
1810
1692
|
|
|
1811
1693
|
const iosRequestSource =
|
|
1812
|
-
Platform.OS === 'ios'
|
|
1813
|
-
? selectApplePurchaseRequest(perPlatformRequest)
|
|
1814
|
-
: undefined;
|
|
1694
|
+
Platform.OS === 'ios' ? perPlatformRequest.apple : undefined;
|
|
1815
1695
|
const androidRequestSource = isAndroidStoreRuntime()
|
|
1816
|
-
?
|
|
1696
|
+
? perPlatformRequest.google
|
|
1817
1697
|
: undefined;
|
|
1818
1698
|
|
|
1819
1699
|
if (Platform.OS === 'ios') {
|
|
@@ -1922,9 +1802,6 @@ export const requestPurchase: MutationField<'requestPurchase'> = async (
|
|
|
1922
1802
|
androidPayload.originalExternalTransactionId =
|
|
1923
1803
|
subsRequest.originalExternalTransactionId;
|
|
1924
1804
|
}
|
|
1925
|
-
if (subsRequest.replacementMode != null) {
|
|
1926
|
-
androidPayload.replacementMode = subsRequest.replacementMode;
|
|
1927
|
-
}
|
|
1928
1805
|
if (subsRequest.subscriptionProductReplacementParams) {
|
|
1929
1806
|
androidPayload.subscriptionProductReplacementParams =
|
|
1930
1807
|
subsRequest.subscriptionProductReplacementParams;
|
|
@@ -2159,8 +2036,7 @@ export const openRedeemOfferCodeAndroid: MutationField<
|
|
|
2159
2036
|
// ============================================================================
|
|
2160
2037
|
|
|
2161
2038
|
/**
|
|
2162
|
-
*
|
|
2163
|
-
* @deprecated Use `verifyPurchase` instead. This function will be removed in react-native-iap 16.0.0.
|
|
2039
|
+
* Verify a purchase on iOS or Android.
|
|
2164
2040
|
* @param options - Platform-specific verification options
|
|
2165
2041
|
* @param options.apple - Apple App Store verification options (iOS)
|
|
2166
2042
|
* @param options.google - Google Play verification options (Android)
|
|
@@ -2184,7 +2060,7 @@ export const openRedeemOfferCodeAndroid: MutationField<
|
|
|
2184
2060
|
*
|
|
2185
2061
|
* @see {@link https://openiap.dev/docs/apis/validate-receipt}
|
|
2186
2062
|
*/
|
|
2187
|
-
export const
|
|
2063
|
+
export const verifyPurchase: MutationField<'verifyPurchase'> = async (
|
|
2188
2064
|
options,
|
|
2189
2065
|
) => {
|
|
2190
2066
|
const {apple, google, horizon} = options;
|
|
@@ -2223,7 +2099,7 @@ export const validateReceipt: MutationField<'validateReceipt'> = async (
|
|
|
2223
2099
|
}
|
|
2224
2100
|
}
|
|
2225
2101
|
|
|
2226
|
-
const params:
|
|
2102
|
+
const params: NitroPurchaseVerificationParams = {
|
|
2227
2103
|
apple: apple?.sku
|
|
2228
2104
|
? {
|
|
2229
2105
|
sku: apple.sku,
|
|
@@ -2252,11 +2128,11 @@ export const validateReceipt: MutationField<'validateReceipt'> = async (
|
|
|
2252
2128
|
: null,
|
|
2253
2129
|
};
|
|
2254
2130
|
|
|
2255
|
-
const nitroResult = await IAP.instance.
|
|
2131
|
+
const nitroResult = await IAP.instance.verifyPurchase(params);
|
|
2256
2132
|
|
|
2257
2133
|
// Convert Nitro result to public API result
|
|
2258
2134
|
if (Platform.OS === 'ios') {
|
|
2259
|
-
const iosResult = nitroResult as
|
|
2135
|
+
const iosResult = nitroResult as NitroPurchaseVerificationResultIOS;
|
|
2260
2136
|
const result: VerifyPurchaseResultIOS = {
|
|
2261
2137
|
isValid: iosResult.isValid,
|
|
2262
2138
|
receiptData: iosResult.receiptData,
|
|
@@ -2268,7 +2144,8 @@ export const validateReceipt: MutationField<'validateReceipt'> = async (
|
|
|
2268
2144
|
return result;
|
|
2269
2145
|
} else {
|
|
2270
2146
|
// Android
|
|
2271
|
-
const androidResult =
|
|
2147
|
+
const androidResult =
|
|
2148
|
+
nitroResult as NitroPurchaseVerificationResultAndroid;
|
|
2272
2149
|
const result: VerifyPurchaseResultAndroid = {
|
|
2273
2150
|
autoRenewing: androidResult.autoRenewing,
|
|
2274
2151
|
betaProduct: androidResult.betaProduct,
|
|
@@ -2293,7 +2170,7 @@ export const validateReceipt: MutationField<'validateReceipt'> = async (
|
|
|
2293
2170
|
}
|
|
2294
2171
|
} catch (error) {
|
|
2295
2172
|
const parsedError = parseErrorAndLogIfNeeded(
|
|
2296
|
-
'[
|
|
2173
|
+
'[verifyPurchase] Failed:',
|
|
2297
2174
|
error,
|
|
2298
2175
|
);
|
|
2299
2176
|
throw createPurchaseError({
|
|
@@ -2305,38 +2182,6 @@ export const validateReceipt: MutationField<'validateReceipt'> = async (
|
|
|
2305
2182
|
}
|
|
2306
2183
|
};
|
|
2307
2184
|
|
|
2308
|
-
/**
|
|
2309
|
-
* Verify purchase with the configured providers
|
|
2310
|
-
*
|
|
2311
|
-
* This function uses the native OpenIAP verifyPurchase implementation
|
|
2312
|
-
* which validates purchases using platform-specific methods.
|
|
2313
|
-
* This is an alias for validateReceipt for API consistency with OpenIAP.
|
|
2314
|
-
*
|
|
2315
|
-
* @param options - Receipt validation options containing the SKU
|
|
2316
|
-
* @returns Promise resolving to receipt validation result
|
|
2317
|
-
*
|
|
2318
|
-
* @see {@link https://openiap.dev/docs/features/validation#verify-purchase}
|
|
2319
|
-
*/
|
|
2320
|
-
export const verifyPurchase: MutationField<'verifyPurchase'> = validateReceipt;
|
|
2321
|
-
|
|
2322
|
-
/**
|
|
2323
|
-
* iOS-only receipt validation alias.
|
|
2324
|
-
*
|
|
2325
|
-
* @deprecated Use `verifyPurchase` instead. This compatibility alias will be
|
|
2326
|
-
* removed in react-native-iap 16.0.0. Throws on non-iOS platforms.
|
|
2327
|
-
*
|
|
2328
|
-
* @see {@link https://openiap.dev/docs/apis/ios/validate-receipt-ios}
|
|
2329
|
-
*/
|
|
2330
|
-
export const validateReceiptIOS: QueryField<'validateReceiptIOS'> = async (
|
|
2331
|
-
options,
|
|
2332
|
-
) => {
|
|
2333
|
-
if (Platform.OS !== 'ios') {
|
|
2334
|
-
throw new Error('validateReceiptIOS is only available on iOS');
|
|
2335
|
-
}
|
|
2336
|
-
const result = await validateReceipt(options);
|
|
2337
|
-
return result as VerifyPurchaseResultIOS;
|
|
2338
|
-
};
|
|
2339
|
-
|
|
2340
2185
|
/**
|
|
2341
2186
|
* Verify purchase with a specific provider (e.g., IAPKit)
|
|
2342
2187
|
*
|
|
@@ -2440,7 +2285,8 @@ export const syncIOS: MutationField<'syncIOS'> = async () => {
|
|
|
2440
2285
|
|
|
2441
2286
|
/**
|
|
2442
2287
|
* Present the code redemption sheet for offer codes (iOS only)
|
|
2443
|
-
* @returns
|
|
2288
|
+
* @returns The verified redeemed purchase on iOS 27+, or null after the
|
|
2289
|
+
* legacy sheet is presented on earlier iOS versions.
|
|
2444
2290
|
* @platform iOS
|
|
2445
2291
|
*
|
|
2446
2292
|
* @see {@link https://openiap.dev/docs/apis/ios/present-code-redemption-sheet-ios}
|
|
@@ -2449,12 +2295,18 @@ export const presentCodeRedemptionSheetIOS: MutationField<
|
|
|
2449
2295
|
'presentCodeRedemptionSheetIOS'
|
|
2450
2296
|
> = async () => {
|
|
2451
2297
|
if (Platform.OS !== 'ios') {
|
|
2452
|
-
return
|
|
2298
|
+
return null;
|
|
2453
2299
|
}
|
|
2454
2300
|
|
|
2455
2301
|
try {
|
|
2456
2302
|
const result = await IAP.instance.presentCodeRedemptionSheetIOS();
|
|
2457
|
-
|
|
2303
|
+
if (result == null) {
|
|
2304
|
+
return null;
|
|
2305
|
+
}
|
|
2306
|
+
if (!validateNitroPurchase(result)) {
|
|
2307
|
+
throw new Error('Invalid redeemed purchase returned by native StoreKit');
|
|
2308
|
+
}
|
|
2309
|
+
return convertNitroPurchaseToPurchase(result) as PurchaseIOS;
|
|
2458
2310
|
} catch (error) {
|
|
2459
2311
|
const parsedError = parseErrorAndLogIfNeeded(
|
|
2460
2312
|
'[presentCodeRedemptionSheetIOS] Failed:',
|
|
@@ -2469,55 +2321,6 @@ export const presentCodeRedemptionSheetIOS: MutationField<
|
|
|
2469
2321
|
}
|
|
2470
2322
|
};
|
|
2471
2323
|
|
|
2472
|
-
/**
|
|
2473
|
-
* Buy promoted product on iOS
|
|
2474
|
-
* @deprecated In StoreKit 2, promoted products can be purchased directly via
|
|
2475
|
-
* the standard `requestPurchase()` flow. This alias will be removed in
|
|
2476
|
-
* react-native-iap 16.0.0.
|
|
2477
|
-
* Use `promotedProductListenerIOS` to receive the product ID when a user taps a promoted product,
|
|
2478
|
-
* then call `requestPurchase()` with the received SKU directly.
|
|
2479
|
-
*
|
|
2480
|
-
* @example
|
|
2481
|
-
* ```typescript
|
|
2482
|
-
* // Recommended approach
|
|
2483
|
-
* promotedProductListenerIOS(async (product) => {
|
|
2484
|
-
* await requestPurchase({
|
|
2485
|
-
* request: { apple: { sku: product.id } },
|
|
2486
|
-
* type: 'in-app'
|
|
2487
|
-
* });
|
|
2488
|
-
* });
|
|
2489
|
-
* ```
|
|
2490
|
-
*
|
|
2491
|
-
* @returns Promise<boolean> - true when the request triggers successfully
|
|
2492
|
-
* @platform iOS
|
|
2493
|
-
*
|
|
2494
|
-
* @see {@link https://openiap.dev/docs/apis/ios/request-purchase-on-promoted-product-ios}
|
|
2495
|
-
*/
|
|
2496
|
-
export const requestPurchaseOnPromotedProductIOS: MutationField<
|
|
2497
|
-
'requestPurchaseOnPromotedProductIOS'
|
|
2498
|
-
> = async () => {
|
|
2499
|
-
if (Platform.OS !== 'ios') {
|
|
2500
|
-
throw new Error(
|
|
2501
|
-
'requestPurchaseOnPromotedProductIOS is only available on iOS',
|
|
2502
|
-
);
|
|
2503
|
-
}
|
|
2504
|
-
|
|
2505
|
-
try {
|
|
2506
|
-
return await IAP.instance.buyPromotedProductIOS();
|
|
2507
|
-
} catch (error) {
|
|
2508
|
-
const parsedError = parseErrorAndLogIfNeeded(
|
|
2509
|
-
'[requestPurchaseOnPromotedProductIOS] Failed:',
|
|
2510
|
-
error,
|
|
2511
|
-
);
|
|
2512
|
-
throw createPurchaseError({
|
|
2513
|
-
code: parsedError.code,
|
|
2514
|
-
message: parsedError.message,
|
|
2515
|
-
responseCode: parsedError.responseCode,
|
|
2516
|
-
debugMessage: parsedError.debugMessage,
|
|
2517
|
-
});
|
|
2518
|
-
}
|
|
2519
|
-
};
|
|
2520
|
-
|
|
2521
2324
|
/**
|
|
2522
2325
|
* Clear unfinished transactions on iOS
|
|
2523
2326
|
* @returns Promise<boolean>
|
|
@@ -2673,7 +2476,6 @@ export const getActiveSubscriptions: QueryField<
|
|
|
2673
2476
|
// iOS specific fields
|
|
2674
2477
|
expirationDateIOS: sub.expirationDateIOS ?? null,
|
|
2675
2478
|
environmentIOS: sub.environmentIOS ?? null,
|
|
2676
|
-
willExpireSoon: sub.willExpireSoon ?? null,
|
|
2677
2479
|
daysUntilExpirationIOS: sub.daysUntilExpirationIOS ?? null,
|
|
2678
2480
|
// renewalInfoIOS contains subscription lifecycle information on iOS.
|
|
2679
2481
|
renewalInfoIOS: sub.renewalInfoIOS
|
|
@@ -2681,6 +2483,12 @@ export const getActiveSubscriptions: QueryField<
|
|
|
2681
2483
|
willAutoRenew: sub.renewalInfoIOS.willAutoRenew ?? false,
|
|
2682
2484
|
autoRenewPreference:
|
|
2683
2485
|
sub.renewalInfoIOS.autoRenewPreference ?? null,
|
|
2486
|
+
bundleOriginalTransactionId:
|
|
2487
|
+
sub.renewalInfoIOS.bundleOriginalTransactionId ?? null,
|
|
2488
|
+
bundleProductId:
|
|
2489
|
+
sub.renewalInfoIOS.bundleProductId ?? null,
|
|
2490
|
+
bundleSubscriptionGroupId:
|
|
2491
|
+
sub.renewalInfoIOS.bundleSubscriptionGroupId ?? null,
|
|
2684
2492
|
commitmentInfo: sub.renewalInfoIOS.commitmentInfo ?? null,
|
|
2685
2493
|
pendingUpgradeProductId:
|
|
2686
2494
|
sub.renewalInfoIOS.pendingUpgradeProductId ?? null,
|
|
@@ -2696,6 +2504,7 @@ export const getActiveSubscriptions: QueryField<
|
|
|
2696
2504
|
renewalOfferType: sub.renewalInfoIOS.renewalOfferType ?? null,
|
|
2697
2505
|
renewalOfferId: sub.renewalInfoIOS.renewalOfferId ?? null,
|
|
2698
2506
|
jsonRepresentation: sub.renewalInfoIOS.jsonRepresentation ?? null,
|
|
2507
|
+
willUnbundle: sub.renewalInfoIOS.willUnbundle ?? null,
|
|
2699
2508
|
}
|
|
2700
2509
|
: null,
|
|
2701
2510
|
// Android specific fields
|
|
@@ -2757,19 +2566,6 @@ export {
|
|
|
2757
2566
|
checkTypeSynchronization,
|
|
2758
2567
|
} from './utils/type-bridge';
|
|
2759
2568
|
|
|
2760
|
-
// Deprecated exports for backward compatibility
|
|
2761
|
-
/**
|
|
2762
|
-
* @deprecated Use acknowledgePurchaseAndroid instead. This alias will be
|
|
2763
|
-
* removed in react-native-iap 16.0.0.
|
|
2764
|
-
*/
|
|
2765
|
-
export const acknowledgePurchase = acknowledgePurchaseAndroid;
|
|
2766
|
-
|
|
2767
|
-
/**
|
|
2768
|
-
* @deprecated Use consumePurchaseAndroid instead. This alias will be removed
|
|
2769
|
-
* in react-native-iap 16.0.0.
|
|
2770
|
-
*/
|
|
2771
|
-
export const consumePurchase = consumePurchaseAndroid;
|
|
2772
|
-
|
|
2773
2569
|
// ============================================================================
|
|
2774
2570
|
// Internal Helpers
|
|
2775
2571
|
// ============================================================================
|
|
@@ -2778,42 +2574,6 @@ type NitroDiscountOfferRecord = NonNullable<
|
|
|
2778
2574
|
NonNullable<NitroPurchaseRequest['apple']>['withOffer']
|
|
2779
2575
|
>;
|
|
2780
2576
|
|
|
2781
|
-
const selectApplePurchaseRequest = (
|
|
2782
|
-
request:
|
|
2783
|
-
RequestPurchasePropsByPlatforms | RequestSubscriptionPropsByPlatforms,
|
|
2784
|
-
): RequestPurchaseIosProps | RequestSubscriptionIosProps | null | undefined => {
|
|
2785
|
-
const selection = selectCanonicalPlatformRequest<
|
|
2786
|
-
RequestPurchaseIosProps | RequestSubscriptionIosProps
|
|
2787
|
-
>(request, 'apple', 'ios');
|
|
2788
|
-
if (selection.usesLegacyKey && selection.value != null) {
|
|
2789
|
-
warnLegacyOnce(
|
|
2790
|
-
'request-purchase.ios',
|
|
2791
|
-
'[react-native-iap] `request.ios` is deprecated and will be removed in react-native-iap 16.0.0. Use `request.apple` instead.',
|
|
2792
|
-
);
|
|
2793
|
-
}
|
|
2794
|
-
return selection.value;
|
|
2795
|
-
};
|
|
2796
|
-
|
|
2797
|
-
const selectGooglePurchaseRequest = (
|
|
2798
|
-
request:
|
|
2799
|
-
RequestPurchasePropsByPlatforms | RequestSubscriptionPropsByPlatforms,
|
|
2800
|
-
):
|
|
2801
|
-
| RequestPurchaseAndroidProps
|
|
2802
|
-
| RequestSubscriptionAndroidProps
|
|
2803
|
-
| null
|
|
2804
|
-
| undefined => {
|
|
2805
|
-
const selection = selectCanonicalPlatformRequest<
|
|
2806
|
-
RequestPurchaseAndroidProps | RequestSubscriptionAndroidProps
|
|
2807
|
-
>(request, 'google', 'android');
|
|
2808
|
-
if (selection.usesLegacyKey && selection.value != null) {
|
|
2809
|
-
warnLegacyOnce(
|
|
2810
|
-
'request-purchase.android',
|
|
2811
|
-
'[react-native-iap] `request.android` is deprecated and will be removed in react-native-iap 16.0.0. Use `request.google` instead.',
|
|
2812
|
-
);
|
|
2813
|
-
}
|
|
2814
|
-
return selection.value;
|
|
2815
|
-
};
|
|
2816
|
-
|
|
2817
2577
|
const toDiscountOfferRecordIOS = (
|
|
2818
2578
|
offer: DiscountOfferInputIOS | null | undefined,
|
|
2819
2579
|
): NitroDiscountOfferRecord | undefined => {
|
|
@@ -2832,17 +2592,18 @@ const toDiscountOfferRecordIOS = (
|
|
|
2832
2592
|
const toNitroProductType = (
|
|
2833
2593
|
type?: ProductTypeInput | ProductQueryType | null,
|
|
2834
2594
|
): 'in-app' | 'subs' | 'all' => {
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2595
|
+
switch (type) {
|
|
2596
|
+
case 'in-app':
|
|
2597
|
+
return 'in-app';
|
|
2598
|
+
case 'subs':
|
|
2599
|
+
return 'subs';
|
|
2600
|
+
case 'all':
|
|
2601
|
+
return 'all';
|
|
2602
|
+
default:
|
|
2603
|
+
throw new Error(
|
|
2604
|
+
`Unsupported product type: ${String(type)}. Use in-app, subs, or all.`,
|
|
2605
|
+
);
|
|
2844
2606
|
}
|
|
2845
|
-
return 'in-app';
|
|
2846
2607
|
};
|
|
2847
2608
|
|
|
2848
2609
|
const isSubscriptionQuery = (type?: ProductQueryType | null): boolean =>
|
|
@@ -2851,156 +2612,17 @@ const isSubscriptionQuery = (type?: ProductQueryType | null): boolean =>
|
|
|
2851
2612
|
const normalizeProductQueryType = (
|
|
2852
2613
|
type?: ProductQueryType | string | null,
|
|
2853
2614
|
): ProductQueryType => {
|
|
2854
|
-
if (type
|
|
2855
|
-
return
|
|
2856
|
-
}
|
|
2857
|
-
|
|
2858
|
-
if (typeof type === 'string') {
|
|
2859
|
-
const normalized = type.trim().toLowerCase().replace(/_/g, '-');
|
|
2860
|
-
|
|
2861
|
-
if (normalized === 'all') {
|
|
2862
|
-
return 'all';
|
|
2863
|
-
}
|
|
2864
|
-
if (normalized === 'subs') {
|
|
2865
|
-
return 'subs';
|
|
2866
|
-
}
|
|
2867
|
-
if (normalized === 'inapp') {
|
|
2868
|
-
warnLegacyOnce('product-type.inapp', LEGACY_INAPP_WARNING);
|
|
2869
|
-
return 'in-app';
|
|
2870
|
-
}
|
|
2871
|
-
if (normalized === 'in-app') {
|
|
2872
|
-
return 'in-app';
|
|
2873
|
-
}
|
|
2874
|
-
}
|
|
2875
|
-
return 'in-app';
|
|
2876
|
-
};
|
|
2877
|
-
|
|
2878
|
-
// ============================================================================
|
|
2879
|
-
// ALTERNATIVE BILLING APIs
|
|
2880
|
-
// ============================================================================
|
|
2881
|
-
|
|
2882
|
-
// ------------------------------
|
|
2883
|
-
// Android Alternative Billing
|
|
2884
|
-
// ------------------------------
|
|
2885
|
-
|
|
2886
|
-
/**
|
|
2887
|
-
* Check if alternative billing is available for this user/device (Android only).
|
|
2888
|
-
* Step 1 of alternative billing flow.
|
|
2889
|
-
*
|
|
2890
|
-
* @returns Promise<boolean> - true if available, false otherwise
|
|
2891
|
-
* @throws Error if billing client not ready
|
|
2892
|
-
* @platform Android
|
|
2893
|
-
*
|
|
2894
|
-
* @example
|
|
2895
|
-
* ```typescript
|
|
2896
|
-
* const isAvailable = await checkAlternativeBillingAvailabilityAndroid();
|
|
2897
|
-
* if (isAvailable) {
|
|
2898
|
-
* // Proceed with alternative billing flow
|
|
2899
|
-
* }
|
|
2900
|
-
* ```
|
|
2901
|
-
*
|
|
2902
|
-
* @see {@link https://openiap.dev/docs/apis/android/check-alternative-billing-availability-android}
|
|
2903
|
-
* @deprecated Use `isBillingProgramAvailableAndroid('external-offer')`
|
|
2904
|
-
* instead. Scheduled for removal in react-native-iap 16.0.0.
|
|
2905
|
-
*/
|
|
2906
|
-
export const checkAlternativeBillingAvailabilityAndroid: MutationField<
|
|
2907
|
-
'checkAlternativeBillingAvailabilityAndroid'
|
|
2908
|
-
> = async () => {
|
|
2909
|
-
if (Platform.OS !== 'android') {
|
|
2910
|
-
throw new Error('Alternative billing is only supported on Android');
|
|
2911
|
-
}
|
|
2912
|
-
try {
|
|
2913
|
-
return await IAP.instance.checkAlternativeBillingAvailabilityAndroid();
|
|
2914
|
-
} catch (error) {
|
|
2915
|
-
RnIapConsole.error(
|
|
2916
|
-
'Failed to check alternative billing availability:',
|
|
2917
|
-
error,
|
|
2918
|
-
);
|
|
2919
|
-
throw error;
|
|
2615
|
+
if (type == null) {
|
|
2616
|
+
return 'in-app';
|
|
2920
2617
|
}
|
|
2921
|
-
};
|
|
2922
2618
|
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
* Step 2 of alternative billing flow.
|
|
2926
|
-
* Must be called BEFORE processing payment in your payment system.
|
|
2927
|
-
*
|
|
2928
|
-
* @returns Promise<boolean> - true if user accepted, false if user canceled
|
|
2929
|
-
* @throws Error if billing client not ready
|
|
2930
|
-
* @platform Android
|
|
2931
|
-
*
|
|
2932
|
-
* @example
|
|
2933
|
-
* ```typescript
|
|
2934
|
-
* const userAccepted = await showAlternativeBillingDialogAndroid();
|
|
2935
|
-
* if (userAccepted) {
|
|
2936
|
-
* // Process payment in your payment system
|
|
2937
|
-
* const success = await processCustomPayment();
|
|
2938
|
-
* if (success) {
|
|
2939
|
-
* // Create reporting token
|
|
2940
|
-
* const token = await createAlternativeBillingTokenAndroid();
|
|
2941
|
-
* // Send token to your backend for Google Play reporting
|
|
2942
|
-
* }
|
|
2943
|
-
* }
|
|
2944
|
-
* ```
|
|
2945
|
-
*
|
|
2946
|
-
* @see {@link https://openiap.dev/docs/apis/android/show-alternative-billing-dialog-android}
|
|
2947
|
-
* @deprecated Use `launchExternalLinkAndroid` instead. Scheduled for removal in
|
|
2948
|
-
* react-native-iap 16.0.0.
|
|
2949
|
-
*/
|
|
2950
|
-
export const showAlternativeBillingDialogAndroid: MutationField<
|
|
2951
|
-
'showAlternativeBillingDialogAndroid'
|
|
2952
|
-
> = async () => {
|
|
2953
|
-
if (Platform.OS !== 'android') {
|
|
2954
|
-
throw new Error('Alternative billing is only supported on Android');
|
|
2955
|
-
}
|
|
2956
|
-
try {
|
|
2957
|
-
return await IAP.instance.showAlternativeBillingDialogAndroid();
|
|
2958
|
-
} catch (error) {
|
|
2959
|
-
RnIapConsole.error('Failed to show alternative billing dialog:', error);
|
|
2960
|
-
throw error;
|
|
2619
|
+
if (type === 'all' || type === 'subs' || type === 'in-app') {
|
|
2620
|
+
return type;
|
|
2961
2621
|
}
|
|
2962
|
-
};
|
|
2963
2622
|
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
* Must be called AFTER successful payment in your payment system.
|
|
2968
|
-
* Token must be reported to Google Play backend within 24 hours.
|
|
2969
|
-
*
|
|
2970
|
-
* @param sku - Optional product SKU that was purchased
|
|
2971
|
-
* @returns Promise<string | null> - Token string or null if creation failed
|
|
2972
|
-
* @throws Error if billing client not ready
|
|
2973
|
-
* @platform Android
|
|
2974
|
-
*
|
|
2975
|
-
* @example
|
|
2976
|
-
* ```typescript
|
|
2977
|
-
* const token = await createAlternativeBillingTokenAndroid('premium_subscription');
|
|
2978
|
-
* if (token) {
|
|
2979
|
-
* // Send token to your backend
|
|
2980
|
-
* await fetch('/api/report-transaction', {
|
|
2981
|
-
* method: 'POST',
|
|
2982
|
-
* body: JSON.stringify({ token, sku: 'premium_subscription' })
|
|
2983
|
-
* });
|
|
2984
|
-
* }
|
|
2985
|
-
* ```
|
|
2986
|
-
*
|
|
2987
|
-
* @see {@link https://openiap.dev/docs/apis/android/create-alternative-billing-token-android}
|
|
2988
|
-
* @deprecated Use
|
|
2989
|
-
* `createBillingProgramReportingDetailsAndroid('external-offer')` instead.
|
|
2990
|
-
* Scheduled for removal in react-native-iap 16.0.0.
|
|
2991
|
-
*/
|
|
2992
|
-
export const createAlternativeBillingTokenAndroid: MutationField<
|
|
2993
|
-
'createAlternativeBillingTokenAndroid'
|
|
2994
|
-
> = async (sku?: string) => {
|
|
2995
|
-
if (Platform.OS !== 'android') {
|
|
2996
|
-
throw new Error('Alternative billing is only supported on Android');
|
|
2997
|
-
}
|
|
2998
|
-
try {
|
|
2999
|
-
return await IAP.instance.createAlternativeBillingTokenAndroid(sku ?? null);
|
|
3000
|
-
} catch (error) {
|
|
3001
|
-
RnIapConsole.error('Failed to create alternative billing token:', error);
|
|
3002
|
-
throw error;
|
|
3003
|
-
}
|
|
2623
|
+
throw new Error(
|
|
2624
|
+
`Unsupported product type: ${String(type)}. Use in-app, subs, or all.`,
|
|
2625
|
+
);
|
|
3004
2626
|
};
|
|
3005
2627
|
|
|
3006
2628
|
/**
|