react-native-iap 14.2.2 → 14.2.3
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/NitroIap.podspec +4 -1
- package/README.md +10 -0
- package/android/src/main/java/com/margelo/nitro/iap/HybridRnIap.kt +5 -1
- package/app.plugin.js +1 -1
- package/lib/module/helpers/subscription.js.map +1 -1
- package/lib/module/hooks/useIAP.js.map +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/types/react-test-renderer.d.js +2 -0
- package/lib/module/types/react-test-renderer.d.js.map +1 -0
- package/lib/module/utils/error.js.map +1 -1
- package/lib/module/utils/errorMapping.js.map +1 -1
- package/lib/module/utils/type-bridge.js.map +1 -1
- package/lib/typescript/plugin/src/withIAP.d.ts.map +1 -1
- package/lib/typescript/src/helpers/subscription.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useIAP.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/specs/RnIap.nitro.d.ts.map +1 -1
- package/lib/typescript/src/types.d.ts.map +1 -1
- package/lib/typescript/src/utils/error.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/package.json +1 -9
- package/plugin/src/withIAP.ts +59 -59
- package/src/helpers/subscription.ts +21 -21
- package/src/hooks/useIAP.ts +193 -193
- package/src/index.ts +346 -344
- package/src/specs/RnIap.nitro.ts +160 -157
- package/src/types/react-test-renderer.d.ts +7 -0
- package/src/types.ts +294 -294
- package/src/utils/error.ts +19 -19
- package/src/utils/errorMapping.ts +13 -13
- package/src/utils/type-bridge.ts +94 -93
package/src/specs/RnIap.nitro.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type {HybridObject} from 'react-native-nitro-modules';
|
|
2
2
|
|
|
3
3
|
// ╔══════════════════════════════════════════════════════════════════════════╗
|
|
4
4
|
// ║ PARAMS ║
|
|
@@ -10,18 +10,18 @@ import type { HybridObject } from 'react-native-nitro-modules'
|
|
|
10
10
|
* Android-specific receipt validation options
|
|
11
11
|
*/
|
|
12
12
|
export interface NitroAndroidReceiptValidationOptions {
|
|
13
|
-
packageName: string
|
|
14
|
-
productToken: string
|
|
15
|
-
accessToken: string
|
|
16
|
-
isSub?: boolean
|
|
13
|
+
packageName: string;
|
|
14
|
+
productToken: string;
|
|
15
|
+
accessToken: string;
|
|
16
|
+
isSub?: boolean;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
20
|
* Receipt validation parameters
|
|
21
21
|
*/
|
|
22
22
|
export interface NitroReceiptValidationParams {
|
|
23
|
-
sku: string
|
|
24
|
-
androidOptions?: NitroAndroidReceiptValidationOptions
|
|
23
|
+
sku: string;
|
|
24
|
+
androidOptions?: NitroAndroidReceiptValidationOptions;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
// Purchase request parameters
|
|
@@ -30,40 +30,40 @@ export interface NitroReceiptValidationParams {
|
|
|
30
30
|
* iOS-specific purchase request parameters
|
|
31
31
|
*/
|
|
32
32
|
interface NitroRequestPurchaseIos {
|
|
33
|
-
sku: string
|
|
34
|
-
andDangerouslyFinishTransactionAutomatically?: boolean
|
|
35
|
-
appAccountToken?: string
|
|
36
|
-
quantity?: number
|
|
37
|
-
withOffer?: Record<string, string
|
|
33
|
+
sku: string;
|
|
34
|
+
andDangerouslyFinishTransactionAutomatically?: boolean;
|
|
35
|
+
appAccountToken?: string;
|
|
36
|
+
quantity?: number;
|
|
37
|
+
withOffer?: Record<string, string>;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
/**
|
|
41
41
|
* Android subscription offer structure
|
|
42
42
|
*/
|
|
43
43
|
interface NitroSubscriptionOffer {
|
|
44
|
-
sku: string
|
|
45
|
-
offerToken: string
|
|
44
|
+
sku: string;
|
|
45
|
+
offerToken: string;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
/**
|
|
49
49
|
* Android-specific purchase request parameters
|
|
50
50
|
*/
|
|
51
51
|
interface NitroRequestPurchaseAndroid {
|
|
52
|
-
skus: string[]
|
|
53
|
-
obfuscatedAccountIdAndroid?: string
|
|
54
|
-
obfuscatedProfileIdAndroid?: string
|
|
55
|
-
isOfferPersonalized?: boolean
|
|
56
|
-
subscriptionOffers?: NitroSubscriptionOffer[]
|
|
57
|
-
replacementModeAndroid?: number
|
|
58
|
-
purchaseTokenAndroid?: string
|
|
52
|
+
skus: string[];
|
|
53
|
+
obfuscatedAccountIdAndroid?: string;
|
|
54
|
+
obfuscatedProfileIdAndroid?: string;
|
|
55
|
+
isOfferPersonalized?: boolean;
|
|
56
|
+
subscriptionOffers?: NitroSubscriptionOffer[];
|
|
57
|
+
replacementModeAndroid?: number;
|
|
58
|
+
purchaseTokenAndroid?: string;
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
/**
|
|
62
62
|
* Unified purchase request with platform-specific options
|
|
63
63
|
*/
|
|
64
64
|
interface NitroPurchaseRequest {
|
|
65
|
-
ios?: NitroRequestPurchaseIos
|
|
66
|
-
android?: NitroRequestPurchaseAndroid
|
|
65
|
+
ios?: NitroRequestPurchaseIos;
|
|
66
|
+
android?: NitroRequestPurchaseAndroid;
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
// Available purchases parameters
|
|
@@ -72,25 +72,25 @@ interface NitroPurchaseRequest {
|
|
|
72
72
|
* iOS-specific options for getting available purchases
|
|
73
73
|
*/
|
|
74
74
|
interface NitroAvailablePurchasesIosOptions {
|
|
75
|
-
alsoPublishToEventListener?: boolean // @deprecated Use alsoPublishToEventListenerIOS
|
|
76
|
-
onlyIncludeActiveItems?: boolean // @deprecated Use onlyIncludeActiveItemsIOS
|
|
77
|
-
alsoPublishToEventListenerIOS?: boolean
|
|
78
|
-
onlyIncludeActiveItemsIOS?: boolean
|
|
75
|
+
alsoPublishToEventListener?: boolean; // @deprecated Use alsoPublishToEventListenerIOS
|
|
76
|
+
onlyIncludeActiveItems?: boolean; // @deprecated Use onlyIncludeActiveItemsIOS
|
|
77
|
+
alsoPublishToEventListenerIOS?: boolean;
|
|
78
|
+
onlyIncludeActiveItemsIOS?: boolean;
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
/**
|
|
82
82
|
* Android-specific options for getting available purchases
|
|
83
83
|
*/
|
|
84
84
|
interface NitroAvailablePurchasesAndroidOptions {
|
|
85
|
-
type?: string // 'inapp' or 'subs'
|
|
85
|
+
type?: string; // 'inapp' or 'subs'
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
/**
|
|
89
89
|
* Unified available purchases options with platform-specific parameters
|
|
90
90
|
*/
|
|
91
91
|
interface NitroAvailablePurchasesOptions {
|
|
92
|
-
ios?: NitroAvailablePurchasesIosOptions
|
|
93
|
-
android?: NitroAvailablePurchasesAndroidOptions
|
|
92
|
+
ios?: NitroAvailablePurchasesIosOptions;
|
|
93
|
+
android?: NitroAvailablePurchasesAndroidOptions;
|
|
94
94
|
}
|
|
95
95
|
|
|
96
96
|
// Transaction finish parameters
|
|
@@ -99,23 +99,23 @@ interface NitroAvailablePurchasesOptions {
|
|
|
99
99
|
* iOS-specific parameters for finishing a transaction
|
|
100
100
|
*/
|
|
101
101
|
interface NitroFinishTransactionIosParams {
|
|
102
|
-
transactionId: string
|
|
102
|
+
transactionId: string;
|
|
103
103
|
}
|
|
104
104
|
|
|
105
105
|
/**
|
|
106
106
|
* Android-specific parameters for finishing a transaction
|
|
107
107
|
*/
|
|
108
108
|
interface NitroFinishTransactionAndroidParams {
|
|
109
|
-
purchaseToken: string
|
|
110
|
-
isConsumable?: boolean
|
|
109
|
+
purchaseToken: string;
|
|
110
|
+
isConsumable?: boolean;
|
|
111
111
|
}
|
|
112
112
|
|
|
113
113
|
/**
|
|
114
114
|
* Unified finish transaction parameters with platform-specific options
|
|
115
115
|
*/
|
|
116
116
|
interface NitroFinishTransactionParams {
|
|
117
|
-
ios?: NitroFinishTransactionIosParams
|
|
118
|
-
android?: NitroFinishTransactionAndroidParams
|
|
117
|
+
ios?: NitroFinishTransactionIosParams;
|
|
118
|
+
android?: NitroFinishTransactionAndroidParams;
|
|
119
119
|
}
|
|
120
120
|
|
|
121
121
|
// ╔══════════════════════════════════════════════════════════════════════════╗
|
|
@@ -126,66 +126,66 @@ interface NitroFinishTransactionParams {
|
|
|
126
126
|
* Subscription renewal information (iOS only)
|
|
127
127
|
*/
|
|
128
128
|
export interface NitroSubscriptionRenewalInfo {
|
|
129
|
-
autoRenewStatus: boolean
|
|
130
|
-
autoRenewPreference?: string
|
|
131
|
-
expirationReason?: number
|
|
132
|
-
gracePeriodExpirationDate?: number
|
|
133
|
-
currentProductID?: string
|
|
134
|
-
platform: string
|
|
129
|
+
autoRenewStatus: boolean;
|
|
130
|
+
autoRenewPreference?: string;
|
|
131
|
+
expirationReason?: number;
|
|
132
|
+
gracePeriodExpirationDate?: number;
|
|
133
|
+
currentProductID?: string;
|
|
134
|
+
platform: string;
|
|
135
135
|
}
|
|
136
136
|
|
|
137
137
|
/**
|
|
138
138
|
* Subscription status information (iOS only)
|
|
139
139
|
*/
|
|
140
140
|
export interface NitroSubscriptionStatus {
|
|
141
|
-
state: number
|
|
142
|
-
platform: string
|
|
143
|
-
renewalInfo?: NitroSubscriptionRenewalInfo
|
|
141
|
+
state: number;
|
|
142
|
+
platform: string;
|
|
143
|
+
renewalInfo?: NitroSubscriptionRenewalInfo;
|
|
144
144
|
}
|
|
145
145
|
|
|
146
146
|
/**
|
|
147
147
|
* Purchase result structure for Android operations
|
|
148
148
|
*/
|
|
149
149
|
export interface NitroPurchaseResult {
|
|
150
|
-
responseCode: number
|
|
151
|
-
debugMessage?: string
|
|
152
|
-
code: string
|
|
153
|
-
message: string
|
|
154
|
-
purchaseToken?: string
|
|
150
|
+
responseCode: number;
|
|
151
|
+
debugMessage?: string;
|
|
152
|
+
code: string;
|
|
153
|
+
message: string;
|
|
154
|
+
purchaseToken?: string;
|
|
155
155
|
}
|
|
156
156
|
|
|
157
157
|
/**
|
|
158
158
|
* iOS receipt validation result
|
|
159
159
|
*/
|
|
160
160
|
export interface NitroReceiptValidationResultIOS {
|
|
161
|
-
isValid: boolean
|
|
162
|
-
receiptData: string
|
|
163
|
-
jwsRepresentation: string
|
|
164
|
-
latestTransaction?: NitroPurchase
|
|
161
|
+
isValid: boolean;
|
|
162
|
+
receiptData: string;
|
|
163
|
+
jwsRepresentation: string;
|
|
164
|
+
latestTransaction?: NitroPurchase;
|
|
165
165
|
}
|
|
166
166
|
|
|
167
167
|
/**
|
|
168
168
|
* Android receipt validation result
|
|
169
169
|
*/
|
|
170
170
|
export interface NitroReceiptValidationResultAndroid {
|
|
171
|
-
autoRenewing: boolean
|
|
172
|
-
betaProduct: boolean
|
|
173
|
-
cancelDate: number | null
|
|
174
|
-
cancelReason: string
|
|
175
|
-
deferredDate: number | null
|
|
176
|
-
deferredSku: number | null
|
|
177
|
-
freeTrialEndDate: number
|
|
178
|
-
gracePeriodEndDate: number
|
|
179
|
-
parentProductId: string
|
|
180
|
-
productId: string
|
|
181
|
-
productType: string
|
|
182
|
-
purchaseDate: number
|
|
183
|
-
quantity: number
|
|
184
|
-
receiptId: string
|
|
185
|
-
renewalDate: number
|
|
186
|
-
term: string
|
|
187
|
-
termSku: string
|
|
188
|
-
testTransaction: boolean
|
|
171
|
+
autoRenewing: boolean;
|
|
172
|
+
betaProduct: boolean;
|
|
173
|
+
cancelDate: number | null;
|
|
174
|
+
cancelReason: string;
|
|
175
|
+
deferredDate: number | null;
|
|
176
|
+
deferredSku: number | null;
|
|
177
|
+
freeTrialEndDate: number;
|
|
178
|
+
gracePeriodEndDate: number;
|
|
179
|
+
parentProductId: string;
|
|
180
|
+
productId: string;
|
|
181
|
+
productType: string;
|
|
182
|
+
purchaseDate: number;
|
|
183
|
+
quantity: number;
|
|
184
|
+
receiptId: string;
|
|
185
|
+
renewalDate: number;
|
|
186
|
+
term: string;
|
|
187
|
+
termSku: string;
|
|
188
|
+
testTransaction: boolean;
|
|
189
189
|
}
|
|
190
190
|
|
|
191
191
|
/**
|
|
@@ -193,31 +193,31 @@ export interface NitroReceiptValidationResultAndroid {
|
|
|
193
193
|
*/
|
|
194
194
|
export interface NitroPurchase {
|
|
195
195
|
// Common fields
|
|
196
|
-
id: string
|
|
197
|
-
productId: string
|
|
198
|
-
transactionDate: number
|
|
199
|
-
purchaseToken?: string
|
|
200
|
-
platform: string
|
|
201
|
-
quantity: number
|
|
202
|
-
purchaseState: string
|
|
203
|
-
isAutoRenewing: boolean
|
|
196
|
+
id: string;
|
|
197
|
+
productId: string;
|
|
198
|
+
transactionDate: number;
|
|
199
|
+
purchaseToken?: string;
|
|
200
|
+
platform: string;
|
|
201
|
+
quantity: number;
|
|
202
|
+
purchaseState: string;
|
|
203
|
+
isAutoRenewing: boolean;
|
|
204
204
|
|
|
205
205
|
// iOS specific fields
|
|
206
|
-
quantityIOS?: number
|
|
207
|
-
originalTransactionDateIOS?: number
|
|
208
|
-
originalTransactionIdentifierIOS?: string
|
|
209
|
-
appAccountToken?: string
|
|
206
|
+
quantityIOS?: number;
|
|
207
|
+
originalTransactionDateIOS?: number;
|
|
208
|
+
originalTransactionIdentifierIOS?: string;
|
|
209
|
+
appAccountToken?: string;
|
|
210
210
|
|
|
211
211
|
// Android specific fields
|
|
212
|
-
purchaseTokenAndroid?: string
|
|
213
|
-
dataAndroid?: string
|
|
214
|
-
signatureAndroid?: string
|
|
215
|
-
autoRenewingAndroid?: boolean
|
|
216
|
-
purchaseStateAndroid?: number
|
|
217
|
-
isAcknowledgedAndroid?: boolean
|
|
218
|
-
packageNameAndroid?: string
|
|
219
|
-
obfuscatedAccountIdAndroid?: string
|
|
220
|
-
obfuscatedProfileIdAndroid?: string
|
|
212
|
+
purchaseTokenAndroid?: string;
|
|
213
|
+
dataAndroid?: string;
|
|
214
|
+
signatureAndroid?: string;
|
|
215
|
+
autoRenewingAndroid?: boolean;
|
|
216
|
+
purchaseStateAndroid?: number;
|
|
217
|
+
isAcknowledgedAndroid?: boolean;
|
|
218
|
+
packageNameAndroid?: string;
|
|
219
|
+
obfuscatedAccountIdAndroid?: string;
|
|
220
|
+
obfuscatedProfileIdAndroid?: string;
|
|
221
221
|
}
|
|
222
222
|
|
|
223
223
|
/**
|
|
@@ -225,37 +225,37 @@ export interface NitroPurchase {
|
|
|
225
225
|
*/
|
|
226
226
|
export interface NitroProduct {
|
|
227
227
|
// Common fields
|
|
228
|
-
id: string
|
|
229
|
-
title: string
|
|
230
|
-
description: string
|
|
231
|
-
type: string
|
|
232
|
-
displayName?: string
|
|
233
|
-
displayPrice?: string
|
|
234
|
-
currency?: string
|
|
235
|
-
price?: number
|
|
236
|
-
platform: string
|
|
228
|
+
id: string;
|
|
229
|
+
title: string;
|
|
230
|
+
description: string;
|
|
231
|
+
type: string;
|
|
232
|
+
displayName?: string;
|
|
233
|
+
displayPrice?: string;
|
|
234
|
+
currency?: string;
|
|
235
|
+
price?: number;
|
|
236
|
+
platform: string;
|
|
237
237
|
|
|
238
238
|
// iOS specific fields
|
|
239
|
-
typeIOS?: string
|
|
240
|
-
isFamilyShareableIOS?: boolean
|
|
241
|
-
jsonRepresentationIOS?: string
|
|
242
|
-
subscriptionPeriodUnitIOS?: string
|
|
243
|
-
subscriptionPeriodNumberIOS?: number
|
|
244
|
-
introductoryPriceIOS?: string
|
|
245
|
-
introductoryPriceAsAmountIOS?: number
|
|
246
|
-
introductoryPricePaymentModeIOS?: string
|
|
247
|
-
introductoryPriceNumberOfPeriodsIOS?: number
|
|
248
|
-
introductoryPriceSubscriptionPeriodIOS?: string
|
|
239
|
+
typeIOS?: string;
|
|
240
|
+
isFamilyShareableIOS?: boolean;
|
|
241
|
+
jsonRepresentationIOS?: string;
|
|
242
|
+
subscriptionPeriodUnitIOS?: string;
|
|
243
|
+
subscriptionPeriodNumberIOS?: number;
|
|
244
|
+
introductoryPriceIOS?: string;
|
|
245
|
+
introductoryPriceAsAmountIOS?: number;
|
|
246
|
+
introductoryPricePaymentModeIOS?: string;
|
|
247
|
+
introductoryPriceNumberOfPeriodsIOS?: number;
|
|
248
|
+
introductoryPriceSubscriptionPeriodIOS?: string;
|
|
249
249
|
|
|
250
250
|
// Android specific fields
|
|
251
|
-
originalPriceAndroid?: string
|
|
252
|
-
originalPriceAmountMicrosAndroid?: number
|
|
253
|
-
introductoryPriceValueAndroid?: number
|
|
254
|
-
introductoryPriceCyclesAndroid?: number
|
|
255
|
-
introductoryPricePeriodAndroid?: string
|
|
256
|
-
subscriptionPeriodAndroid?: string
|
|
257
|
-
freeTrialPeriodAndroid?: string
|
|
258
|
-
subscriptionOfferDetailsAndroid?: string // Android subscription offer details as JSON string
|
|
251
|
+
originalPriceAndroid?: string;
|
|
252
|
+
originalPriceAmountMicrosAndroid?: number;
|
|
253
|
+
introductoryPriceValueAndroid?: number;
|
|
254
|
+
introductoryPriceCyclesAndroid?: number;
|
|
255
|
+
introductoryPricePeriodAndroid?: string;
|
|
256
|
+
subscriptionPeriodAndroid?: string;
|
|
257
|
+
freeTrialPeriodAndroid?: string;
|
|
258
|
+
subscriptionOfferDetailsAndroid?: string; // Android subscription offer details as JSON string
|
|
259
259
|
}
|
|
260
260
|
|
|
261
261
|
// ╔══════════════════════════════════════════════════════════════════════════╗
|
|
@@ -265,21 +265,20 @@ export interface NitroProduct {
|
|
|
265
265
|
/**
|
|
266
266
|
* Main RnIap HybridObject interface for native bridge
|
|
267
267
|
*/
|
|
268
|
-
export interface RnIap
|
|
269
|
-
extends HybridObject<{ ios: 'swift'; android: 'kotlin' }> {
|
|
268
|
+
export interface RnIap extends HybridObject<{ios: 'swift'; android: 'kotlin'}> {
|
|
270
269
|
// Connection methods
|
|
271
270
|
|
|
272
271
|
/**
|
|
273
272
|
* Initialize connection to the store
|
|
274
273
|
* @returns Promise<boolean> - true if connection successful
|
|
275
274
|
*/
|
|
276
|
-
initConnection(): Promise<boolean
|
|
275
|
+
initConnection(): Promise<boolean>;
|
|
277
276
|
|
|
278
277
|
/**
|
|
279
278
|
* End connection to the store
|
|
280
279
|
* @returns Promise<boolean> - true if disconnection successful
|
|
281
280
|
*/
|
|
282
|
-
endConnection(): Promise<boolean
|
|
281
|
+
endConnection(): Promise<boolean>;
|
|
283
282
|
|
|
284
283
|
// Product methods
|
|
285
284
|
|
|
@@ -289,7 +288,7 @@ export interface RnIap
|
|
|
289
288
|
* @param type - Type of products: 'inapp' or 'subs'
|
|
290
289
|
* @returns Promise<NitroProduct[]> - Array of products from the store
|
|
291
290
|
*/
|
|
292
|
-
fetchProducts(skus: string[], type: string): Promise<NitroProduct[]
|
|
291
|
+
fetchProducts(skus: string[], type: string): Promise<NitroProduct[]>;
|
|
293
292
|
|
|
294
293
|
// Purchase methods (unified)
|
|
295
294
|
|
|
@@ -300,7 +299,7 @@ export interface RnIap
|
|
|
300
299
|
* @param request - Platform-specific purchase request parameters
|
|
301
300
|
* @returns Promise<void> - Always returns void, listen for events instead
|
|
302
301
|
*/
|
|
303
|
-
requestPurchase(request: NitroPurchaseRequest): Promise<void
|
|
302
|
+
requestPurchase(request: NitroPurchaseRequest): Promise<void>;
|
|
304
303
|
|
|
305
304
|
/**
|
|
306
305
|
* Get available purchases (unified method for both platforms)
|
|
@@ -308,8 +307,8 @@ export interface RnIap
|
|
|
308
307
|
* @returns Promise<NitroPurchase[]> - Array of available purchases
|
|
309
308
|
*/
|
|
310
309
|
getAvailablePurchases(
|
|
311
|
-
options?: NitroAvailablePurchasesOptions
|
|
312
|
-
): Promise<NitroPurchase[]
|
|
310
|
+
options?: NitroAvailablePurchasesOptions,
|
|
311
|
+
): Promise<NitroPurchase[]>;
|
|
313
312
|
|
|
314
313
|
/**
|
|
315
314
|
* Finish a transaction (unified method for both platforms)
|
|
@@ -317,8 +316,8 @@ export interface RnIap
|
|
|
317
316
|
* @returns Promise<NitroPurchaseResult | boolean> - Result (Android) or success flag (iOS)
|
|
318
317
|
*/
|
|
319
318
|
finishTransaction(
|
|
320
|
-
params: NitroFinishTransactionParams
|
|
321
|
-
): Promise<NitroPurchaseResult | boolean
|
|
319
|
+
params: NitroFinishTransactionParams,
|
|
320
|
+
): Promise<NitroPurchaseResult | boolean>;
|
|
322
321
|
|
|
323
322
|
// Event listener methods
|
|
324
323
|
|
|
@@ -326,36 +325,40 @@ export interface RnIap
|
|
|
326
325
|
* Add a listener for purchase updates
|
|
327
326
|
* @param listener - Function to call when a purchase is updated
|
|
328
327
|
*/
|
|
329
|
-
addPurchaseUpdatedListener(listener: (purchase: NitroPurchase) => void): void
|
|
328
|
+
addPurchaseUpdatedListener(listener: (purchase: NitroPurchase) => void): void;
|
|
330
329
|
|
|
331
330
|
/**
|
|
332
331
|
* Add a listener for purchase errors
|
|
333
332
|
* @param listener - Function to call when a purchase error occurs
|
|
334
333
|
*/
|
|
335
|
-
addPurchaseErrorListener(
|
|
334
|
+
addPurchaseErrorListener(
|
|
335
|
+
listener: (error: NitroPurchaseResult) => void,
|
|
336
|
+
): void;
|
|
336
337
|
|
|
337
338
|
/**
|
|
338
339
|
* Remove a purchase updated listener
|
|
339
340
|
* @param listener - Function to remove from listeners
|
|
340
341
|
*/
|
|
341
342
|
removePurchaseUpdatedListener(
|
|
342
|
-
listener: (purchase: NitroPurchase) => void
|
|
343
|
-
): void
|
|
343
|
+
listener: (purchase: NitroPurchase) => void,
|
|
344
|
+
): void;
|
|
344
345
|
|
|
345
346
|
/**
|
|
346
347
|
* Remove a purchase error listener
|
|
347
348
|
* @param listener - Function to remove from listeners
|
|
348
349
|
*/
|
|
349
350
|
removePurchaseErrorListener(
|
|
350
|
-
listener: (error: NitroPurchaseResult) => void
|
|
351
|
-
): void
|
|
351
|
+
listener: (error: NitroPurchaseResult) => void,
|
|
352
|
+
): void;
|
|
352
353
|
|
|
353
354
|
/**
|
|
354
355
|
* Add a listener for iOS promoted product events
|
|
355
356
|
* @param listener - Function to call when a promoted product is selected in the App Store
|
|
356
357
|
* @platform iOS
|
|
357
358
|
*/
|
|
358
|
-
addPromotedProductListenerIOS(
|
|
359
|
+
addPromotedProductListenerIOS(
|
|
360
|
+
listener: (product: NitroProduct) => void,
|
|
361
|
+
): void;
|
|
359
362
|
|
|
360
363
|
/**
|
|
361
364
|
* Remove a promoted product listener
|
|
@@ -363,50 +366,50 @@ export interface RnIap
|
|
|
363
366
|
* @platform iOS
|
|
364
367
|
*/
|
|
365
368
|
removePromotedProductListenerIOS(
|
|
366
|
-
listener: (product: NitroProduct) => void
|
|
367
|
-
): void
|
|
369
|
+
listener: (product: NitroProduct) => void,
|
|
370
|
+
): void;
|
|
368
371
|
|
|
369
372
|
/**
|
|
370
373
|
* Get the storefront identifier for the user's App Store account (iOS only)
|
|
371
374
|
* @returns Promise<string> - The storefront identifier (e.g., 'USA' for United States)
|
|
372
375
|
* @platform iOS
|
|
373
376
|
*/
|
|
374
|
-
getStorefrontIOS(): Promise<string
|
|
377
|
+
getStorefrontIOS(): Promise<string>;
|
|
375
378
|
|
|
376
379
|
/**
|
|
377
380
|
* Get the original app transaction ID if the app was purchased from the App Store (iOS only)
|
|
378
381
|
* @returns Promise<string | null> - The original app transaction ID or null if not purchased
|
|
379
382
|
* @platform iOS
|
|
380
383
|
*/
|
|
381
|
-
getAppTransactionIOS(): Promise<string | null
|
|
384
|
+
getAppTransactionIOS(): Promise<string | null>;
|
|
382
385
|
|
|
383
386
|
/**
|
|
384
387
|
* Request the promoted product from the App Store (iOS only)
|
|
385
388
|
* @returns Promise<NitroProduct | null> - The promoted product or null if none available
|
|
386
389
|
* @platform iOS
|
|
387
390
|
*/
|
|
388
|
-
requestPromotedProductIOS(): Promise<NitroProduct | null
|
|
391
|
+
requestPromotedProductIOS(): Promise<NitroProduct | null>;
|
|
389
392
|
|
|
390
393
|
/**
|
|
391
394
|
* Buy the promoted product from the App Store (iOS only)
|
|
392
395
|
* @returns Promise<void>
|
|
393
396
|
* @platform iOS
|
|
394
397
|
*/
|
|
395
|
-
buyPromotedProductIOS(): Promise<void
|
|
398
|
+
buyPromotedProductIOS(): Promise<void>;
|
|
396
399
|
|
|
397
400
|
/**
|
|
398
401
|
* Present the code redemption sheet for offer codes (iOS only)
|
|
399
402
|
* @returns Promise<boolean> - True if the sheet was presented successfully
|
|
400
403
|
* @platform iOS
|
|
401
404
|
*/
|
|
402
|
-
presentCodeRedemptionSheetIOS(): Promise<boolean
|
|
405
|
+
presentCodeRedemptionSheetIOS(): Promise<boolean>;
|
|
403
406
|
|
|
404
407
|
/**
|
|
405
408
|
* Clear unfinished transactions (iOS only)
|
|
406
409
|
* @returns Promise<void>
|
|
407
410
|
* @platform iOS
|
|
408
411
|
*/
|
|
409
|
-
clearTransactionIOS(): Promise<void
|
|
412
|
+
clearTransactionIOS(): Promise<void>;
|
|
410
413
|
|
|
411
414
|
/**
|
|
412
415
|
* Begin a refund request for a product (iOS 15+ only)
|
|
@@ -414,7 +417,7 @@ export interface RnIap
|
|
|
414
417
|
* @returns Promise<string | null> - The refund status or null if not available
|
|
415
418
|
* @platform iOS
|
|
416
419
|
*/
|
|
417
|
-
beginRefundRequestIOS(sku: string): Promise<string | null
|
|
420
|
+
beginRefundRequestIOS(sku: string): Promise<string | null>;
|
|
418
421
|
|
|
419
422
|
/**
|
|
420
423
|
* Get subscription status for a product (iOS only)
|
|
@@ -422,7 +425,7 @@ export interface RnIap
|
|
|
422
425
|
* @returns Promise<NitroSubscriptionStatus[] | null> - Array of subscription status objects
|
|
423
426
|
* @platform iOS
|
|
424
427
|
*/
|
|
425
|
-
subscriptionStatusIOS(sku: string): Promise<NitroSubscriptionStatus[] | null
|
|
428
|
+
subscriptionStatusIOS(sku: string): Promise<NitroSubscriptionStatus[] | null>;
|
|
426
429
|
|
|
427
430
|
/**
|
|
428
431
|
* Get current entitlement for a product (iOS only)
|
|
@@ -430,7 +433,7 @@ export interface RnIap
|
|
|
430
433
|
* @returns Promise<NitroPurchase | null> - Current entitlement or null
|
|
431
434
|
* @platform iOS
|
|
432
435
|
*/
|
|
433
|
-
currentEntitlementIOS(sku: string): Promise<NitroPurchase | null
|
|
436
|
+
currentEntitlementIOS(sku: string): Promise<NitroPurchase | null>;
|
|
434
437
|
|
|
435
438
|
/**
|
|
436
439
|
* Get latest transaction for a product (iOS only)
|
|
@@ -438,28 +441,28 @@ export interface RnIap
|
|
|
438
441
|
* @returns Promise<NitroPurchase | null> - Latest transaction or null
|
|
439
442
|
* @platform iOS
|
|
440
443
|
*/
|
|
441
|
-
latestTransactionIOS(sku: string): Promise<NitroPurchase | null
|
|
444
|
+
latestTransactionIOS(sku: string): Promise<NitroPurchase | null>;
|
|
442
445
|
|
|
443
446
|
/**
|
|
444
447
|
* Get pending transactions (iOS only)
|
|
445
448
|
* @returns Promise<NitroPurchase[]> - Array of pending transactions
|
|
446
449
|
* @platform iOS
|
|
447
450
|
*/
|
|
448
|
-
getPendingTransactionsIOS(): Promise<NitroPurchase[]
|
|
451
|
+
getPendingTransactionsIOS(): Promise<NitroPurchase[]>;
|
|
449
452
|
|
|
450
453
|
/**
|
|
451
454
|
* Sync with the App Store (iOS only)
|
|
452
455
|
* @returns Promise<boolean> - Success flag
|
|
453
456
|
* @platform iOS
|
|
454
457
|
*/
|
|
455
|
-
syncIOS(): Promise<boolean
|
|
458
|
+
syncIOS(): Promise<boolean>;
|
|
456
459
|
|
|
457
460
|
/**
|
|
458
461
|
* Show manage subscriptions screen (iOS only)
|
|
459
462
|
* @returns Promise<NitroPurchase[]> - Array of updated subscriptions with renewal info
|
|
460
463
|
* @platform iOS
|
|
461
464
|
*/
|
|
462
|
-
showManageSubscriptionsIOS(): Promise<NitroPurchase[]
|
|
465
|
+
showManageSubscriptionsIOS(): Promise<NitroPurchase[]>;
|
|
463
466
|
|
|
464
467
|
/**
|
|
465
468
|
* Check if user is eligible for intro offer (iOS only)
|
|
@@ -467,14 +470,14 @@ export interface RnIap
|
|
|
467
470
|
* @returns Promise<boolean> - Eligibility status
|
|
468
471
|
* @platform iOS
|
|
469
472
|
*/
|
|
470
|
-
isEligibleForIntroOfferIOS(groupID: string): Promise<boolean
|
|
473
|
+
isEligibleForIntroOfferIOS(groupID: string): Promise<boolean>;
|
|
471
474
|
|
|
472
475
|
/**
|
|
473
476
|
* Get receipt data (iOS only)
|
|
474
477
|
* @returns Promise<string> - Base64 encoded receipt data
|
|
475
478
|
* @platform iOS
|
|
476
479
|
*/
|
|
477
|
-
getReceiptDataIOS(): Promise<string
|
|
480
|
+
getReceiptDataIOS(): Promise<string>;
|
|
478
481
|
|
|
479
482
|
/**
|
|
480
483
|
* Check if transaction is verified (iOS only)
|
|
@@ -482,7 +485,7 @@ export interface RnIap
|
|
|
482
485
|
* @returns Promise<boolean> - Verification status
|
|
483
486
|
* @platform iOS
|
|
484
487
|
*/
|
|
485
|
-
isTransactionVerifiedIOS(sku: string): Promise<boolean
|
|
488
|
+
isTransactionVerifiedIOS(sku: string): Promise<boolean>;
|
|
486
489
|
|
|
487
490
|
/**
|
|
488
491
|
* Get transaction JWS representation (iOS only)
|
|
@@ -490,7 +493,7 @@ export interface RnIap
|
|
|
490
493
|
* @returns Promise<string | null> - JWS representation or null
|
|
491
494
|
* @platform iOS
|
|
492
495
|
*/
|
|
493
|
-
getTransactionJwsIOS(sku: string): Promise<string | null
|
|
496
|
+
getTransactionJwsIOS(sku: string): Promise<string | null>;
|
|
494
497
|
|
|
495
498
|
/**
|
|
496
499
|
* Validate a receipt on the appropriate platform
|
|
@@ -498,8 +501,8 @@ export interface RnIap
|
|
|
498
501
|
* @returns Promise<NitroReceiptValidationResultIOS | NitroReceiptValidationResultAndroid> - Platform-specific validation result
|
|
499
502
|
*/
|
|
500
503
|
validateReceipt(
|
|
501
|
-
params: NitroReceiptValidationParams
|
|
504
|
+
params: NitroReceiptValidationParams,
|
|
502
505
|
): Promise<
|
|
503
506
|
NitroReceiptValidationResultIOS | NitroReceiptValidationResultAndroid
|
|
504
|
-
|
|
507
|
+
>;
|
|
505
508
|
}
|