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/types.ts
CHANGED
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
// ============================================================================
|
|
14
14
|
|
|
15
15
|
export type ChangeEventPayload = {
|
|
16
|
-
value: string
|
|
17
|
-
}
|
|
16
|
+
value: string;
|
|
17
|
+
};
|
|
18
18
|
|
|
19
19
|
// iOS detailed product types (4 types)
|
|
20
20
|
export enum ProductTypeIOS {
|
|
@@ -33,26 +33,26 @@ export enum ProductTypeIOS {
|
|
|
33
33
|
*/
|
|
34
34
|
export type ProductCommon = {
|
|
35
35
|
/** Product identifier (SKU) */
|
|
36
|
-
id: string
|
|
36
|
+
id: string;
|
|
37
37
|
/** Product title displayed to users */
|
|
38
|
-
title: string
|
|
38
|
+
title: string;
|
|
39
39
|
/** Product description */
|
|
40
|
-
description: string
|
|
40
|
+
description: string;
|
|
41
41
|
/** Product type: 'inapp' or 'subs' for Android compatibility */
|
|
42
|
-
type: 'inapp' | 'subs' // Note: this is the actual product type, not for filtering
|
|
42
|
+
type: 'inapp' | 'subs'; // Note: this is the actual product type, not for filtering
|
|
43
43
|
/** Display name for the product */
|
|
44
|
-
displayName?: string
|
|
44
|
+
displayName?: string;
|
|
45
45
|
/** Formatted price string for display (e.g., "$9.99") */
|
|
46
|
-
displayPrice: string
|
|
46
|
+
displayPrice: string;
|
|
47
47
|
/** Currency code (e.g., "USD", "EUR") */
|
|
48
|
-
currency: string
|
|
48
|
+
currency: string;
|
|
49
49
|
/** Raw price value as number */
|
|
50
|
-
price?: number
|
|
50
|
+
price?: number;
|
|
51
51
|
/** Debug description for development */
|
|
52
|
-
debugDescription?: string
|
|
52
|
+
debugDescription?: string;
|
|
53
53
|
/** Platform identifier ('ios' or 'android') */
|
|
54
|
-
platform?: string
|
|
55
|
-
}
|
|
54
|
+
platform?: string;
|
|
55
|
+
};
|
|
56
56
|
|
|
57
57
|
/**
|
|
58
58
|
* Base purchase information shared across all platforms
|
|
@@ -60,28 +60,28 @@ export type ProductCommon = {
|
|
|
60
60
|
*/
|
|
61
61
|
export type PurchaseCommon = {
|
|
62
62
|
/** Transaction identifier - used by finishTransaction */
|
|
63
|
-
id: string
|
|
63
|
+
id: string;
|
|
64
64
|
/** Product identifier - which product was purchased */
|
|
65
|
-
productId: string
|
|
65
|
+
productId: string;
|
|
66
66
|
/** Product identifiers for purchases that include multiple products */
|
|
67
|
-
ids?: string[]
|
|
67
|
+
ids?: string[];
|
|
68
68
|
/** @deprecated - use id instead */
|
|
69
|
-
transactionId?: string
|
|
69
|
+
transactionId?: string;
|
|
70
70
|
/** Transaction timestamp in milliseconds */
|
|
71
|
-
transactionDate: number
|
|
71
|
+
transactionDate: number;
|
|
72
72
|
/** Transaction receipt for validation */
|
|
73
|
-
transactionReceipt: string
|
|
73
|
+
transactionReceipt: string;
|
|
74
74
|
/** Unified purchase token (jwsRepresentation for iOS, purchaseToken for Android) */
|
|
75
|
-
purchaseToken?: string
|
|
75
|
+
purchaseToken?: string;
|
|
76
76
|
/** Platform identifier ('ios' or 'android') */
|
|
77
|
-
platform?: string
|
|
77
|
+
platform?: string;
|
|
78
78
|
/** Purchase quantity (defaults to 1) */
|
|
79
|
-
quantity: number
|
|
79
|
+
quantity: number;
|
|
80
80
|
/** Purchase state (common field) */
|
|
81
|
-
purchaseState: PurchaseState
|
|
81
|
+
purchaseState: PurchaseState;
|
|
82
82
|
/** Auto-renewable subscription flag (common field) */
|
|
83
|
-
isAutoRenewing: boolean
|
|
84
|
-
}
|
|
83
|
+
isAutoRenewing: boolean;
|
|
84
|
+
};
|
|
85
85
|
|
|
86
86
|
export enum PurchaseState {
|
|
87
87
|
pending = 'pending',
|
|
@@ -93,143 +93,143 @@ export enum PurchaseState {
|
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
export type ProductSubscriptionCommon = ProductCommon & {
|
|
96
|
-
type: 'subs'
|
|
97
|
-
}
|
|
96
|
+
type: 'subs';
|
|
97
|
+
};
|
|
98
98
|
|
|
99
99
|
// ============================================================================
|
|
100
100
|
// PLATFORM TYPES
|
|
101
101
|
// ============================================================================
|
|
102
102
|
|
|
103
|
-
export type IosPlatform = {
|
|
104
|
-
export type AndroidPlatform = {
|
|
103
|
+
export type IosPlatform = {platform: 'ios'};
|
|
104
|
+
export type AndroidPlatform = {platform: 'android'};
|
|
105
105
|
|
|
106
106
|
// ============================================================================
|
|
107
107
|
// IOS TYPES
|
|
108
108
|
// ============================================================================
|
|
109
109
|
|
|
110
|
-
type SubscriptionIosPeriod = 'DAY' | 'WEEK' | 'MONTH' | 'YEAR' | ''
|
|
111
|
-
type PaymentMode = '' | 'FREETRIAL' | 'PAYASYOUGO' | 'PAYUPFRONT'
|
|
110
|
+
type SubscriptionIosPeriod = 'DAY' | 'WEEK' | 'MONTH' | 'YEAR' | '';
|
|
111
|
+
type PaymentMode = '' | 'FREETRIAL' | 'PAYASYOUGO' | 'PAYUPFRONT';
|
|
112
112
|
|
|
113
113
|
type SubscriptionOffer = {
|
|
114
|
-
displayPrice: string
|
|
115
|
-
id: string
|
|
116
|
-
paymentMode: PaymentMode
|
|
114
|
+
displayPrice: string;
|
|
115
|
+
id: string;
|
|
116
|
+
paymentMode: PaymentMode;
|
|
117
117
|
period: {
|
|
118
|
-
unit: SubscriptionIosPeriod
|
|
119
|
-
value: number
|
|
120
|
-
}
|
|
121
|
-
periodCount: number
|
|
122
|
-
price: number
|
|
123
|
-
type: 'introductory' | 'promotional'
|
|
124
|
-
}
|
|
118
|
+
unit: SubscriptionIosPeriod;
|
|
119
|
+
value: number;
|
|
120
|
+
};
|
|
121
|
+
periodCount: number;
|
|
122
|
+
price: number;
|
|
123
|
+
type: 'introductory' | 'promotional';
|
|
124
|
+
};
|
|
125
125
|
|
|
126
126
|
type SubscriptionInfo = {
|
|
127
|
-
introductoryOffer?: SubscriptionOffer
|
|
128
|
-
promotionalOffers?: SubscriptionOffer[]
|
|
129
|
-
subscriptionGroupId: string
|
|
127
|
+
introductoryOffer?: SubscriptionOffer;
|
|
128
|
+
promotionalOffers?: SubscriptionOffer[];
|
|
129
|
+
subscriptionGroupId: string;
|
|
130
130
|
subscriptionPeriod: {
|
|
131
|
-
unit: SubscriptionIosPeriod
|
|
132
|
-
value: number
|
|
133
|
-
}
|
|
134
|
-
}
|
|
131
|
+
unit: SubscriptionIosPeriod;
|
|
132
|
+
value: number;
|
|
133
|
+
};
|
|
134
|
+
};
|
|
135
135
|
|
|
136
136
|
export type Discount = {
|
|
137
|
-
identifier: string
|
|
138
|
-
type: string
|
|
139
|
-
numberOfPeriods: string
|
|
140
|
-
price: string
|
|
141
|
-
localizedPrice: string
|
|
142
|
-
paymentMode: PaymentMode
|
|
143
|
-
subscriptionPeriod: string
|
|
144
|
-
}
|
|
137
|
+
identifier: string;
|
|
138
|
+
type: string;
|
|
139
|
+
numberOfPeriods: string;
|
|
140
|
+
price: string;
|
|
141
|
+
localizedPrice: string;
|
|
142
|
+
paymentMode: PaymentMode;
|
|
143
|
+
subscriptionPeriod: string;
|
|
144
|
+
};
|
|
145
145
|
|
|
146
146
|
export type ProductIOS = ProductCommon & {
|
|
147
|
-
displayNameIOS: string
|
|
148
|
-
isFamilyShareableIOS: boolean
|
|
149
|
-
jsonRepresentationIOS: string
|
|
150
|
-
platform: 'ios'
|
|
151
|
-
subscriptionInfoIOS?: SubscriptionInfo
|
|
152
|
-
typeIOS: ProductTypeIOS // Detailed iOS product type
|
|
147
|
+
displayNameIOS: string;
|
|
148
|
+
isFamilyShareableIOS: boolean;
|
|
149
|
+
jsonRepresentationIOS: string;
|
|
150
|
+
platform: 'ios';
|
|
151
|
+
subscriptionInfoIOS?: SubscriptionInfo;
|
|
152
|
+
typeIOS: ProductTypeIOS; // Detailed iOS product type
|
|
153
153
|
// deprecated fields
|
|
154
|
-
displayName?: string
|
|
155
|
-
isFamilyShareable?: boolean
|
|
156
|
-
jsonRepresentation?: string
|
|
157
|
-
subscription?: SubscriptionInfo
|
|
158
|
-
introductoryPriceNumberOfPeriodsIOS?: string
|
|
159
|
-
introductoryPriceSubscriptionPeriodIOS?: SubscriptionIosPeriod
|
|
160
|
-
}
|
|
154
|
+
displayName?: string;
|
|
155
|
+
isFamilyShareable?: boolean;
|
|
156
|
+
jsonRepresentation?: string;
|
|
157
|
+
subscription?: SubscriptionInfo;
|
|
158
|
+
introductoryPriceNumberOfPeriodsIOS?: string;
|
|
159
|
+
introductoryPriceSubscriptionPeriodIOS?: SubscriptionIosPeriod;
|
|
160
|
+
};
|
|
161
161
|
|
|
162
162
|
export type ProductSubscriptionIOS = ProductIOS & {
|
|
163
|
-
discountsIOS?: Discount[]
|
|
164
|
-
introductoryPriceIOS?: string
|
|
165
|
-
introductoryPriceAsAmountIOS?: string
|
|
166
|
-
introductoryPricePaymentModeIOS?: PaymentMode
|
|
167
|
-
introductoryPriceNumberOfPeriodsIOS?: string
|
|
168
|
-
introductoryPriceSubscriptionPeriodIOS?: SubscriptionIosPeriod
|
|
169
|
-
platform: 'ios'
|
|
170
|
-
subscriptionPeriodNumberIOS?: string
|
|
171
|
-
subscriptionPeriodUnitIOS?: SubscriptionIosPeriod
|
|
163
|
+
discountsIOS?: Discount[];
|
|
164
|
+
introductoryPriceIOS?: string;
|
|
165
|
+
introductoryPriceAsAmountIOS?: string;
|
|
166
|
+
introductoryPricePaymentModeIOS?: PaymentMode;
|
|
167
|
+
introductoryPriceNumberOfPeriodsIOS?: string;
|
|
168
|
+
introductoryPriceSubscriptionPeriodIOS?: SubscriptionIosPeriod;
|
|
169
|
+
platform: 'ios';
|
|
170
|
+
subscriptionPeriodNumberIOS?: string;
|
|
171
|
+
subscriptionPeriodUnitIOS?: SubscriptionIosPeriod;
|
|
172
172
|
// deprecated
|
|
173
|
-
discounts?: Discount[]
|
|
174
|
-
introductoryPrice?: string
|
|
175
|
-
}
|
|
173
|
+
discounts?: Discount[];
|
|
174
|
+
introductoryPrice?: string;
|
|
175
|
+
};
|
|
176
176
|
|
|
177
177
|
export type PurchaseIOS = PurchaseCommon & {
|
|
178
|
-
platform: 'ios'
|
|
179
|
-
quantityIOS?: number
|
|
180
|
-
originalTransactionDateIOS?: number
|
|
181
|
-
originalTransactionIdentifierIOS?: string
|
|
182
|
-
appAccountToken?: string
|
|
178
|
+
platform: 'ios';
|
|
179
|
+
quantityIOS?: number;
|
|
180
|
+
originalTransactionDateIOS?: number;
|
|
181
|
+
originalTransactionIdentifierIOS?: string;
|
|
182
|
+
appAccountToken?: string;
|
|
183
183
|
// iOS additional fields from StoreKit 2
|
|
184
|
-
expirationDateIOS?: number
|
|
185
|
-
webOrderLineItemIdIOS?: number
|
|
186
|
-
environmentIOS?: string
|
|
187
|
-
storefrontCountryCodeIOS?: string
|
|
188
|
-
appBundleIdIOS?: string
|
|
189
|
-
productTypeIOS?: string
|
|
190
|
-
subscriptionGroupIdIOS?: string
|
|
191
|
-
isUpgradedIOS?: boolean
|
|
192
|
-
ownershipTypeIOS?: string
|
|
193
|
-
reasonIOS?: string
|
|
194
|
-
reasonStringRepresentationIOS?: string
|
|
195
|
-
transactionReasonIOS?: 'PURCHASE' | 'RENEWAL' | string
|
|
196
|
-
revocationDateIOS?: number
|
|
197
|
-
revocationReasonIOS?: string
|
|
184
|
+
expirationDateIOS?: number;
|
|
185
|
+
webOrderLineItemIdIOS?: number;
|
|
186
|
+
environmentIOS?: string;
|
|
187
|
+
storefrontCountryCodeIOS?: string;
|
|
188
|
+
appBundleIdIOS?: string;
|
|
189
|
+
productTypeIOS?: string;
|
|
190
|
+
subscriptionGroupIdIOS?: string;
|
|
191
|
+
isUpgradedIOS?: boolean;
|
|
192
|
+
ownershipTypeIOS?: string;
|
|
193
|
+
reasonIOS?: string;
|
|
194
|
+
reasonStringRepresentationIOS?: string;
|
|
195
|
+
transactionReasonIOS?: 'PURCHASE' | 'RENEWAL' | string;
|
|
196
|
+
revocationDateIOS?: number;
|
|
197
|
+
revocationReasonIOS?: string;
|
|
198
198
|
offerIOS?: {
|
|
199
|
-
id: string
|
|
200
|
-
type: string
|
|
201
|
-
paymentMode: string
|
|
202
|
-
}
|
|
199
|
+
id: string;
|
|
200
|
+
type: string;
|
|
201
|
+
paymentMode: string;
|
|
202
|
+
};
|
|
203
203
|
// Price locale fields
|
|
204
|
-
currencyCodeIOS?: string
|
|
205
|
-
currencySymbolIOS?: string
|
|
206
|
-
countryCodeIOS?: string
|
|
204
|
+
currencyCodeIOS?: string;
|
|
205
|
+
currencySymbolIOS?: string;
|
|
206
|
+
countryCodeIOS?: string;
|
|
207
207
|
/**
|
|
208
208
|
* @deprecated Use `purchaseToken` instead. This field will be removed in a future version.
|
|
209
209
|
* iOS 15+ JWS representation is now available through the `purchaseToken` field.
|
|
210
210
|
*/
|
|
211
|
-
jwsRepresentationIOS?: string
|
|
212
|
-
}
|
|
211
|
+
jwsRepresentationIOS?: string;
|
|
212
|
+
};
|
|
213
213
|
|
|
214
214
|
/**
|
|
215
215
|
* iOS subscription renewal info
|
|
216
216
|
*/
|
|
217
217
|
export interface SubscriptionRenewalInfoIOS {
|
|
218
|
-
autoRenewStatus: boolean
|
|
219
|
-
autoRenewPreference?: string
|
|
220
|
-
expirationReason?: number
|
|
221
|
-
gracePeriodExpirationDate?: number
|
|
222
|
-
currentProductID?: string
|
|
223
|
-
platform: 'ios'
|
|
218
|
+
autoRenewStatus: boolean;
|
|
219
|
+
autoRenewPreference?: string;
|
|
220
|
+
expirationReason?: number;
|
|
221
|
+
gracePeriodExpirationDate?: number;
|
|
222
|
+
currentProductID?: string;
|
|
223
|
+
platform: 'ios';
|
|
224
224
|
}
|
|
225
225
|
|
|
226
226
|
/**
|
|
227
227
|
* iOS subscription status entry
|
|
228
228
|
*/
|
|
229
229
|
export interface SubscriptionStatusIOS {
|
|
230
|
-
state: number
|
|
231
|
-
platform: 'ios'
|
|
232
|
-
renewalInfo?: SubscriptionRenewalInfoIOS
|
|
230
|
+
state: number;
|
|
231
|
+
platform: 'ios';
|
|
232
|
+
renewalInfo?: SubscriptionRenewalInfoIOS;
|
|
233
233
|
}
|
|
234
234
|
|
|
235
235
|
// ============================================================================
|
|
@@ -237,85 +237,85 @@ export interface SubscriptionStatusIOS {
|
|
|
237
237
|
// ============================================================================
|
|
238
238
|
|
|
239
239
|
type ProductAndroidOneTimePurchaseOfferDetail = {
|
|
240
|
-
priceCurrencyCode: string
|
|
241
|
-
formattedPrice: string
|
|
242
|
-
priceAmountMicros: string
|
|
243
|
-
}
|
|
240
|
+
priceCurrencyCode: string;
|
|
241
|
+
formattedPrice: string;
|
|
242
|
+
priceAmountMicros: string;
|
|
243
|
+
};
|
|
244
244
|
|
|
245
245
|
type PricingPhaseAndroid = {
|
|
246
|
-
formattedPrice: string
|
|
247
|
-
priceCurrencyCode: string
|
|
248
|
-
billingPeriod: string // P1W, P1M, P1Y
|
|
249
|
-
billingCycleCount: number
|
|
250
|
-
priceAmountMicros: string
|
|
251
|
-
recurrenceMode: number
|
|
252
|
-
}
|
|
246
|
+
formattedPrice: string;
|
|
247
|
+
priceCurrencyCode: string;
|
|
248
|
+
billingPeriod: string; // P1W, P1M, P1Y
|
|
249
|
+
billingCycleCount: number;
|
|
250
|
+
priceAmountMicros: string;
|
|
251
|
+
recurrenceMode: number;
|
|
252
|
+
};
|
|
253
253
|
|
|
254
254
|
type PricingPhasesAndroid = {
|
|
255
|
-
pricingPhaseList: PricingPhaseAndroid[]
|
|
256
|
-
}
|
|
255
|
+
pricingPhaseList: PricingPhaseAndroid[];
|
|
256
|
+
};
|
|
257
257
|
|
|
258
258
|
type ProductSubscriptionAndroidOfferDetail = {
|
|
259
|
-
basePlanId: string
|
|
260
|
-
offerId: string
|
|
261
|
-
offerToken: string
|
|
262
|
-
offerTags: string[]
|
|
263
|
-
pricingPhases: PricingPhasesAndroid
|
|
264
|
-
}
|
|
259
|
+
basePlanId: string;
|
|
260
|
+
offerId: string;
|
|
261
|
+
offerToken: string;
|
|
262
|
+
offerTags: string[];
|
|
263
|
+
pricingPhases: PricingPhasesAndroid;
|
|
264
|
+
};
|
|
265
265
|
|
|
266
266
|
type ProductSubscriptionAndroidOfferDetails = {
|
|
267
|
-
basePlanId: string
|
|
268
|
-
offerId: string | null
|
|
269
|
-
offerToken: string
|
|
270
|
-
pricingPhases: PricingPhasesAndroid
|
|
271
|
-
offerTags: string[]
|
|
272
|
-
}
|
|
267
|
+
basePlanId: string;
|
|
268
|
+
offerId: string | null;
|
|
269
|
+
offerToken: string;
|
|
270
|
+
pricingPhases: PricingPhasesAndroid;
|
|
271
|
+
offerTags: string[];
|
|
272
|
+
};
|
|
273
273
|
|
|
274
274
|
export type ProductAndroid = ProductCommon & {
|
|
275
|
-
nameAndroid: string
|
|
276
|
-
oneTimePurchaseOfferDetailsAndroid?: ProductAndroidOneTimePurchaseOfferDetail
|
|
277
|
-
platform: 'android'
|
|
278
|
-
subscriptionOfferDetailsAndroid?: ProductSubscriptionAndroidOfferDetail[]
|
|
275
|
+
nameAndroid: string;
|
|
276
|
+
oneTimePurchaseOfferDetailsAndroid?: ProductAndroidOneTimePurchaseOfferDetail;
|
|
277
|
+
platform: 'android';
|
|
278
|
+
subscriptionOfferDetailsAndroid?: ProductSubscriptionAndroidOfferDetail[];
|
|
279
279
|
// deprecated fields
|
|
280
|
-
name?: string
|
|
281
|
-
oneTimePurchaseOfferDetails?: ProductAndroidOneTimePurchaseOfferDetail
|
|
282
|
-
subscriptionOfferDetails?: ProductSubscriptionAndroidOfferDetail[]
|
|
283
|
-
}
|
|
280
|
+
name?: string;
|
|
281
|
+
oneTimePurchaseOfferDetails?: ProductAndroidOneTimePurchaseOfferDetail;
|
|
282
|
+
subscriptionOfferDetails?: ProductSubscriptionAndroidOfferDetail[];
|
|
283
|
+
};
|
|
284
284
|
|
|
285
285
|
export type ProductSubscriptionAndroid = ProductAndroid & {
|
|
286
|
-
subscriptionOfferDetailsAndroid: ProductSubscriptionAndroidOfferDetails[]
|
|
286
|
+
subscriptionOfferDetailsAndroid: ProductSubscriptionAndroidOfferDetails[];
|
|
287
287
|
// deprecated
|
|
288
|
-
subscriptionOfferDetails?: ProductSubscriptionAndroidOfferDetails[]
|
|
289
|
-
}
|
|
288
|
+
subscriptionOfferDetails?: ProductSubscriptionAndroidOfferDetails[];
|
|
289
|
+
};
|
|
290
290
|
|
|
291
291
|
export type PurchaseAndroid = PurchaseCommon & {
|
|
292
|
-
platform: 'android'
|
|
292
|
+
platform: 'android';
|
|
293
293
|
/**
|
|
294
294
|
* @deprecated Use `purchaseToken` instead. This field will be removed in a future version.
|
|
295
295
|
*/
|
|
296
|
-
purchaseTokenAndroid?: string
|
|
297
|
-
dataAndroid?: string
|
|
298
|
-
signatureAndroid?: string
|
|
296
|
+
purchaseTokenAndroid?: string;
|
|
297
|
+
dataAndroid?: string;
|
|
298
|
+
signatureAndroid?: string;
|
|
299
299
|
/** @deprecated Use the common `isAutoRenewing` field instead */
|
|
300
|
-
autoRenewingAndroid?: boolean
|
|
301
|
-
isAcknowledgedAndroid?: boolean
|
|
302
|
-
packageNameAndroid?: string
|
|
303
|
-
developerPayloadAndroid?: string
|
|
304
|
-
obfuscatedAccountIdAndroid?: string
|
|
305
|
-
obfuscatedProfileIdAndroid?: string
|
|
306
|
-
}
|
|
300
|
+
autoRenewingAndroid?: boolean;
|
|
301
|
+
isAcknowledgedAndroid?: boolean;
|
|
302
|
+
packageNameAndroid?: string;
|
|
303
|
+
developerPayloadAndroid?: string;
|
|
304
|
+
obfuscatedAccountIdAndroid?: string;
|
|
305
|
+
obfuscatedProfileIdAndroid?: string;
|
|
306
|
+
};
|
|
307
307
|
|
|
308
308
|
// ============================================================================
|
|
309
309
|
// TYPE ALIASES
|
|
310
310
|
// ============================================================================
|
|
311
311
|
|
|
312
312
|
// Legacy naming for backward compatibility
|
|
313
|
-
export type ProductPurchaseIOS = PurchaseIOS
|
|
314
|
-
export type ProductPurchaseAndroid = PurchaseAndroid
|
|
313
|
+
export type ProductPurchaseIOS = PurchaseIOS;
|
|
314
|
+
export type ProductPurchaseAndroid = PurchaseAndroid;
|
|
315
315
|
|
|
316
316
|
// Legacy naming for backward compatibility
|
|
317
|
-
export type SubscriptionProductIOS = ProductSubscriptionIOS
|
|
318
|
-
export type SubscriptionProductAndroid = ProductSubscriptionAndroid
|
|
317
|
+
export type SubscriptionProductIOS = ProductSubscriptionIOS;
|
|
318
|
+
export type SubscriptionProductAndroid = ProductSubscriptionAndroid;
|
|
319
319
|
|
|
320
320
|
// ============================================================================
|
|
321
321
|
// UNION TYPES
|
|
@@ -324,11 +324,11 @@ export type SubscriptionProductAndroid = ProductSubscriptionAndroid
|
|
|
324
324
|
// Product Union Types
|
|
325
325
|
export type Product =
|
|
326
326
|
| (ProductAndroid & AndroidPlatform)
|
|
327
|
-
| (ProductIOS & IosPlatform)
|
|
327
|
+
| (ProductIOS & IosPlatform);
|
|
328
328
|
|
|
329
329
|
export type SubscriptionProduct =
|
|
330
330
|
| (ProductSubscriptionAndroid & AndroidPlatform)
|
|
331
|
-
| (ProductSubscriptionIOS & IosPlatform)
|
|
331
|
+
| (ProductSubscriptionIOS & IosPlatform);
|
|
332
332
|
|
|
333
333
|
// Purchase Union Types
|
|
334
334
|
/**
|
|
@@ -337,15 +337,15 @@ export type SubscriptionProduct =
|
|
|
337
337
|
*/
|
|
338
338
|
export type ProductPurchase =
|
|
339
339
|
| (PurchaseAndroid & AndroidPlatform)
|
|
340
|
-
| (PurchaseIOS & IosPlatform)
|
|
340
|
+
| (PurchaseIOS & IosPlatform);
|
|
341
341
|
|
|
342
342
|
/**
|
|
343
343
|
* Active subscription purchase
|
|
344
344
|
* Appears in getAvailablePurchases while subscription is active
|
|
345
345
|
*/
|
|
346
346
|
export type SubscriptionPurchase =
|
|
347
|
-
| (PurchaseAndroid & AndroidPlatform & {
|
|
348
|
-
| (PurchaseIOS & IosPlatform)
|
|
347
|
+
| (PurchaseAndroid & AndroidPlatform & {autoRenewingAndroid: boolean})
|
|
348
|
+
| (PurchaseIOS & IosPlatform);
|
|
349
349
|
|
|
350
350
|
/**
|
|
351
351
|
* Combined purchase type that includes all purchase types
|
|
@@ -353,7 +353,7 @@ export type SubscriptionPurchase =
|
|
|
353
353
|
*/
|
|
354
354
|
export type Purchase =
|
|
355
355
|
| (PurchaseAndroid & AndroidPlatform)
|
|
356
|
-
| (PurchaseIOS & IosPlatform)
|
|
356
|
+
| (PurchaseIOS & IosPlatform);
|
|
357
357
|
|
|
358
358
|
// ============================================================================
|
|
359
359
|
// REQUEST TYPES
|
|
@@ -362,53 +362,53 @@ export type Purchase =
|
|
|
362
362
|
// Product request parameters for fetching products from the store
|
|
363
363
|
export interface ProductRequest {
|
|
364
364
|
/** Product SKUs to fetch */
|
|
365
|
-
skus: string[]
|
|
365
|
+
skus: string[];
|
|
366
366
|
/** Filter type: "inapp" (default), "subs", or "all" */
|
|
367
|
-
type?: 'inapp' | 'subs' | 'all'
|
|
367
|
+
type?: 'inapp' | 'subs' | 'all';
|
|
368
368
|
}
|
|
369
369
|
|
|
370
370
|
// iOS-specific purchase request parameters
|
|
371
371
|
export interface RequestPurchaseIosProps {
|
|
372
|
-
readonly sku: string
|
|
373
|
-
readonly andDangerouslyFinishTransactionAutomatically?: boolean
|
|
374
|
-
readonly appAccountToken?: string
|
|
375
|
-
readonly quantity?: number
|
|
376
|
-
readonly withOffer?: DiscountOffer
|
|
372
|
+
readonly sku: string;
|
|
373
|
+
readonly andDangerouslyFinishTransactionAutomatically?: boolean;
|
|
374
|
+
readonly appAccountToken?: string;
|
|
375
|
+
readonly quantity?: number;
|
|
376
|
+
readonly withOffer?: DiscountOffer;
|
|
377
377
|
}
|
|
378
378
|
|
|
379
379
|
// Android-specific purchase request parameters
|
|
380
380
|
export interface RequestPurchaseAndroidProps {
|
|
381
|
-
readonly skus: string[]
|
|
382
|
-
readonly obfuscatedAccountIdAndroid?: string
|
|
383
|
-
readonly obfuscatedProfileIdAndroid?: string
|
|
384
|
-
readonly isOfferPersonalized?: boolean
|
|
381
|
+
readonly skus: string[];
|
|
382
|
+
readonly obfuscatedAccountIdAndroid?: string;
|
|
383
|
+
readonly obfuscatedProfileIdAndroid?: string;
|
|
384
|
+
readonly isOfferPersonalized?: boolean;
|
|
385
385
|
}
|
|
386
386
|
|
|
387
387
|
// Android-specific subscription request parameters
|
|
388
388
|
export interface RequestSubscriptionAndroidProps
|
|
389
389
|
extends RequestPurchaseAndroidProps {
|
|
390
|
-
readonly purchaseTokenAndroid?: string
|
|
391
|
-
readonly replacementModeAndroid?: number
|
|
390
|
+
readonly purchaseTokenAndroid?: string;
|
|
391
|
+
readonly replacementModeAndroid?: number;
|
|
392
392
|
readonly subscriptionOffers: {
|
|
393
|
-
sku: string
|
|
394
|
-
offerToken: string
|
|
395
|
-
}[]
|
|
393
|
+
sku: string;
|
|
394
|
+
offerToken: string;
|
|
395
|
+
}[];
|
|
396
396
|
}
|
|
397
397
|
|
|
398
398
|
// Platform-specific request structures
|
|
399
399
|
export interface RequestPurchasePropsByPlatforms {
|
|
400
|
-
readonly ios?: RequestPurchaseIosProps
|
|
401
|
-
readonly android?: RequestPurchaseAndroidProps
|
|
400
|
+
readonly ios?: RequestPurchaseIosProps;
|
|
401
|
+
readonly android?: RequestPurchaseAndroidProps;
|
|
402
402
|
}
|
|
403
403
|
|
|
404
404
|
export interface RequestSubscriptionPropsByPlatforms {
|
|
405
|
-
readonly ios?: RequestPurchaseIosProps
|
|
406
|
-
readonly android?: RequestSubscriptionAndroidProps
|
|
405
|
+
readonly ios?: RequestPurchaseIosProps;
|
|
406
|
+
readonly android?: RequestSubscriptionAndroidProps;
|
|
407
407
|
}
|
|
408
408
|
|
|
409
409
|
// Modern request types (v2.7.0+)
|
|
410
|
-
export type RequestPurchaseProps = RequestPurchasePropsByPlatforms
|
|
411
|
-
export type RequestSubscriptionProps = RequestSubscriptionPropsByPlatforms
|
|
410
|
+
export type RequestPurchaseProps = RequestPurchasePropsByPlatforms;
|
|
411
|
+
export type RequestSubscriptionProps = RequestSubscriptionPropsByPlatforms;
|
|
412
412
|
|
|
413
413
|
// ============================================================================
|
|
414
414
|
// ERROR TYPES
|
|
@@ -451,41 +451,41 @@ export enum ErrorCode {
|
|
|
451
451
|
}
|
|
452
452
|
|
|
453
453
|
export type PurchaseResult = {
|
|
454
|
-
responseCode?: number
|
|
455
|
-
debugMessage?: string
|
|
456
|
-
code?: string
|
|
457
|
-
message?: string
|
|
454
|
+
responseCode?: number;
|
|
455
|
+
debugMessage?: string;
|
|
456
|
+
code?: string;
|
|
457
|
+
message?: string;
|
|
458
458
|
/**
|
|
459
459
|
* @deprecated Use `purchaseToken` instead. This field will be removed in a future version.
|
|
460
460
|
*/
|
|
461
|
-
purchaseTokenAndroid?: string
|
|
462
|
-
purchaseToken?: string
|
|
463
|
-
}
|
|
461
|
+
purchaseTokenAndroid?: string;
|
|
462
|
+
purchaseToken?: string;
|
|
463
|
+
};
|
|
464
464
|
|
|
465
465
|
// Additional iOS types
|
|
466
466
|
export type DiscountOffer = {
|
|
467
|
-
identifier: string
|
|
468
|
-
keyIdentifier: string
|
|
469
|
-
nonce: string
|
|
470
|
-
signature: string
|
|
471
|
-
timestamp: number
|
|
472
|
-
}
|
|
467
|
+
identifier: string;
|
|
468
|
+
keyIdentifier: string;
|
|
469
|
+
nonce: string;
|
|
470
|
+
signature: string;
|
|
471
|
+
timestamp: number;
|
|
472
|
+
};
|
|
473
473
|
|
|
474
474
|
export type AppTransactionIOS = {
|
|
475
|
-
appTransactionId?: string
|
|
476
|
-
originalPlatform?: string
|
|
477
|
-
bundleId: string
|
|
478
|
-
appVersion: string
|
|
479
|
-
originalAppVersion: string
|
|
480
|
-
originalPurchaseDate: number
|
|
481
|
-
deviceVerification: string
|
|
482
|
-
deviceVerificationNonce: string
|
|
483
|
-
environment: string
|
|
484
|
-
signedDate: number
|
|
485
|
-
appId?: number
|
|
486
|
-
appVersionId?: number
|
|
487
|
-
preorderDate?: number
|
|
488
|
-
}
|
|
475
|
+
appTransactionId?: string;
|
|
476
|
+
originalPlatform?: string;
|
|
477
|
+
bundleId: string;
|
|
478
|
+
appVersion: string;
|
|
479
|
+
originalAppVersion: string;
|
|
480
|
+
originalPurchaseDate: number;
|
|
481
|
+
deviceVerification: string;
|
|
482
|
+
deviceVerificationNonce: string;
|
|
483
|
+
environment: string;
|
|
484
|
+
signedDate: number;
|
|
485
|
+
appId?: number;
|
|
486
|
+
appVersionId?: number;
|
|
487
|
+
preorderDate?: number;
|
|
488
|
+
};
|
|
489
489
|
|
|
490
490
|
// ============================================================================
|
|
491
491
|
// METHOD OPTIONS TYPES
|
|
@@ -496,9 +496,9 @@ export type AppTransactionIOS = {
|
|
|
496
496
|
*/
|
|
497
497
|
export interface PurchaseOptions {
|
|
498
498
|
/** Whether to also publish purchases to event listener */
|
|
499
|
-
alsoPublishToEventListenerIOS?: boolean
|
|
499
|
+
alsoPublishToEventListenerIOS?: boolean;
|
|
500
500
|
/** Whether to only include active items (subscriptions that are still active) */
|
|
501
|
-
onlyIncludeActiveItemsIOS?: boolean
|
|
501
|
+
onlyIncludeActiveItemsIOS?: boolean;
|
|
502
502
|
}
|
|
503
503
|
|
|
504
504
|
/**
|
|
@@ -506,7 +506,7 @@ export interface PurchaseOptions {
|
|
|
506
506
|
*/
|
|
507
507
|
export interface FinishTransactionParams {
|
|
508
508
|
/** The purchase to finish/consume */
|
|
509
|
-
purchase: Purchase
|
|
509
|
+
purchase: Purchase;
|
|
510
510
|
/**
|
|
511
511
|
* Whether this is a consumable product that should be consumed.
|
|
512
512
|
* - Set to true for consumable products (e.g., "20 credits", "100 coins")
|
|
@@ -515,7 +515,7 @@ export interface FinishTransactionParams {
|
|
|
515
515
|
* Note: On iOS, this flag doesn't affect behavior as StoreKit handles this automatically.
|
|
516
516
|
* On Android, consumables must be consumed to allow repurchase.
|
|
517
517
|
*/
|
|
518
|
-
isConsumable?: boolean
|
|
518
|
+
isConsumable?: boolean;
|
|
519
519
|
}
|
|
520
520
|
|
|
521
521
|
// ============================================================================
|
|
@@ -527,30 +527,30 @@ export interface FinishTransactionParams {
|
|
|
527
527
|
*/
|
|
528
528
|
export interface IapContext {
|
|
529
529
|
/** Current list of available products */
|
|
530
|
-
products: Product[]
|
|
530
|
+
products: Product[];
|
|
531
531
|
/** Current list of available subscription products */
|
|
532
|
-
subscriptions: SubscriptionProduct[]
|
|
532
|
+
subscriptions: SubscriptionProduct[];
|
|
533
533
|
/**
|
|
534
534
|
* List of available purchases (includes all types):
|
|
535
535
|
* - Consumables: Not yet consumed/finished
|
|
536
536
|
* - Non-consumables: Not yet finished
|
|
537
537
|
* - Subscriptions: Currently active
|
|
538
538
|
*/
|
|
539
|
-
availablePurchases: Purchase[]
|
|
539
|
+
availablePurchases: Purchase[];
|
|
540
540
|
/** Currently promoted product (iOS only) */
|
|
541
|
-
promotedProduct?: Product
|
|
541
|
+
promotedProduct?: Product;
|
|
542
542
|
/** Current purchase being processed */
|
|
543
|
-
currentPurchase?: Purchase
|
|
543
|
+
currentPurchase?: Purchase;
|
|
544
544
|
/** Purchase error if any */
|
|
545
|
-
purchaseError?: PurchaseError
|
|
545
|
+
purchaseError?: PurchaseError;
|
|
546
546
|
|
|
547
547
|
// Connection methods
|
|
548
548
|
/** Initialize connection to the store */
|
|
549
|
-
initConnection(): Promise<boolean
|
|
549
|
+
initConnection(): Promise<boolean>;
|
|
550
550
|
/** End connection to the store */
|
|
551
|
-
endConnection(): Promise<boolean
|
|
551
|
+
endConnection(): Promise<boolean>;
|
|
552
552
|
/** Sync purchases (iOS only) */
|
|
553
|
-
sync(): Promise<void
|
|
553
|
+
sync(): Promise<void>;
|
|
554
554
|
|
|
555
555
|
// Product methods
|
|
556
556
|
/**
|
|
@@ -559,9 +559,9 @@ export interface IapContext {
|
|
|
559
559
|
* @param params.type - Type of products: 'inapp' for regular products, 'subs' for subscriptions, 'all' to fetch both. Defaults to 'inapp'
|
|
560
560
|
*/
|
|
561
561
|
fetchProducts(params: {
|
|
562
|
-
skus: string[]
|
|
563
|
-
type?: 'inapp' | 'subs' | 'all' // Defaults to 'inapp'
|
|
564
|
-
}): Promise<Product[] | SubscriptionProduct[]
|
|
562
|
+
skus: string[];
|
|
563
|
+
type?: 'inapp' | 'subs' | 'all'; // Defaults to 'inapp'
|
|
564
|
+
}): Promise<Product[] | SubscriptionProduct[]>;
|
|
565
565
|
|
|
566
566
|
// Purchase methods
|
|
567
567
|
/**
|
|
@@ -570,9 +570,9 @@ export interface IapContext {
|
|
|
570
570
|
* @param params.type - Type of purchase: 'inapp' for products or 'subs' for subscriptions
|
|
571
571
|
*/
|
|
572
572
|
requestPurchase(params: {
|
|
573
|
-
request: RequestPurchaseProps | RequestSubscriptionProps
|
|
574
|
-
type?: 'inapp' | 'subs' // defaults to 'inapp'
|
|
575
|
-
}): Promise<Purchase | Purchase[] | void
|
|
573
|
+
request: RequestPurchaseProps | RequestSubscriptionProps;
|
|
574
|
+
type?: 'inapp' | 'subs'; // defaults to 'inapp'
|
|
575
|
+
}): Promise<Purchase | Purchase[] | void>;
|
|
576
576
|
/**
|
|
577
577
|
* Finish a transaction and consume if applicable.
|
|
578
578
|
* IMPORTANT: Every purchase must be finished to complete the transaction.
|
|
@@ -580,8 +580,8 @@ export interface IapContext {
|
|
|
580
580
|
* - For non-consumables & subscriptions: Set isConsumable=false or omit
|
|
581
581
|
*/
|
|
582
582
|
finishTransaction(
|
|
583
|
-
params: FinishTransactionParams
|
|
584
|
-
): Promise<PurchaseResult | boolean
|
|
583
|
+
params: FinishTransactionParams,
|
|
584
|
+
): Promise<PurchaseResult | boolean>;
|
|
585
585
|
|
|
586
586
|
// Purchase history methods
|
|
587
587
|
/**
|
|
@@ -591,19 +591,19 @@ export interface IapContext {
|
|
|
591
591
|
* - Non-consumables that haven't been finished
|
|
592
592
|
* - Active subscriptions
|
|
593
593
|
*/
|
|
594
|
-
getAvailablePurchases(options?: PurchaseOptions): Promise<Purchase[]
|
|
594
|
+
getAvailablePurchases(options?: PurchaseOptions): Promise<Purchase[]>;
|
|
595
595
|
|
|
596
596
|
// Receipt validation
|
|
597
597
|
/** Validate a receipt (server-side validation recommended) */
|
|
598
598
|
validateReceipt(
|
|
599
599
|
sku: string,
|
|
600
600
|
androidOptions?: {
|
|
601
|
-
packageName: string
|
|
602
|
-
productToken: string
|
|
603
|
-
accessToken: string
|
|
604
|
-
isSub?: boolean
|
|
605
|
-
}
|
|
606
|
-
): Promise<ReceiptValidationResult
|
|
601
|
+
packageName: string;
|
|
602
|
+
productToken: string;
|
|
603
|
+
accessToken: string;
|
|
604
|
+
isSub?: boolean;
|
|
605
|
+
},
|
|
606
|
+
): Promise<ReceiptValidationResult>;
|
|
607
607
|
}
|
|
608
608
|
|
|
609
609
|
/**
|
|
@@ -611,11 +611,11 @@ export interface IapContext {
|
|
|
611
611
|
*/
|
|
612
612
|
export interface PurchaseError {
|
|
613
613
|
/** Error code constant */
|
|
614
|
-
code: string
|
|
614
|
+
code: string;
|
|
615
615
|
/** Human-readable error message */
|
|
616
|
-
message: string
|
|
616
|
+
message: string;
|
|
617
617
|
/** Related product SKU */
|
|
618
|
-
productId?: string
|
|
618
|
+
productId?: string;
|
|
619
619
|
}
|
|
620
620
|
|
|
621
621
|
/**
|
|
@@ -623,14 +623,14 @@ export interface PurchaseError {
|
|
|
623
623
|
*/
|
|
624
624
|
export interface ReceiptValidationProps {
|
|
625
625
|
/** Product SKU to validate */
|
|
626
|
-
sku: string
|
|
626
|
+
sku: string;
|
|
627
627
|
/** Android-specific validation options */
|
|
628
628
|
androidOptions?: {
|
|
629
|
-
packageName: string
|
|
630
|
-
productToken: string
|
|
631
|
-
accessToken: string
|
|
632
|
-
isSub?: boolean
|
|
633
|
-
}
|
|
629
|
+
packageName: string;
|
|
630
|
+
productToken: string;
|
|
631
|
+
accessToken: string;
|
|
632
|
+
isSub?: boolean;
|
|
633
|
+
};
|
|
634
634
|
}
|
|
635
635
|
|
|
636
636
|
/**
|
|
@@ -638,37 +638,37 @@ export interface ReceiptValidationProps {
|
|
|
638
638
|
*/
|
|
639
639
|
export interface ReceiptValidationResultIOS {
|
|
640
640
|
/** Whether the receipt is valid */
|
|
641
|
-
isValid: boolean
|
|
641
|
+
isValid: boolean;
|
|
642
642
|
/** Receipt data string */
|
|
643
|
-
receiptData: string
|
|
643
|
+
receiptData: string;
|
|
644
644
|
/** JWS representation */
|
|
645
|
-
jwsRepresentation: string
|
|
645
|
+
jwsRepresentation: string;
|
|
646
646
|
/** Latest transaction if available */
|
|
647
|
-
latestTransaction?: Purchase
|
|
647
|
+
latestTransaction?: Purchase;
|
|
648
648
|
}
|
|
649
649
|
|
|
650
650
|
/**
|
|
651
651
|
* Android receipt validation result
|
|
652
652
|
*/
|
|
653
653
|
export interface ReceiptValidationResultAndroid {
|
|
654
|
-
autoRenewing: boolean
|
|
655
|
-
betaProduct: boolean
|
|
656
|
-
cancelDate: number | null
|
|
657
|
-
cancelReason: string
|
|
658
|
-
deferredDate: number | null
|
|
659
|
-
deferredSku: number | null
|
|
660
|
-
freeTrialEndDate: number
|
|
661
|
-
gracePeriodEndDate: number
|
|
662
|
-
parentProductId: string
|
|
663
|
-
productId: string
|
|
664
|
-
productType: 'inapp' | 'subs'
|
|
665
|
-
purchaseDate: number
|
|
666
|
-
quantity: number
|
|
667
|
-
receiptId: string
|
|
668
|
-
renewalDate: number
|
|
669
|
-
term: string
|
|
670
|
-
termSku: string
|
|
671
|
-
testTransaction: boolean
|
|
654
|
+
autoRenewing: boolean;
|
|
655
|
+
betaProduct: boolean;
|
|
656
|
+
cancelDate: number | null;
|
|
657
|
+
cancelReason: string;
|
|
658
|
+
deferredDate: number | null;
|
|
659
|
+
deferredSku: number | null;
|
|
660
|
+
freeTrialEndDate: number;
|
|
661
|
+
gracePeriodEndDate: number;
|
|
662
|
+
parentProductId: string;
|
|
663
|
+
productId: string;
|
|
664
|
+
productType: 'inapp' | 'subs';
|
|
665
|
+
purchaseDate: number;
|
|
666
|
+
quantity: number;
|
|
667
|
+
receiptId: string;
|
|
668
|
+
renewalDate: number;
|
|
669
|
+
term: string;
|
|
670
|
+
termSku: string;
|
|
671
|
+
testTransaction: boolean;
|
|
672
672
|
}
|
|
673
673
|
|
|
674
674
|
/**
|
|
@@ -676,30 +676,30 @@ export interface ReceiptValidationResultAndroid {
|
|
|
676
676
|
*/
|
|
677
677
|
export type ReceiptValidationResult =
|
|
678
678
|
| ReceiptValidationResultAndroid
|
|
679
|
-
| ReceiptValidationResultIOS
|
|
679
|
+
| ReceiptValidationResultIOS;
|
|
680
680
|
|
|
681
681
|
/**
|
|
682
682
|
* Represents an active subscription with platform-specific details
|
|
683
683
|
*/
|
|
684
684
|
export interface ActiveSubscription {
|
|
685
685
|
/** Product identifier (SKU) of the subscription */
|
|
686
|
-
productId: string
|
|
686
|
+
productId: string;
|
|
687
687
|
/** Whether the subscription is currently active */
|
|
688
|
-
isActive: boolean
|
|
688
|
+
isActive: boolean;
|
|
689
689
|
/** Transaction identifier for backend validation */
|
|
690
|
-
transactionId: string
|
|
690
|
+
transactionId: string;
|
|
691
691
|
/** JWT token (iOS) or purchase token (Android) for backend validation */
|
|
692
|
-
purchaseToken?: string
|
|
692
|
+
purchaseToken?: string;
|
|
693
693
|
/** Transaction timestamp */
|
|
694
|
-
transactionDate: number
|
|
694
|
+
transactionDate: number;
|
|
695
695
|
/** iOS: Subscription expiration date */
|
|
696
|
-
expirationDateIOS?: Date
|
|
696
|
+
expirationDateIOS?: Date;
|
|
697
697
|
/** @deprecated Use the common `isAutoRenewing` field instead */
|
|
698
|
-
autoRenewingAndroid?: boolean
|
|
698
|
+
autoRenewingAndroid?: boolean;
|
|
699
699
|
/** iOS: Environment where the subscription was purchased (Production/Sandbox) */
|
|
700
|
-
environmentIOS?: string
|
|
700
|
+
environmentIOS?: string;
|
|
701
701
|
/** Whether the subscription will expire soon (typically within 7 days) */
|
|
702
|
-
willExpireSoon?: boolean
|
|
702
|
+
willExpireSoon?: boolean;
|
|
703
703
|
/** iOS: Number of days until the subscription expires */
|
|
704
|
-
daysUntilExpirationIOS?: number
|
|
704
|
+
daysUntilExpirationIOS?: number;
|
|
705
705
|
}
|