react-native-iap 15.4.0-rc.3 → 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.
- package/README.md +23 -25
- package/android/src/main/java/com/margelo/nitro/iap/HybridRnIap.kt +250 -168
- package/android/src/main/java/com/margelo/nitro/iap/ProductSerialization.kt +98 -0
- package/ios/HybridRnIap.swift +19 -1
- package/ios/RnIapHelper.swift +30 -2
- package/lib/module/hooks/useIAP.js +19 -3
- package/lib/module/hooks/useIAP.js.map +1 -1
- package/lib/module/index.js +104 -18
- package/lib/module/index.js.map +1 -1
- package/lib/module/index.kepler.js +3 -0
- package/lib/module/index.kepler.js.map +1 -1
- package/lib/module/types.js +67 -6
- package/lib/module/types.js.map +1 -1
- package/lib/module/utils/type-bridge.js +22 -3
- package/lib/module/utils/type-bridge.js.map +1 -1
- package/lib/module/vega-adapter.js +24 -2
- package/lib/module/vega-adapter.js.map +1 -1
- package/lib/typescript/src/hooks/useIAP.d.ts +25 -2
- package/lib/typescript/src/hooks/useIAP.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +50 -10
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/index.kepler.d.ts +3 -0
- package/lib/typescript/src/index.kepler.d.ts.map +1 -1
- package/lib/typescript/src/specs/RnIap.nitro.d.ts +79 -9
- package/lib/typescript/src/specs/RnIap.nitro.d.ts.map +1 -1
- package/lib/typescript/src/types.d.ts +223 -35
- package/lib/typescript/src/types.d.ts.map +1 -1
- package/lib/typescript/src/utils/type-bridge.d.ts.map +1 -1
- package/lib/typescript/src/vega-adapter.d.ts.map +1 -1
- package/nitrogen/generated/android/NitroIap+autolinking.cmake +3 -0
- package/nitrogen/generated/android/c++/JBillingChoiceImageLayoutAndroid.hpp +61 -0
- package/nitrogen/generated/android/c++/JBillingChoiceScreenTypeAndroid.hpp +61 -0
- package/nitrogen/generated/android/c++/JBillingProgramAndroid.hpp +3 -0
- package/nitrogen/generated/android/c++/JDeveloperBillingLaunchModeAndroid.hpp +61 -0
- package/nitrogen/generated/android/c++/JDeveloperBillingOptionParamsAndroid.hpp +78 -0
- package/nitrogen/generated/android/c++/JDeveloperBillingTypeAndroid.hpp +61 -0
- package/nitrogen/generated/android/c++/JDeveloperProvidedBillingDetailsAndroid.hpp +45 -5
- package/nitrogen/generated/android/c++/JDeveloperProvidedBillingProductAndroid.hpp +72 -0
- package/nitrogen/generated/android/c++/JFunc_void_DeveloperProvidedBillingDetailsAndroid.hpp +10 -0
- package/nitrogen/generated/android/c++/JHybridRnIapSpec.cpp +118 -3
- package/nitrogen/generated/android/c++/JHybridRnIapSpec.hpp +4 -1
- package/nitrogen/generated/android/c++/JInAppMessageCategoryAndroid.hpp +58 -0
- package/nitrogen/generated/android/c++/JInAppMessageResponseCodeAndroid.hpp +58 -0
- package/nitrogen/generated/android/c++/JInitConnectionConfig.hpp +7 -1
- package/nitrogen/generated/android/c++/JNitroBillingChoiceInfoAndroid.hpp +66 -0
- package/nitrogen/generated/android/c++/JNitroBillingProgramAvailabilityResultAndroid.hpp +18 -3
- package/nitrogen/generated/android/c++/JNitroBillingProgramInformationDialogParamsAndroid.hpp +63 -0
- package/nitrogen/generated/android/c++/JNitroBillingResultAndroid.hpp +72 -0
- package/nitrogen/generated/android/c++/JNitroGetBillingChoiceInfoParamsAndroid.hpp +74 -0
- package/nitrogen/generated/android/c++/JNitroInAppMessageParamsAndroid.hpp +64 -0
- package/nitrogen/generated/android/c++/JNitroInAppMessageResultAndroid.hpp +68 -0
- package/nitrogen/generated/android/c++/JNitroLaunchExternalLinkParamsAndroid.hpp +10 -1
- package/nitrogen/generated/android/c++/JNitroOneTimePurchaseOfferDetail.hpp +5 -1
- package/nitrogen/generated/android/c++/JNitroProduct.hpp +13 -1
- package/nitrogen/generated/android/c++/JNitroPurchaseRequest.hpp +7 -0
- package/nitrogen/generated/android/c++/JNitroRequestPurchaseAndroid.hpp +16 -1
- package/nitrogen/generated/android/c++/JProductType.hpp +58 -0
- package/nitrogen/generated/android/c++/JSubResponseCodeAndroid.hpp +61 -0
- package/nitrogen/generated/android/c++/JVariant_NullType_Array_InAppMessageCategoryAndroid_.cpp +35 -0
- package/nitrogen/generated/android/c++/JVariant_NullType_Array_InAppMessageCategoryAndroid_.hpp +81 -0
- package/nitrogen/generated/android/c++/JVariant_NullType_DeveloperBillingOptionParamsAndroid.cpp +26 -0
- package/nitrogen/generated/android/c++/JVariant_NullType_DeveloperBillingOptionParamsAndroid.hpp +78 -0
- package/nitrogen/generated/android/c++/JVariant_NullType_InitConnectionConfig.hpp +2 -0
- package/nitrogen/generated/android/c++/JVariant_NullType_NitroInAppMessageParamsAndroid.cpp +26 -0
- package/nitrogen/generated/android/c++/JVariant_NullType_NitroInAppMessageParamsAndroid.hpp +76 -0
- package/nitrogen/generated/android/c++/JVariant_NullType_NitroRequestPurchaseAndroid.hpp +7 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/BillingChoiceImageLayoutAndroid.kt +24 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/BillingChoiceScreenTypeAndroid.kt +24 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/BillingProgramAndroid.kt +2 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/DeveloperBillingLaunchModeAndroid.kt +24 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/DeveloperBillingOptionParamsAndroid.kt +47 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/DeveloperBillingTypeAndroid.kt +24 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/DeveloperProvidedBillingDetailsAndroid.kt +13 -4
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/DeveloperProvidedBillingProductAndroid.kt +44 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/HybridRnIapSpec.kt +13 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/InAppMessageCategoryAndroid.kt +23 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/InAppMessageResponseCodeAndroid.kt +23 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/InitConnectionConfig.kt +5 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroBillingChoiceInfoAndroid.kt +41 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroBillingProgramAvailabilityResultAndroid.kt +10 -4
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroBillingProgramInformationDialogParamsAndroid.kt +41 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroBillingResultAndroid.kt +44 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroGetBillingChoiceInfoParamsAndroid.kt +44 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroInAppMessageParamsAndroid.kt +38 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroInAppMessageResultAndroid.kt +41 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroLaunchExternalLinkParamsAndroid.kt +6 -3
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroOneTimePurchaseOfferDetail.kt +5 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroProduct.kt +11 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroRequestPurchaseAndroid.kt +8 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/ProductType.kt +23 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/SubResponseCodeAndroid.kt +24 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/Variant_NullType_Array_InAppMessageCategoryAndroid_.kt +53 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/Variant_NullType_DeveloperBillingOptionParamsAndroid.kt +53 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/Variant_NullType_NitroInAppMessageParamsAndroid.kt +53 -0
- package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Bridge.cpp +24 -0
- package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Bridge.hpp +382 -0
- package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Umbrella.hpp +48 -0
- package/nitrogen/generated/ios/c++/HybridRnIapSpecSwift.hpp +74 -2
- package/nitrogen/generated/ios/swift/BillingChoiceImageLayoutAndroid.swift +44 -0
- package/nitrogen/generated/ios/swift/BillingChoiceScreenTypeAndroid.swift +44 -0
- package/nitrogen/generated/ios/swift/BillingProgramAndroid.swift +4 -0
- package/nitrogen/generated/ios/swift/DeveloperBillingLaunchModeAndroid.swift +44 -0
- package/nitrogen/generated/ios/swift/DeveloperBillingOptionParamsAndroid.swift +114 -0
- package/nitrogen/generated/ios/swift/DeveloperBillingTypeAndroid.swift +44 -0
- package/nitrogen/generated/ios/swift/DeveloperProvidedBillingDetailsAndroid.swift +121 -4
- package/nitrogen/generated/ios/swift/DeveloperProvidedBillingProductAndroid.swift +71 -0
- package/nitrogen/generated/ios/swift/Func_void_NitroBillingChoiceInfoAndroid.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_NitroBillingResultAndroid.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_NitroInAppMessageResultAndroid.swift +46 -0
- package/nitrogen/generated/ios/swift/HybridRnIapSpec.swift +4 -1
- package/nitrogen/generated/ios/swift/HybridRnIapSpec_cxx.swift +78 -2
- package/nitrogen/generated/ios/swift/InAppMessageCategoryAndroid.swift +40 -0
- package/nitrogen/generated/ios/swift/InAppMessageResponseCodeAndroid.swift +40 -0
- package/nitrogen/generated/ios/swift/InitConnectionConfig.swift +12 -1
- package/nitrogen/generated/ios/swift/NitroBillingChoiceInfoAndroid.swift +66 -0
- package/nitrogen/generated/ios/swift/NitroBillingProgramAvailabilityResultAndroid.swift +50 -2
- package/nitrogen/generated/ios/swift/NitroBillingProgramInformationDialogParamsAndroid.swift +34 -0
- package/nitrogen/generated/ios/swift/NitroBillingResultAndroid.swift +77 -0
- package/nitrogen/generated/ios/swift/NitroGetBillingChoiceInfoParamsAndroid.swift +71 -0
- package/nitrogen/generated/ios/swift/NitroInAppMessageParamsAndroid.swift +67 -0
- package/nitrogen/generated/ios/swift/NitroInAppMessageResultAndroid.swift +66 -0
- package/nitrogen/generated/ios/swift/NitroLaunchExternalLinkParamsAndroid.swift +39 -2
- package/nitrogen/generated/ios/swift/NitroOneTimePurchaseOfferDetail.swift +39 -2
- package/nitrogen/generated/ios/swift/NitroProduct.swift +113 -2
- package/nitrogen/generated/ios/swift/NitroRequestPurchaseAndroid.swift +75 -1
- package/nitrogen/generated/ios/swift/ProductType.swift +40 -0
- package/nitrogen/generated/ios/swift/SubResponseCodeAndroid.swift +44 -0
- package/nitrogen/generated/ios/swift/Variant_NullType_DeveloperBillingOptionParamsAndroid.swift +18 -0
- package/nitrogen/generated/ios/swift/Variant_NullType_NitroInAppMessageParamsAndroid.swift +18 -0
- package/nitrogen/generated/ios/swift/Variant_NullType__InAppMessageCategoryAndroid_.swift +18 -0
- package/nitrogen/generated/shared/c++/BillingChoiceImageLayoutAndroid.hpp +80 -0
- package/nitrogen/generated/shared/c++/BillingChoiceScreenTypeAndroid.hpp +80 -0
- package/nitrogen/generated/shared/c++/BillingProgramAndroid.hpp +4 -0
- package/nitrogen/generated/shared/c++/DeveloperBillingLaunchModeAndroid.hpp +80 -0
- package/nitrogen/generated/shared/c++/DeveloperBillingOptionParamsAndroid.hpp +103 -0
- package/nitrogen/generated/shared/c++/DeveloperBillingTypeAndroid.hpp +80 -0
- package/nitrogen/generated/shared/c++/DeveloperProvidedBillingDetailsAndroid.hpp +24 -6
- package/nitrogen/generated/shared/c++/DeveloperProvidedBillingProductAndroid.hpp +96 -0
- package/nitrogen/generated/shared/c++/HybridRnIapSpec.cpp +3 -0
- package/nitrogen/generated/shared/c++/HybridRnIapSpec.hpp +25 -1
- package/nitrogen/generated/shared/c++/InAppMessageCategoryAndroid.hpp +76 -0
- package/nitrogen/generated/shared/c++/InAppMessageResponseCodeAndroid.hpp +76 -0
- package/nitrogen/generated/shared/c++/InitConnectionConfig.hpp +8 -1
- package/nitrogen/generated/shared/c++/NitroBillingChoiceInfoAndroid.hpp +90 -0
- package/nitrogen/generated/shared/c++/NitroBillingProgramAvailabilityResultAndroid.hpp +16 -2
- package/nitrogen/generated/shared/c++/NitroBillingProgramInformationDialogParamsAndroid.hpp +89 -0
- package/nitrogen/generated/shared/c++/NitroBillingResultAndroid.hpp +96 -0
- package/nitrogen/generated/shared/c++/NitroGetBillingChoiceInfoParamsAndroid.hpp +99 -0
- package/nitrogen/generated/shared/c++/NitroInAppMessageParamsAndroid.hpp +88 -0
- package/nitrogen/generated/shared/c++/NitroInAppMessageResultAndroid.hpp +92 -0
- package/nitrogen/generated/shared/c++/NitroLaunchExternalLinkParamsAndroid.hpp +9 -2
- package/nitrogen/generated/shared/c++/NitroOneTimePurchaseOfferDetail.hpp +5 -1
- package/nitrogen/generated/shared/c++/NitroProduct.hpp +13 -1
- package/nitrogen/generated/shared/c++/NitroRequestPurchaseAndroid.hpp +12 -1
- package/nitrogen/generated/shared/c++/ProductType.hpp +76 -0
- package/nitrogen/generated/shared/c++/SubResponseCodeAndroid.hpp +80 -0
- package/openiap-versions.json +3 -3
- package/package.json +1 -1
- package/src/hooks/useIAP.ts +63 -0
- package/src/index.kepler.ts +9 -0
- package/src/index.ts +223 -95
- package/src/specs/RnIap.nitro.ts +116 -8
- package/src/types.ts +238 -35
- package/src/utils/type-bridge.ts +26 -2
- package/src/vega-adapter.ts +46 -11
package/src/index.ts
CHANGED
|
@@ -18,11 +18,6 @@ import {ErrorCode} from './types';
|
|
|
18
18
|
import type {
|
|
19
19
|
AndroidSubscriptionOfferInput,
|
|
20
20
|
DiscountOfferInputIOS,
|
|
21
|
-
ExternalPurchaseCustomLinkNoticeResultIOS,
|
|
22
|
-
ExternalPurchaseCustomLinkNoticeTypeIOS,
|
|
23
|
-
ExternalPurchaseCustomLinkTokenResultIOS,
|
|
24
|
-
ExternalPurchaseCustomLinkTokenTypeIOS,
|
|
25
|
-
ExternalPurchaseNoticeResultIOS,
|
|
26
21
|
FetchProductsResult,
|
|
27
22
|
MutationField,
|
|
28
23
|
Product,
|
|
@@ -73,7 +68,17 @@ import {getVegaIapModule, isVegaOS} from './vega';
|
|
|
73
68
|
// Note: BillingProgramAndroid, ExternalLinkLaunchModeAndroid, and ExternalLinkTypeAndroid
|
|
74
69
|
// are exported from './types' (auto-generated from openiap-gql).
|
|
75
70
|
// Import them here for use in this file's interfaces and functions.
|
|
76
|
-
import type {
|
|
71
|
+
import type {
|
|
72
|
+
BillingChoiceInfoAndroid,
|
|
73
|
+
BillingProgramAndroid,
|
|
74
|
+
BillingProgramInformationDialogParamsAndroid,
|
|
75
|
+
BillingProgramReportingDetailsAndroid,
|
|
76
|
+
BillingResultAndroid,
|
|
77
|
+
DeveloperBillingTypeAndroid,
|
|
78
|
+
GetBillingChoiceInfoParamsAndroid,
|
|
79
|
+
InAppMessageParamsAndroid,
|
|
80
|
+
InAppMessageResultAndroid,
|
|
81
|
+
} from './types';
|
|
77
82
|
|
|
78
83
|
// Export all types
|
|
79
84
|
export type {
|
|
@@ -621,12 +626,11 @@ export const userChoiceBillingListenerAndroid = (
|
|
|
621
626
|
};
|
|
622
627
|
|
|
623
628
|
/**
|
|
624
|
-
* Add a listener for developer provided billing events (Android 8.3.0+
|
|
625
|
-
* Fires
|
|
629
|
+
* Add a listener for developer provided billing events (Android 8.3.0+).
|
|
630
|
+
* Fires for External Payments and Billing Choice developer billing flows.
|
|
626
631
|
*
|
|
627
|
-
*
|
|
628
|
-
*
|
|
629
|
-
* external payment option directly in the purchase flow. (Japan only)
|
|
632
|
+
* The payload includes selected products and nullable token, link, and original
|
|
633
|
+
* transaction fields. Billing Choice fields require Billing Library 9.1.0+.
|
|
630
634
|
*
|
|
631
635
|
* @param listener - Function to call when user chooses developer billing
|
|
632
636
|
* @returns EventSubscription with remove() method to unsubscribe
|
|
@@ -636,14 +640,10 @@ export const userChoiceBillingListenerAndroid = (
|
|
|
636
640
|
* @example
|
|
637
641
|
* ```typescript
|
|
638
642
|
* const subscription = developerProvidedBillingListenerAndroid((details) => {
|
|
639
|
-
*
|
|
640
|
-
*
|
|
641
|
-
*
|
|
642
|
-
*
|
|
643
|
-
* await processExternalPayment();
|
|
644
|
-
*
|
|
645
|
-
* // Report transaction to Google Play (within 24 hours)
|
|
646
|
-
* await reportToGooglePlay(details.externalTransactionToken);
|
|
643
|
+
* await processExternalPayment(details.products, details.linkUri);
|
|
644
|
+
* if (details.externalTransactionToken) {
|
|
645
|
+
* await reportToGooglePlay(details.externalTransactionToken);
|
|
646
|
+
* }
|
|
647
647
|
* });
|
|
648
648
|
*
|
|
649
649
|
* // Later, remove the listener
|
|
@@ -854,8 +854,7 @@ export const fetchProducts: QueryField<'fetchProducts'> = async (request) => {
|
|
|
854
854
|
|
|
855
855
|
if (normalizedType === 'all') {
|
|
856
856
|
const converted = (await fetchAndConvert('all')) as (
|
|
857
|
-
|
|
|
858
|
-
| ProductSubscription
|
|
857
|
+
Product | ProductSubscription
|
|
859
858
|
)[];
|
|
860
859
|
|
|
861
860
|
RnIapConsole.debug(
|
|
@@ -1621,6 +1620,10 @@ export const getTransactionJwsIOS: QueryField<'getTransactionJwsIOS'> = async (
|
|
|
1621
1620
|
* ```ts
|
|
1622
1621
|
* await initConnection();
|
|
1623
1622
|
* await initConnection({ enableBillingProgramAndroid: 'external-offer' });
|
|
1623
|
+
* await initConnection({
|
|
1624
|
+
* enableBillingProgramAndroid: 'billing-choice',
|
|
1625
|
+
* billingChoiceScreenTypeAndroid: 'developer-rendered',
|
|
1626
|
+
* });
|
|
1624
1627
|
* ```
|
|
1625
1628
|
*
|
|
1626
1629
|
* @remarks When using `useIAP()`, connection is auto-managed on mount/unmount —
|
|
@@ -1843,6 +1846,10 @@ export const requestPurchase: MutationField<'requestPurchase'> = async (
|
|
|
1843
1846
|
if (androidRequest.isOfferPersonalized != null) {
|
|
1844
1847
|
androidPayload.isOfferPersonalized = androidRequest.isOfferPersonalized;
|
|
1845
1848
|
}
|
|
1849
|
+
if (androidRequest.developerBillingOption) {
|
|
1850
|
+
androidPayload.developerBillingOption =
|
|
1851
|
+
androidRequest.developerBillingOption;
|
|
1852
|
+
}
|
|
1846
1853
|
|
|
1847
1854
|
// One-time purchase offerToken (Android 7.0+)
|
|
1848
1855
|
if (!isSubs) {
|
|
@@ -1857,6 +1864,10 @@ export const requestPurchase: MutationField<'requestPurchase'> = async (
|
|
|
1857
1864
|
if (subsRequest.purchaseToken) {
|
|
1858
1865
|
androidPayload.purchaseToken = subsRequest.purchaseToken;
|
|
1859
1866
|
}
|
|
1867
|
+
if (subsRequest.originalExternalTransactionId) {
|
|
1868
|
+
androidPayload.originalExternalTransactionId =
|
|
1869
|
+
subsRequest.originalExternalTransactionId;
|
|
1870
|
+
}
|
|
1860
1871
|
if (subsRequest.replacementMode != null) {
|
|
1861
1872
|
androidPayload.replacementMode = subsRequest.replacementMode;
|
|
1862
1873
|
}
|
|
@@ -2394,41 +2405,42 @@ export const presentCodeRedemptionSheetIOS: MutationField<
|
|
|
2394
2405
|
*
|
|
2395
2406
|
* @see {@link https://openiap.dev/docs/apis/ios/request-purchase-on-promoted-product-ios}
|
|
2396
2407
|
*/
|
|
2397
|
-
export const requestPurchaseOnPromotedProductIOS
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
try {
|
|
2406
|
-
await IAP.instance.buyPromotedProductIOS();
|
|
2407
|
-
const pending = await IAP.instance.getPendingTransactionsIOS();
|
|
2408
|
-
const latest = pending.find((purchase) => purchase != null);
|
|
2409
|
-
if (!latest) {
|
|
2410
|
-
throw new Error('No promoted purchase available after request');
|
|
2411
|
-
}
|
|
2408
|
+
export const requestPurchaseOnPromotedProductIOS: MutationField<
|
|
2409
|
+
'requestPurchaseOnPromotedProductIOS'
|
|
2410
|
+
> = async () => {
|
|
2411
|
+
if (Platform.OS !== 'ios') {
|
|
2412
|
+
throw new Error(
|
|
2413
|
+
'requestPurchaseOnPromotedProductIOS is only available on iOS',
|
|
2414
|
+
);
|
|
2415
|
+
}
|
|
2412
2416
|
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
+
try {
|
|
2418
|
+
await IAP.instance.buyPromotedProductIOS();
|
|
2419
|
+
const pending = await IAP.instance.getPendingTransactionsIOS();
|
|
2420
|
+
const latest = pending.find((purchase) => purchase != null);
|
|
2421
|
+
if (!latest) {
|
|
2422
|
+
throw new Error('No promoted purchase available after request');
|
|
2423
|
+
}
|
|
2417
2424
|
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
'[requestPurchaseOnPromotedProductIOS] Failed:',
|
|
2422
|
-
error,
|
|
2423
|
-
);
|
|
2424
|
-
throw createPurchaseError({
|
|
2425
|
-
code: parsedError.code,
|
|
2426
|
-
message: parsedError.message,
|
|
2427
|
-
responseCode: parsedError.responseCode,
|
|
2428
|
-
debugMessage: parsedError.debugMessage,
|
|
2429
|
-
});
|
|
2425
|
+
const converted = convertNitroPurchaseToPurchase(latest);
|
|
2426
|
+
if (converted.platform !== 'ios') {
|
|
2427
|
+
throw new Error('Promoted purchase result not available for iOS');
|
|
2430
2428
|
}
|
|
2431
|
-
|
|
2429
|
+
|
|
2430
|
+
return true;
|
|
2431
|
+
} catch (error) {
|
|
2432
|
+
const parsedError = parseErrorAndLogIfNeeded(
|
|
2433
|
+
'[requestPurchaseOnPromotedProductIOS] Failed:',
|
|
2434
|
+
error,
|
|
2435
|
+
);
|
|
2436
|
+
throw createPurchaseError({
|
|
2437
|
+
code: parsedError.code,
|
|
2438
|
+
message: parsedError.message,
|
|
2439
|
+
responseCode: parsedError.responseCode,
|
|
2440
|
+
debugMessage: parsedError.debugMessage,
|
|
2441
|
+
});
|
|
2442
|
+
}
|
|
2443
|
+
};
|
|
2432
2444
|
|
|
2433
2445
|
/**
|
|
2434
2446
|
* Clear unfinished transactions on iOS
|
|
@@ -2925,7 +2937,9 @@ export const isBillingProgramAvailableAndroid: MutationField<
|
|
|
2925
2937
|
const result = await IAP.instance.isBillingProgramAvailableAndroid(program);
|
|
2926
2938
|
return {
|
|
2927
2939
|
billingProgram: result.billingProgram as unknown as BillingProgramAndroid,
|
|
2940
|
+
choiceScreenType: result.choiceScreenType,
|
|
2928
2941
|
isAvailable: result.isAvailable,
|
|
2942
|
+
isExternalLinkAvailable: result.isExternalLinkAvailable,
|
|
2929
2943
|
};
|
|
2930
2944
|
} catch (error) {
|
|
2931
2945
|
RnIapConsole.error('Failed to check billing program availability:', error);
|
|
@@ -2933,6 +2947,37 @@ export const isBillingProgramAvailableAndroid: MutationField<
|
|
|
2933
2947
|
}
|
|
2934
2948
|
};
|
|
2935
2949
|
|
|
2950
|
+
/**
|
|
2951
|
+
* Fetch Play Billing assets and loyalty text for developer-rendered Billing Choice screens (Android only).
|
|
2952
|
+
*
|
|
2953
|
+
* @param params - Billing Choice info request parameters
|
|
2954
|
+
* @returns Promise with Play-hosted image URL and optional loyalty information
|
|
2955
|
+
* @platform Android
|
|
2956
|
+
* @since Google Play Billing Library 9.1.0+
|
|
2957
|
+
*
|
|
2958
|
+
* @see {@link https://openiap.dev/docs/apis/android/get-billing-choice-info-android}
|
|
2959
|
+
*/
|
|
2960
|
+
export const getBillingChoiceInfoAndroid: QueryField<
|
|
2961
|
+
'getBillingChoiceInfoAndroid'
|
|
2962
|
+
> = async (
|
|
2963
|
+
params: GetBillingChoiceInfoParamsAndroid = {},
|
|
2964
|
+
): Promise<BillingChoiceInfoAndroid> => {
|
|
2965
|
+
if (Platform.OS !== 'android') {
|
|
2966
|
+
throw new Error('Billing Choice API is only supported on Android');
|
|
2967
|
+
}
|
|
2968
|
+
try {
|
|
2969
|
+
return await IAP.instance.getBillingChoiceInfoAndroid({
|
|
2970
|
+
billingProgram: params.billingProgram ?? 'billing-choice',
|
|
2971
|
+
playBillingChoiceImageLayout:
|
|
2972
|
+
params.playBillingChoiceImageLayout ?? 'rectangular-four-by-one',
|
|
2973
|
+
userLocale: params.userLocale ?? null,
|
|
2974
|
+
});
|
|
2975
|
+
} catch (error) {
|
|
2976
|
+
RnIapConsole.error('Failed to get Billing Choice info:', error);
|
|
2977
|
+
throw error;
|
|
2978
|
+
}
|
|
2979
|
+
};
|
|
2980
|
+
|
|
2936
2981
|
/**
|
|
2937
2982
|
* Create billing program reporting details for external transactions (Android only).
|
|
2938
2983
|
* Used to get the external transaction token needed for reporting to Google.
|
|
@@ -2954,15 +2999,34 @@ export const isBillingProgramAvailableAndroid: MutationField<
|
|
|
2954
2999
|
*
|
|
2955
3000
|
* @see {@link https://openiap.dev/docs/apis/android/create-billing-program-reporting-details-android}
|
|
2956
3001
|
*/
|
|
2957
|
-
export const createBillingProgramReportingDetailsAndroid: MutationField<
|
|
2958
|
-
|
|
2959
|
-
|
|
3002
|
+
export const createBillingProgramReportingDetailsAndroid: MutationField<'createBillingProgramReportingDetailsAndroid'> &
|
|
3003
|
+
((
|
|
3004
|
+
program: BillingProgramAndroid,
|
|
3005
|
+
developerBillingType?: DeveloperBillingTypeAndroid | null,
|
|
3006
|
+
) => Promise<BillingProgramReportingDetailsAndroid>) = async (
|
|
3007
|
+
programOrArgs:
|
|
3008
|
+
| BillingProgramAndroid
|
|
3009
|
+
| {
|
|
3010
|
+
program: BillingProgramAndroid;
|
|
3011
|
+
developerBillingType?: DeveloperBillingTypeAndroid | null;
|
|
3012
|
+
},
|
|
3013
|
+
developerBillingType?: DeveloperBillingTypeAndroid | null,
|
|
3014
|
+
): Promise<BillingProgramReportingDetailsAndroid> => {
|
|
2960
3015
|
if (Platform.OS !== 'android') {
|
|
2961
3016
|
throw new Error('Billing Programs API is only supported on Android');
|
|
2962
3017
|
}
|
|
2963
3018
|
try {
|
|
3019
|
+
const program =
|
|
3020
|
+
typeof programOrArgs === 'string' ? programOrArgs : programOrArgs.program;
|
|
3021
|
+
const resolvedDeveloperBillingType =
|
|
3022
|
+
typeof programOrArgs === 'string'
|
|
3023
|
+
? developerBillingType
|
|
3024
|
+
: (programOrArgs.developerBillingType ?? developerBillingType);
|
|
2964
3025
|
const result =
|
|
2965
|
-
await IAP.instance.createBillingProgramReportingDetailsAndroid(
|
|
3026
|
+
await IAP.instance.createBillingProgramReportingDetailsAndroid(
|
|
3027
|
+
program,
|
|
3028
|
+
resolvedDeveloperBillingType ?? null,
|
|
3029
|
+
);
|
|
2966
3030
|
return {
|
|
2967
3031
|
billingProgram: result.billingProgram as unknown as BillingProgramAndroid,
|
|
2968
3032
|
externalTransactionToken: result.externalTransactionToken,
|
|
@@ -2977,7 +3041,67 @@ export const createBillingProgramReportingDetailsAndroid: MutationField<
|
|
|
2977
3041
|
};
|
|
2978
3042
|
|
|
2979
3043
|
/**
|
|
2980
|
-
*
|
|
3044
|
+
* Show Google's mandatory information dialog before a developer-rendered,
|
|
3045
|
+
* in-app Billing Choice screen (Android only).
|
|
3046
|
+
*
|
|
3047
|
+
* @param params - Dialog parameters with the external transaction token
|
|
3048
|
+
* @returns Promise with BillingResult
|
|
3049
|
+
* @platform Android
|
|
3050
|
+
* @since Google Play Billing Library 9.1.0+
|
|
3051
|
+
*
|
|
3052
|
+
* @see {@link https://openiap.dev/docs/apis/android/show-billing-program-information-dialog-android}
|
|
3053
|
+
*/
|
|
3054
|
+
export const showBillingProgramInformationDialogAndroid: MutationField<
|
|
3055
|
+
'showBillingProgramInformationDialogAndroid'
|
|
3056
|
+
> = async (
|
|
3057
|
+
params: BillingProgramInformationDialogParamsAndroid,
|
|
3058
|
+
): Promise<BillingResultAndroid> => {
|
|
3059
|
+
if (Platform.OS !== 'android') {
|
|
3060
|
+
throw new Error('Billing Choice API is only supported on Android');
|
|
3061
|
+
}
|
|
3062
|
+
try {
|
|
3063
|
+
return await IAP.instance.showBillingProgramInformationDialogAndroid({
|
|
3064
|
+
billingProgram: params.billingProgram ?? 'billing-choice',
|
|
3065
|
+
externalTransactionToken: params.externalTransactionToken,
|
|
3066
|
+
});
|
|
3067
|
+
} catch (error) {
|
|
3068
|
+
RnIapConsole.error(
|
|
3069
|
+
'Failed to show Billing Choice information dialog:',
|
|
3070
|
+
error,
|
|
3071
|
+
);
|
|
3072
|
+
throw error;
|
|
3073
|
+
}
|
|
3074
|
+
};
|
|
3075
|
+
|
|
3076
|
+
/**
|
|
3077
|
+
* Show Play Billing in-app messages, such as transactional subscription updates (Android only).
|
|
3078
|
+
*
|
|
3079
|
+
* @param params - Optional in-app message categories
|
|
3080
|
+
* @returns Promise with in-app message result
|
|
3081
|
+
* @platform Android
|
|
3082
|
+
* @since Google Play Billing Library 4.1.0+
|
|
3083
|
+
*
|
|
3084
|
+
* @see {@link https://openiap.dev/docs/apis/android/show-in-app-messages-android}
|
|
3085
|
+
*/
|
|
3086
|
+
export const showInAppMessagesAndroid: MutationField<
|
|
3087
|
+
'showInAppMessagesAndroid'
|
|
3088
|
+
> = async (
|
|
3089
|
+
params?: InAppMessageParamsAndroid | null,
|
|
3090
|
+
): Promise<InAppMessageResultAndroid> => {
|
|
3091
|
+
if (Platform.OS !== 'android') {
|
|
3092
|
+
throw new Error('In-app messages are only supported on Android');
|
|
3093
|
+
}
|
|
3094
|
+
try {
|
|
3095
|
+
return await IAP.instance.showInAppMessagesAndroid(params ?? null);
|
|
3096
|
+
} catch (error) {
|
|
3097
|
+
RnIapConsole.error('Failed to show in-app messages:', error);
|
|
3098
|
+
throw error;
|
|
3099
|
+
}
|
|
3100
|
+
};
|
|
3101
|
+
|
|
3102
|
+
/**
|
|
3103
|
+
* Launch an external link for Billing Programs (Android only). Developer-rendered
|
|
3104
|
+
* Billing Choice external-link flows require 9.1.0+ and a pre-generated token.
|
|
2981
3105
|
*
|
|
2982
3106
|
* @param params - Parameters for launching the external link
|
|
2983
3107
|
* @returns Promise<boolean> - true if user accepted, false otherwise
|
|
@@ -2987,7 +3111,8 @@ export const createBillingProgramReportingDetailsAndroid: MutationField<
|
|
|
2987
3111
|
* @example
|
|
2988
3112
|
* ```typescript
|
|
2989
3113
|
* const success = await launchExternalLinkAndroid({
|
|
2990
|
-
* billingProgram: '
|
|
3114
|
+
* billingProgram: 'billing-choice',
|
|
3115
|
+
* externalTransactionToken: reportingDetails.externalTransactionToken,
|
|
2991
3116
|
* launchMode: 'launch-in-external-browser-or-app',
|
|
2992
3117
|
* linkType: 'link-to-digital-content-offer',
|
|
2993
3118
|
* linkUri: 'https://your-website.com/purchase'
|
|
@@ -3008,6 +3133,7 @@ export const launchExternalLinkAndroid: MutationField<
|
|
|
3008
3133
|
try {
|
|
3009
3134
|
return await IAP.instance.launchExternalLinkAndroid({
|
|
3010
3135
|
billingProgram: params.billingProgram,
|
|
3136
|
+
externalTransactionToken: params.externalTransactionToken,
|
|
3011
3137
|
launchMode: params.launchMode,
|
|
3012
3138
|
linkType: params.linkType,
|
|
3013
3139
|
linkUri: params.linkUri,
|
|
@@ -3078,21 +3204,22 @@ export const canPresentExternalPurchaseNoticeIOS: QueryField<
|
|
|
3078
3204
|
*
|
|
3079
3205
|
* @see {@link https://openiap.dev/docs/apis/ios/present-external-purchase-notice-sheet-ios}
|
|
3080
3206
|
*/
|
|
3081
|
-
export const presentExternalPurchaseNoticeSheetIOS
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
}
|
|
3207
|
+
export const presentExternalPurchaseNoticeSheetIOS: MutationField<
|
|
3208
|
+
'presentExternalPurchaseNoticeSheetIOS'
|
|
3209
|
+
> = async () => {
|
|
3210
|
+
if (Platform.OS !== 'ios') {
|
|
3211
|
+
throw new Error('External purchase is only supported on iOS');
|
|
3212
|
+
}
|
|
3213
|
+
try {
|
|
3214
|
+
return await IAP.instance.presentExternalPurchaseNoticeSheetIOS();
|
|
3215
|
+
} catch (error) {
|
|
3216
|
+
RnIapConsole.error(
|
|
3217
|
+
'Failed to present external purchase notice sheet:',
|
|
3218
|
+
error,
|
|
3219
|
+
);
|
|
3220
|
+
throw error;
|
|
3221
|
+
}
|
|
3222
|
+
};
|
|
3096
3223
|
|
|
3097
3224
|
/**
|
|
3098
3225
|
* Present an external purchase link to redirect users to your website (iOS 16.0+).
|
|
@@ -3147,21 +3274,22 @@ export const presentExternalPurchaseLinkIOS: MutationField<
|
|
|
3147
3274
|
*
|
|
3148
3275
|
* @see {@link https://openiap.dev/docs/apis/ios/is-eligible-for-external-purchase-custom-link-ios}
|
|
3149
3276
|
*/
|
|
3150
|
-
export const isEligibleForExternalPurchaseCustomLinkIOS
|
|
3151
|
-
|
|
3152
|
-
|
|
3153
|
-
|
|
3154
|
-
|
|
3155
|
-
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
}
|
|
3277
|
+
export const isEligibleForExternalPurchaseCustomLinkIOS: QueryField<
|
|
3278
|
+
'isEligibleForExternalPurchaseCustomLinkIOS'
|
|
3279
|
+
> = async () => {
|
|
3280
|
+
if (Platform.OS !== 'ios') {
|
|
3281
|
+
return false;
|
|
3282
|
+
}
|
|
3283
|
+
try {
|
|
3284
|
+
return await IAP.instance.isEligibleForExternalPurchaseCustomLinkIOS();
|
|
3285
|
+
} catch (error) {
|
|
3286
|
+
RnIapConsole.error(
|
|
3287
|
+
'Failed to check external purchase custom link eligibility:',
|
|
3288
|
+
error,
|
|
3289
|
+
);
|
|
3290
|
+
return false;
|
|
3291
|
+
}
|
|
3292
|
+
};
|
|
3165
3293
|
|
|
3166
3294
|
/**
|
|
3167
3295
|
* Get external purchase token for reporting to Apple (iOS 18.1+).
|
|
@@ -3184,9 +3312,9 @@ export const isEligibleForExternalPurchaseCustomLinkIOS =
|
|
|
3184
3312
|
*
|
|
3185
3313
|
* @see {@link https://openiap.dev/docs/apis/ios/get-external-purchase-custom-link-token-ios}
|
|
3186
3314
|
*/
|
|
3187
|
-
export const getExternalPurchaseCustomLinkTokenIOS
|
|
3188
|
-
|
|
3189
|
-
)
|
|
3315
|
+
export const getExternalPurchaseCustomLinkTokenIOS: QueryField<
|
|
3316
|
+
'getExternalPurchaseCustomLinkTokenIOS'
|
|
3317
|
+
> = async (tokenType) => {
|
|
3190
3318
|
if (Platform.OS !== 'ios') {
|
|
3191
3319
|
throw new Error(
|
|
3192
3320
|
'External purchase custom link is only supported on iOS 18.1+',
|
|
@@ -3224,9 +3352,9 @@ export const getExternalPurchaseCustomLinkTokenIOS = async (
|
|
|
3224
3352
|
*
|
|
3225
3353
|
* @see {@link https://openiap.dev/docs/apis/ios/show-external-purchase-custom-link-notice-ios}
|
|
3226
3354
|
*/
|
|
3227
|
-
export const showExternalPurchaseCustomLinkNoticeIOS
|
|
3228
|
-
|
|
3229
|
-
)
|
|
3355
|
+
export const showExternalPurchaseCustomLinkNoticeIOS: MutationField<
|
|
3356
|
+
'showExternalPurchaseCustomLinkNoticeIOS'
|
|
3357
|
+
> = async (noticeType) => {
|
|
3230
3358
|
if (Platform.OS !== 'ios') {
|
|
3231
3359
|
throw new Error(
|
|
3232
3360
|
'External purchase custom link is only supported on iOS 18.1+',
|
package/src/specs/RnIap.nitro.ts
CHANGED
|
@@ -35,6 +35,7 @@ import type {
|
|
|
35
35
|
ExternalPurchaseCustomLinkTokenTypeIOS,
|
|
36
36
|
ExternalPurchaseLinkResultIOS,
|
|
37
37
|
ExternalPurchaseNoticeResultIOS,
|
|
38
|
+
DeveloperBillingOptionParamsAndroid,
|
|
38
39
|
DeveloperProvidedBillingDetailsAndroid,
|
|
39
40
|
MutationFinishTransactionArgs,
|
|
40
41
|
ProductCommon,
|
|
@@ -53,6 +54,7 @@ import type {
|
|
|
53
54
|
UserChoiceBillingDetails,
|
|
54
55
|
PaymentModeIOS,
|
|
55
56
|
SubscriptionProductReplacementParamsAndroid,
|
|
57
|
+
SubResponseCodeAndroid,
|
|
56
58
|
WinBackOfferInputIOS,
|
|
57
59
|
} from '../types';
|
|
58
60
|
|
|
@@ -96,13 +98,38 @@ export type PurchaseVerificationProvider = 'iapkit' | 'none';
|
|
|
96
98
|
|
|
97
99
|
// Billing Programs API (Android)
|
|
98
100
|
// GQL type exists but defined locally for Nitro codegen consistency
|
|
99
|
-
// Android 8.2.0+, 8.3.0+ for external-payments,
|
|
101
|
+
// Android 8.2.0+, 8.3.0+ for external-payments, 9.1.0+ for billing-choice,
|
|
102
|
+
// 7.0+ for user-choice-billing
|
|
100
103
|
export type BillingProgramAndroid =
|
|
101
104
|
| 'unspecified'
|
|
102
105
|
| 'external-content-link'
|
|
103
106
|
| 'external-offer'
|
|
104
107
|
| 'external-payments'
|
|
105
|
-
| 'user-choice-billing'
|
|
108
|
+
| 'user-choice-billing'
|
|
109
|
+
| 'billing-choice';
|
|
110
|
+
|
|
111
|
+
export type BillingChoiceImageLayoutAndroid =
|
|
112
|
+
| 'rectangular-four-by-one'
|
|
113
|
+
| 'rectangular-three-by-one'
|
|
114
|
+
| 'rectangular-two-by-two';
|
|
115
|
+
|
|
116
|
+
export type BillingChoiceScreenTypeAndroid =
|
|
117
|
+
| 'unspecified'
|
|
118
|
+
| 'developer-rendered'
|
|
119
|
+
| 'google-rendered';
|
|
120
|
+
|
|
121
|
+
export type DeveloperBillingTypeAndroid =
|
|
122
|
+
| 'developer-billing-type-unspecified'
|
|
123
|
+
| 'in-app'
|
|
124
|
+
| 'external-link';
|
|
125
|
+
|
|
126
|
+
export type InAppMessageCategoryAndroid =
|
|
127
|
+
| 'unknown-in-app-message-category-id'
|
|
128
|
+
| 'transactional';
|
|
129
|
+
|
|
130
|
+
export type InAppMessageResponseCodeAndroid =
|
|
131
|
+
| 'no-action-needed'
|
|
132
|
+
| 'subscription-status-updated';
|
|
106
133
|
|
|
107
134
|
// Developer Billing Launch Mode (Android 8.3.0+)
|
|
108
135
|
// Defined locally for Nitro codegen
|
|
@@ -218,6 +245,10 @@ export interface NitroRequestPurchaseAndroid {
|
|
|
218
245
|
/** @deprecated Use subscriptionProductReplacementParams instead for item-level replacement (8.1.0+) */
|
|
219
246
|
replacementMode?: RequestSubscriptionAndroidProps['replacementMode'];
|
|
220
247
|
purchaseToken?: RequestSubscriptionAndroidProps['purchaseToken'];
|
|
248
|
+
/** Original external transaction ID for developer-billed subscription replacement (9.1.0+). */
|
|
249
|
+
originalExternalTransactionId?: RequestSubscriptionAndroidProps['originalExternalTransactionId'];
|
|
250
|
+
/** Developer billing option for External Payments (8.3.0+) or Billing Choice (9.1.0+). */
|
|
251
|
+
developerBillingOption?: DeveloperBillingOptionParamsAndroid | null;
|
|
221
252
|
/**
|
|
222
253
|
* Product-level replacement parameters (8.1.0+)
|
|
223
254
|
* Use this instead of replacementMode for item-level replacement
|
|
@@ -298,8 +329,10 @@ export interface NitroDeepLinkOptionsAndroid {
|
|
|
298
329
|
* Parameters for launching an external link (Android 8.2.0+)
|
|
299
330
|
*/
|
|
300
331
|
export interface NitroLaunchExternalLinkParamsAndroid {
|
|
301
|
-
/** The billing program (external-content-link or
|
|
332
|
+
/** The billing program (external-content-link, external-offer, or billing-choice) */
|
|
302
333
|
billingProgram: BillingProgramAndroid;
|
|
334
|
+
/** Reporting token for a developer-rendered Billing Choice external-link flow (9.1.0+). */
|
|
335
|
+
externalTransactionToken?: string | null;
|
|
303
336
|
/** The external link launch mode */
|
|
304
337
|
launchMode: ExternalLinkLaunchModeAndroid;
|
|
305
338
|
/** The type of the external link */
|
|
@@ -308,6 +341,21 @@ export interface NitroLaunchExternalLinkParamsAndroid {
|
|
|
308
341
|
linkUri: string;
|
|
309
342
|
}
|
|
310
343
|
|
|
344
|
+
export interface NitroGetBillingChoiceInfoParamsAndroid {
|
|
345
|
+
billingProgram: BillingProgramAndroid;
|
|
346
|
+
playBillingChoiceImageLayout: BillingChoiceImageLayoutAndroid;
|
|
347
|
+
userLocale?: string | null;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
export interface NitroBillingProgramInformationDialogParamsAndroid {
|
|
351
|
+
billingProgram: BillingProgramAndroid;
|
|
352
|
+
externalTransactionToken: string;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
export interface NitroInAppMessageParamsAndroid {
|
|
356
|
+
categories?: InAppMessageCategoryAndroid[] | null;
|
|
357
|
+
}
|
|
358
|
+
|
|
311
359
|
// ╔══════════════════════════════════════════════════════════════════════════╗
|
|
312
360
|
// ║ TYPES ║
|
|
313
361
|
// ╚══════════════════════════════════════════════════════════════════════════╝
|
|
@@ -344,6 +392,22 @@ export interface NitroPurchaseResult {
|
|
|
344
392
|
purchaseToken?: string;
|
|
345
393
|
}
|
|
346
394
|
|
|
395
|
+
export interface NitroBillingResultAndroid {
|
|
396
|
+
responseCode: number;
|
|
397
|
+
debugMessage?: string | null;
|
|
398
|
+
subResponseCode?: SubResponseCodeAndroid | null;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
export interface NitroBillingChoiceInfoAndroid {
|
|
402
|
+
playBillingChoiceImageUrl: string;
|
|
403
|
+
playBillingLoyaltyInfo?: string | null;
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
export interface NitroInAppMessageResultAndroid {
|
|
407
|
+
responseCode: InAppMessageResponseCodeAndroid;
|
|
408
|
+
purchaseToken?: string | null;
|
|
409
|
+
}
|
|
410
|
+
|
|
347
411
|
export interface NitroReceiptValidationResultIOS {
|
|
348
412
|
isValid: boolean;
|
|
349
413
|
receiptData: string;
|
|
@@ -428,8 +492,12 @@ export interface NitroVerifyPurchaseWithProviderResult {
|
|
|
428
492
|
export interface NitroBillingProgramAvailabilityResultAndroid {
|
|
429
493
|
/** The billing program that was checked */
|
|
430
494
|
billingProgram: BillingProgramAndroid;
|
|
495
|
+
/** Billing Choice screen renderer. Populated only for available Billing Choice results. */
|
|
496
|
+
choiceScreenType?: BillingChoiceScreenTypeAndroid | null;
|
|
431
497
|
/** Whether the billing program is available for the user */
|
|
432
498
|
isAvailable: boolean;
|
|
499
|
+
/** Whether external-link payment is available for Billing Choice. */
|
|
500
|
+
isExternalLinkAvailable?: boolean | null;
|
|
433
501
|
}
|
|
434
502
|
|
|
435
503
|
/**
|
|
@@ -505,6 +573,7 @@ export interface NitroOneTimePurchaseOfferDetail {
|
|
|
505
573
|
preorderDetailsAndroid?: NitroPreorderDetailsAndroid | null;
|
|
506
574
|
priceAmountMicros: string;
|
|
507
575
|
priceCurrencyCode: string;
|
|
576
|
+
purchaseOptionId?: string | null;
|
|
508
577
|
rentalDetailsAndroid?: NitroRentalDetailsAndroid | null;
|
|
509
578
|
validTimeWindow?: NitroValidTimeWindowAndroid | null;
|
|
510
579
|
}
|
|
@@ -602,6 +671,7 @@ export interface NitroProduct {
|
|
|
602
671
|
id: ProductCommon['id'];
|
|
603
672
|
title: ProductCommon['title'];
|
|
604
673
|
description: ProductCommon['description'];
|
|
674
|
+
debugDescription?: ProductCommon['debugDescription'];
|
|
605
675
|
type: string;
|
|
606
676
|
displayName?: ProductCommon['displayName'];
|
|
607
677
|
displayPrice?: ProductCommon['displayPrice'];
|
|
@@ -612,6 +682,8 @@ export interface NitroProduct {
|
|
|
612
682
|
typeIOS?: string | null;
|
|
613
683
|
isFamilyShareableIOS?: boolean | null;
|
|
614
684
|
jsonRepresentationIOS?: string | null;
|
|
685
|
+
pricingTermsIOS?: string | null;
|
|
686
|
+
subscriptionInfoIOS?: string | null;
|
|
615
687
|
discountsIOS?: string | null;
|
|
616
688
|
introductoryPriceIOS?: string | null;
|
|
617
689
|
introductoryPriceAsAmountIOS?: number | null;
|
|
@@ -1086,12 +1158,11 @@ export interface RnIap extends HybridObject<{ios: 'swift'; android: 'kotlin'}> {
|
|
|
1086
1158
|
): void;
|
|
1087
1159
|
|
|
1088
1160
|
/**
|
|
1089
|
-
* Add a listener for developer provided billing events (Android 8.3.0+
|
|
1090
|
-
* Fires
|
|
1161
|
+
* Add a listener for developer provided billing events (Android 8.3.0+).
|
|
1162
|
+
* Fires for External Payments and Billing Choice developer billing flows.
|
|
1091
1163
|
*
|
|
1092
|
-
*
|
|
1093
|
-
*
|
|
1094
|
-
* external payment option directly in the purchase flow. (Japan only)
|
|
1164
|
+
* Billing Choice expands the payload with nullable link/original transaction
|
|
1165
|
+
* fields and selected products in Billing Library 9.1.0+.
|
|
1095
1166
|
*
|
|
1096
1167
|
* @param listener - Function to call when user chooses developer billing
|
|
1097
1168
|
* @platform Android
|
|
@@ -1161,6 +1232,18 @@ export interface RnIap extends HybridObject<{ios: 'swift'; android: 'kotlin'}> {
|
|
|
1161
1232
|
program: BillingProgramAndroid,
|
|
1162
1233
|
): Promise<NitroBillingProgramAvailabilityResultAndroid>;
|
|
1163
1234
|
|
|
1235
|
+
/**
|
|
1236
|
+
* Fetch Play Billing assets and loyalty text for developer-rendered Billing Choice screens.
|
|
1237
|
+
*
|
|
1238
|
+
* @param params - Billing Choice info request parameters
|
|
1239
|
+
* @returns Promise with the Play-hosted image URL and optional loyalty info
|
|
1240
|
+
* @platform Android
|
|
1241
|
+
* @since Billing Library 9.1.0+
|
|
1242
|
+
*/
|
|
1243
|
+
getBillingChoiceInfoAndroid(
|
|
1244
|
+
params: NitroGetBillingChoiceInfoParamsAndroid,
|
|
1245
|
+
): Promise<NitroBillingChoiceInfoAndroid>;
|
|
1246
|
+
|
|
1164
1247
|
/**
|
|
1165
1248
|
* Create billing program reporting details for external transactions (Android only).
|
|
1166
1249
|
* Used to get the external transaction token needed for reporting to Google.
|
|
@@ -1172,8 +1255,33 @@ export interface RnIap extends HybridObject<{ios: 'swift'; android: 'kotlin'}> {
|
|
|
1172
1255
|
*/
|
|
1173
1256
|
createBillingProgramReportingDetailsAndroid(
|
|
1174
1257
|
program: BillingProgramAndroid,
|
|
1258
|
+
developerBillingType?: DeveloperBillingTypeAndroid | null,
|
|
1175
1259
|
): Promise<NitroBillingProgramReportingDetailsAndroid>;
|
|
1176
1260
|
|
|
1261
|
+
/**
|
|
1262
|
+
* Show the Play-provided Billing Choice information dialog.
|
|
1263
|
+
*
|
|
1264
|
+
* @param params - Billing Choice dialog parameters
|
|
1265
|
+
* @returns Promise with BillingResult
|
|
1266
|
+
* @platform Android
|
|
1267
|
+
* @since Billing Library 9.1.0+
|
|
1268
|
+
*/
|
|
1269
|
+
showBillingProgramInformationDialogAndroid(
|
|
1270
|
+
params: NitroBillingProgramInformationDialogParamsAndroid,
|
|
1271
|
+
): Promise<NitroBillingResultAndroid>;
|
|
1272
|
+
|
|
1273
|
+
/**
|
|
1274
|
+
* Show Play Billing in-app messages, such as transactional subscription updates.
|
|
1275
|
+
*
|
|
1276
|
+
* @param params - Optional in-app message categories
|
|
1277
|
+
* @returns Promise with in-app message result
|
|
1278
|
+
* @platform Android
|
|
1279
|
+
* @since Billing Library 4.1.0+
|
|
1280
|
+
*/
|
|
1281
|
+
showInAppMessagesAndroid(
|
|
1282
|
+
params?: NitroInAppMessageParamsAndroid | null,
|
|
1283
|
+
): Promise<NitroInAppMessageResultAndroid>;
|
|
1284
|
+
|
|
1177
1285
|
/**
|
|
1178
1286
|
* Launch external link for external offers or app download (Android only).
|
|
1179
1287
|
*
|