react-native-iap 14.3.2-rc.9 → 14.3.3-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.d.ts +8 -0
- package/lib/index.js +36 -0
- package/lib/module/helpers/subscription.js +2 -2
- package/lib/module/helpers/subscription.js.map +1 -1
- package/lib/module/hooks/useIAP.js +14 -8
- package/lib/module/hooks/useIAP.js.map +1 -1
- package/lib/module/index.js +87 -30
- package/lib/module/index.js.map +1 -1
- package/lib/module/types.js +90 -190
- package/lib/module/types.js.map +1 -1
- package/lib/module/utils/error.js +4 -4
- package/lib/module/utils/error.js.map +1 -1
- package/lib/module/utils/errorMapping.js +34 -10
- package/lib/module/utils/errorMapping.js.map +1 -1
- package/lib/module/utils/type-bridge.js +217 -173
- package/lib/module/utils/type-bridge.js.map +1 -1
- package/lib/specs/RnIap.nitro.d.ts +7 -0
- package/lib/specs/RnIap.nitro.js +1 -0
- 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 +8 -11
- package/lib/typescript/src/hooks/useIAP.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +11 -10
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/specs/RnIap.nitro.d.ts +2 -2
- package/lib/typescript/src/types.d.ts +606 -518
- package/lib/typescript/src/types.d.ts.map +1 -1
- package/lib/typescript/src/utils/errorMapping.d.ts +2 -1
- package/lib/typescript/src/utils/errorMapping.d.ts.map +1 -1
- package/lib/typescript/src/utils/type-bridge.d.ts +13 -14
- package/lib/typescript/src/utils/type-bridge.d.ts.map +1 -1
- package/nitrogen/generated/android/c++/JHybridRnIapSpec.cpp +4 -4
- package/nitrogen/generated/android/c++/{JNitroAndroidReceiptValidationOptions.hpp → JNitroReceiptValidationAndroidOptions.hpp} +9 -9
- package/nitrogen/generated/android/c++/JNitroReceiptValidationParams.hpp +5 -5
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/{NitroAndroidReceiptValidationOptions.kt → NitroReceiptValidationAndroidOptions.kt} +3 -3
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroReceiptValidationParams.kt +1 -1
- package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Bridge.hpp +10 -10
- package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Umbrella.hpp +3 -3
- package/nitrogen/generated/ios/c++/HybridRnIapSpecSwift.hpp +3 -3
- package/nitrogen/generated/ios/swift/{NitroAndroidReceiptValidationOptions.swift → NitroReceiptValidationAndroidOptions.swift} +5 -5
- package/nitrogen/generated/ios/swift/NitroReceiptValidationParams.swift +9 -9
- package/nitrogen/generated/shared/c++/{NitroAndroidReceiptValidationOptions.hpp → NitroReceiptValidationAndroidOptions.hpp} +10 -10
- package/nitrogen/generated/shared/c++/NitroReceiptValidationParams.hpp +8 -8
- package/package.json +1 -1
- package/plugin/src/withIAP.ts +4 -2
- package/src/helpers/subscription.ts +8 -9
- package/src/hooks/useIAP.ts +52 -47
- package/src/index.ts +141 -45
- package/src/specs/RnIap.nitro.ts +2 -2
- package/src/types.ts +651 -616
- package/src/utils/error.ts +4 -4
- package/src/utils/errorMapping.ts +47 -19
- package/src/utils/type-bridge.ts +308 -204
- package/lib/commonjs/index.js +0 -36
- package/lib/commonjs/index.js.map +0 -1
- package/lib/commonjs/package.json +0 -1
- package/lib/commonjs/specs/RnIap.nitro.js +0 -6
- package/lib/commonjs/specs/RnIap.nitro.js.map +0 -1
- package/lib/commonjs/types.js +0 -118
- package/lib/commonjs/types.js.map +0 -1
|
@@ -1,525 +1,512 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
autoRenewableSubscription = "autoRenewableSubscription",
|
|
8
|
-
nonRenewingSubscription = "nonRenewingSubscription"
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Base product information shared across all platforms
|
|
12
|
-
*/
|
|
13
|
-
export type ProductCommon = {
|
|
14
|
-
/** Product identifier (SKU) */
|
|
15
|
-
id: string;
|
|
16
|
-
/** Product title displayed to users */
|
|
17
|
-
title: string;
|
|
18
|
-
/** Product description */
|
|
19
|
-
description: string;
|
|
20
|
-
/** Product type: 'inapp' or 'subs' for Android compatibility */
|
|
21
|
-
type: 'inapp' | 'subs';
|
|
22
|
-
/** Display name for the product */
|
|
23
|
-
displayName?: string;
|
|
24
|
-
/** Formatted price string for display (e.g., "$9.99") */
|
|
25
|
-
displayPrice: string;
|
|
26
|
-
/** Currency code (e.g., "USD", "EUR") */
|
|
27
|
-
currency: string;
|
|
28
|
-
/** Raw price value as number */
|
|
29
|
-
price?: number;
|
|
30
|
-
/** Debug description for development */
|
|
31
|
-
debugDescription?: string;
|
|
32
|
-
/** Platform identifier ('ios' or 'android') */
|
|
33
|
-
platform?: string;
|
|
34
|
-
};
|
|
35
|
-
/**
|
|
36
|
-
* Base purchase information shared across all platforms
|
|
37
|
-
* Represents both consumables, non-consumables, and subscriptions
|
|
38
|
-
*/
|
|
39
|
-
export type PurchaseCommon = {
|
|
40
|
-
/** Transaction identifier - used by finishTransaction */
|
|
41
|
-
id: string;
|
|
42
|
-
/** Product identifier - which product was purchased */
|
|
1
|
+
export interface ActiveSubscription {
|
|
2
|
+
autoRenewingAndroid?: boolean | null;
|
|
3
|
+
daysUntilExpirationIOS?: number | null;
|
|
4
|
+
environmentIOS?: string | null;
|
|
5
|
+
expirationDateIOS?: number | null;
|
|
6
|
+
isActive: boolean;
|
|
43
7
|
productId: string;
|
|
44
|
-
|
|
45
|
-
ids?: string[];
|
|
46
|
-
/** @deprecated - use id instead */
|
|
47
|
-
transactionId?: string;
|
|
48
|
-
/** Transaction timestamp in milliseconds */
|
|
8
|
+
purchaseToken?: string | null;
|
|
49
9
|
transactionDate: number;
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
displayPrice: string;
|
|
82
|
-
id: string;
|
|
83
|
-
paymentMode: PaymentMode;
|
|
84
|
-
period: {
|
|
85
|
-
unit: SubscriptionIosPeriod;
|
|
86
|
-
value: number;
|
|
87
|
-
};
|
|
88
|
-
periodCount: number;
|
|
89
|
-
price: number;
|
|
90
|
-
type: 'introductory' | 'promotional';
|
|
91
|
-
};
|
|
92
|
-
type SubscriptionInfo = {
|
|
93
|
-
introductoryOffer?: SubscriptionOffer;
|
|
94
|
-
promotionalOffers?: SubscriptionOffer[];
|
|
95
|
-
subscriptionGroupId: string;
|
|
96
|
-
subscriptionPeriod: {
|
|
97
|
-
unit: SubscriptionIosPeriod;
|
|
98
|
-
value: number;
|
|
99
|
-
};
|
|
100
|
-
};
|
|
101
|
-
export type Discount = {
|
|
10
|
+
transactionId: string;
|
|
11
|
+
willExpireSoon?: boolean | null;
|
|
12
|
+
}
|
|
13
|
+
export interface AndroidSubscriptionOfferInput {
|
|
14
|
+
/** Offer token */
|
|
15
|
+
offerToken: string;
|
|
16
|
+
/** Product SKU */
|
|
17
|
+
sku: string;
|
|
18
|
+
}
|
|
19
|
+
export interface AppTransaction {
|
|
20
|
+
appId: number;
|
|
21
|
+
appTransactionId?: string | null;
|
|
22
|
+
appVersion: string;
|
|
23
|
+
appVersionId: number;
|
|
24
|
+
bundleId: string;
|
|
25
|
+
deviceVerification: string;
|
|
26
|
+
deviceVerificationNonce: string;
|
|
27
|
+
environment: string;
|
|
28
|
+
originalAppVersion: string;
|
|
29
|
+
originalPlatform?: string | null;
|
|
30
|
+
originalPurchaseDate: number;
|
|
31
|
+
preorderDate?: number | null;
|
|
32
|
+
signedDate: number;
|
|
33
|
+
}
|
|
34
|
+
export interface DeepLinkOptions {
|
|
35
|
+
/** Android package name to target (required on Android) */
|
|
36
|
+
packageNameAndroid?: string | null;
|
|
37
|
+
/** Android SKU to open (required on Android) */
|
|
38
|
+
skuAndroid?: string | null;
|
|
39
|
+
}
|
|
40
|
+
export interface DiscountIOS {
|
|
102
41
|
identifier: string;
|
|
103
|
-
|
|
104
|
-
numberOfPeriods:
|
|
42
|
+
localizedPrice?: string | null;
|
|
43
|
+
numberOfPeriods: number;
|
|
44
|
+
paymentMode: PaymentModeIOS;
|
|
105
45
|
price: string;
|
|
106
|
-
|
|
107
|
-
paymentMode: PaymentMode;
|
|
46
|
+
priceAmount: number;
|
|
108
47
|
subscriptionPeriod: string;
|
|
109
|
-
|
|
110
|
-
export type ProductIOS = ProductCommon & {
|
|
111
|
-
displayNameIOS: string;
|
|
112
|
-
isFamilyShareableIOS: boolean;
|
|
113
|
-
jsonRepresentationIOS: string;
|
|
114
|
-
platform: 'ios';
|
|
115
|
-
subscriptionInfoIOS?: SubscriptionInfo;
|
|
116
|
-
typeIOS: ProductTypeIOS;
|
|
117
|
-
displayName?: string;
|
|
118
|
-
isFamilyShareable?: boolean;
|
|
119
|
-
jsonRepresentation?: string;
|
|
120
|
-
subscription?: SubscriptionInfo;
|
|
121
|
-
introductoryPriceNumberOfPeriodsIOS?: string;
|
|
122
|
-
introductoryPriceSubscriptionPeriodIOS?: SubscriptionIosPeriod;
|
|
123
|
-
};
|
|
124
|
-
export type ProductSubscriptionIOS = ProductIOS & {
|
|
125
|
-
discountsIOS?: Discount[];
|
|
126
|
-
introductoryPriceIOS?: string;
|
|
127
|
-
introductoryPriceAsAmountIOS?: string;
|
|
128
|
-
introductoryPricePaymentModeIOS?: PaymentMode;
|
|
129
|
-
introductoryPriceNumberOfPeriodsIOS?: string;
|
|
130
|
-
introductoryPriceSubscriptionPeriodIOS?: SubscriptionIosPeriod;
|
|
131
|
-
platform: 'ios';
|
|
132
|
-
subscriptionPeriodNumberIOS?: string;
|
|
133
|
-
subscriptionPeriodUnitIOS?: SubscriptionIosPeriod;
|
|
134
|
-
discounts?: Discount[];
|
|
135
|
-
introductoryPrice?: string;
|
|
136
|
-
};
|
|
137
|
-
export type PurchaseIOS = PurchaseCommon & {
|
|
138
|
-
platform: 'ios';
|
|
139
|
-
quantityIOS?: number;
|
|
140
|
-
originalTransactionDateIOS?: number;
|
|
141
|
-
originalTransactionIdentifierIOS?: string;
|
|
142
|
-
appAccountToken?: string;
|
|
143
|
-
expirationDateIOS?: number;
|
|
144
|
-
webOrderLineItemIdIOS?: number;
|
|
145
|
-
environmentIOS?: string;
|
|
146
|
-
storefrontCountryCodeIOS?: string;
|
|
147
|
-
appBundleIdIOS?: string;
|
|
148
|
-
productTypeIOS?: string;
|
|
149
|
-
subscriptionGroupIdIOS?: string;
|
|
150
|
-
isUpgradedIOS?: boolean;
|
|
151
|
-
ownershipTypeIOS?: string;
|
|
152
|
-
reasonIOS?: string;
|
|
153
|
-
reasonStringRepresentationIOS?: string;
|
|
154
|
-
transactionReasonIOS?: 'PURCHASE' | 'RENEWAL' | string;
|
|
155
|
-
revocationDateIOS?: number;
|
|
156
|
-
revocationReasonIOS?: string;
|
|
157
|
-
offerIOS?: {
|
|
158
|
-
id: string;
|
|
159
|
-
type: string;
|
|
160
|
-
paymentMode: string;
|
|
161
|
-
};
|
|
162
|
-
currencyCodeIOS?: string;
|
|
163
|
-
currencySymbolIOS?: string;
|
|
164
|
-
countryCodeIOS?: string;
|
|
165
|
-
/**
|
|
166
|
-
* @deprecated Use `purchaseToken` instead. This field will be removed in a future version.
|
|
167
|
-
* iOS 15+ JWS representation is now available through the `purchaseToken` field.
|
|
168
|
-
*/
|
|
169
|
-
jwsRepresentationIOS?: string;
|
|
170
|
-
};
|
|
171
|
-
/**
|
|
172
|
-
* iOS subscription renewal info
|
|
173
|
-
*/
|
|
174
|
-
export interface SubscriptionRenewalInfoIOS {
|
|
175
|
-
autoRenewStatus: boolean;
|
|
176
|
-
autoRenewPreference?: string;
|
|
177
|
-
expirationReason?: number;
|
|
178
|
-
gracePeriodExpirationDate?: number;
|
|
179
|
-
currentProductID?: string;
|
|
180
|
-
platform: 'ios';
|
|
181
|
-
}
|
|
182
|
-
/**
|
|
183
|
-
* iOS subscription status entry
|
|
184
|
-
*/
|
|
185
|
-
export interface SubscriptionStatusIOS {
|
|
186
|
-
state: number;
|
|
187
|
-
platform: 'ios';
|
|
188
|
-
renewalInfo?: SubscriptionRenewalInfoIOS;
|
|
48
|
+
type: string;
|
|
189
49
|
}
|
|
190
|
-
|
|
191
|
-
|
|
50
|
+
export interface DiscountOfferIOS {
|
|
51
|
+
/** Discount identifier */
|
|
52
|
+
identifier: string;
|
|
53
|
+
/** Key identifier for validation */
|
|
54
|
+
keyIdentifier: string;
|
|
55
|
+
/** Cryptographic nonce */
|
|
56
|
+
nonce: string;
|
|
57
|
+
/** Signature for validation */
|
|
58
|
+
signature: string;
|
|
59
|
+
/** Timestamp of discount offer */
|
|
60
|
+
timestamp: number;
|
|
61
|
+
}
|
|
62
|
+
export interface DiscountOfferInputIOS {
|
|
63
|
+
/** Discount identifier */
|
|
64
|
+
identifier: string;
|
|
65
|
+
/** Key identifier for validation */
|
|
66
|
+
keyIdentifier: string;
|
|
67
|
+
/** Cryptographic nonce */
|
|
68
|
+
nonce: string;
|
|
69
|
+
/** Signature for validation */
|
|
70
|
+
signature: string;
|
|
71
|
+
/** Timestamp of discount offer */
|
|
72
|
+
timestamp: number;
|
|
73
|
+
}
|
|
74
|
+
export interface EntitlementIOS {
|
|
75
|
+
jsonRepresentation: string;
|
|
76
|
+
sku: string;
|
|
77
|
+
transactionId: string;
|
|
78
|
+
}
|
|
79
|
+
export declare enum ErrorCode {
|
|
80
|
+
ActivityUnavailable = "ACTIVITY_UNAVAILABLE",
|
|
81
|
+
AlreadyOwned = "ALREADY_OWNED",
|
|
82
|
+
AlreadyPrepared = "ALREADY_PREPARED",
|
|
83
|
+
BillingResponseJsonParseError = "BILLING_RESPONSE_JSON_PARSE_ERROR",
|
|
84
|
+
BillingUnavailable = "BILLING_UNAVAILABLE",
|
|
85
|
+
ConnectionClosed = "CONNECTION_CLOSED",
|
|
86
|
+
DeferredPayment = "DEFERRED_PAYMENT",
|
|
87
|
+
DeveloperError = "DEVELOPER_ERROR",
|
|
88
|
+
EmptySkuList = "EMPTY_SKU_LIST",
|
|
89
|
+
FeatureNotSupported = "FEATURE_NOT_SUPPORTED",
|
|
90
|
+
IapNotAvailable = "IAP_NOT_AVAILABLE",
|
|
91
|
+
InitConnection = "INIT_CONNECTION",
|
|
92
|
+
Interrupted = "INTERRUPTED",
|
|
93
|
+
ItemNotOwned = "ITEM_NOT_OWNED",
|
|
94
|
+
ItemUnavailable = "ITEM_UNAVAILABLE",
|
|
95
|
+
NetworkError = "NETWORK_ERROR",
|
|
96
|
+
NotEnded = "NOT_ENDED",
|
|
97
|
+
NotPrepared = "NOT_PREPARED",
|
|
98
|
+
Pending = "PENDING",
|
|
99
|
+
PurchaseError = "PURCHASE_ERROR",
|
|
100
|
+
QueryProduct = "QUERY_PRODUCT",
|
|
101
|
+
ReceiptFailed = "RECEIPT_FAILED",
|
|
102
|
+
ReceiptFinished = "RECEIPT_FINISHED",
|
|
103
|
+
ReceiptFinishedFailed = "RECEIPT_FINISHED_FAILED",
|
|
104
|
+
RemoteError = "REMOTE_ERROR",
|
|
105
|
+
ServiceDisconnected = "SERVICE_DISCONNECTED",
|
|
106
|
+
ServiceError = "SERVICE_ERROR",
|
|
107
|
+
SkuNotFound = "SKU_NOT_FOUND",
|
|
108
|
+
SkuOfferMismatch = "SKU_OFFER_MISMATCH",
|
|
109
|
+
SyncError = "SYNC_ERROR",
|
|
110
|
+
TransactionValidationFailed = "TRANSACTION_VALIDATION_FAILED",
|
|
111
|
+
Unknown = "UNKNOWN",
|
|
112
|
+
UserCancelled = "USER_CANCELLED",
|
|
113
|
+
UserError = "USER_ERROR"
|
|
114
|
+
}
|
|
115
|
+
export interface FetchProductsResult {
|
|
116
|
+
products?: Product[] | null;
|
|
117
|
+
subscriptions?: ProductSubscription[] | null;
|
|
118
|
+
}
|
|
119
|
+
export declare enum IapEvent {
|
|
120
|
+
PromotedProductIos = "PROMOTED_PRODUCT_IOS",
|
|
121
|
+
PurchaseError = "PURCHASE_ERROR",
|
|
122
|
+
PurchaseUpdated = "PURCHASE_UPDATED"
|
|
123
|
+
}
|
|
124
|
+
export interface Mutation {
|
|
125
|
+
/** Acknowledge a non-consumable purchase or subscription */
|
|
126
|
+
acknowledgePurchaseAndroid: Promise<VoidResult>;
|
|
127
|
+
/** Initiate a refund request for a product (iOS 15+) */
|
|
128
|
+
beginRefundRequestIOS: Promise<RefundResultIOS>;
|
|
129
|
+
/** Clear pending transactions from the StoreKit payment queue */
|
|
130
|
+
clearTransactionIOS: Promise<VoidResult>;
|
|
131
|
+
/** Consume a purchase token so it can be repurchased */
|
|
132
|
+
consumePurchaseAndroid: Promise<VoidResult>;
|
|
133
|
+
/** Open the native subscription management surface */
|
|
134
|
+
deepLinkToSubscriptions: Promise<VoidResult>;
|
|
135
|
+
/** Close the platform billing connection */
|
|
136
|
+
endConnection: Promise<boolean>;
|
|
137
|
+
/** Finish a transaction after validating receipts */
|
|
138
|
+
finishTransaction: Promise<VoidResult>;
|
|
139
|
+
/** Establish the platform billing connection */
|
|
140
|
+
initConnection: Promise<boolean>;
|
|
141
|
+
/** Present the App Store code redemption sheet */
|
|
142
|
+
presentCodeRedemptionSheetIOS: Promise<VoidResult>;
|
|
143
|
+
/** Initiate a purchase flow; rely on events for final state */
|
|
144
|
+
requestPurchase?: Promise<RequestPurchaseResult | null>;
|
|
145
|
+
/** Purchase the promoted product surfaced by the App Store */
|
|
146
|
+
requestPurchaseOnPromotedProductIOS: Promise<PurchaseIOS>;
|
|
147
|
+
/** Restore completed purchases across platforms */
|
|
148
|
+
restorePurchases: Promise<VoidResult>;
|
|
149
|
+
/** Open subscription management UI and return changed purchases (iOS 15+) */
|
|
150
|
+
showManageSubscriptionsIOS: Promise<PurchaseIOS[]>;
|
|
151
|
+
/** Force a StoreKit sync for transactions (iOS 15+) */
|
|
152
|
+
syncIOS: Promise<VoidResult>;
|
|
153
|
+
/** Validate purchase receipts with the configured providers */
|
|
154
|
+
validateReceipt: Promise<ReceiptValidationResult>;
|
|
155
|
+
}
|
|
156
|
+
export interface MutationacknowledgePurchaseAndroidArgs {
|
|
157
|
+
purchaseToken: string;
|
|
158
|
+
}
|
|
159
|
+
export interface MutationbeginRefundRequestIOSArgs {
|
|
160
|
+
sku: string;
|
|
161
|
+
}
|
|
162
|
+
export interface MutationconsumePurchaseAndroidArgs {
|
|
163
|
+
purchaseToken: string;
|
|
164
|
+
}
|
|
165
|
+
export interface MutationdeepLinkToSubscriptionsArgs {
|
|
166
|
+
options?: DeepLinkOptions | null;
|
|
167
|
+
}
|
|
168
|
+
export interface MutationfinishTransactionArgs {
|
|
169
|
+
isConsumable?: boolean | null;
|
|
170
|
+
purchase: PurchaseInput;
|
|
171
|
+
}
|
|
172
|
+
export interface MutationrequestPurchaseArgs {
|
|
173
|
+
params: PurchaseParams;
|
|
174
|
+
}
|
|
175
|
+
export interface MutationvalidateReceiptArgs {
|
|
176
|
+
options: ReceiptValidationProps;
|
|
177
|
+
}
|
|
178
|
+
export declare enum PaymentModeIOS {
|
|
179
|
+
Empty = "EMPTY",
|
|
180
|
+
FreeTrial = "FREE_TRIAL",
|
|
181
|
+
PayAsYouGo = "PAY_AS_YOU_GO",
|
|
182
|
+
PayUpFront = "PAY_UP_FRONT"
|
|
183
|
+
}
|
|
184
|
+
export declare enum Platform {
|
|
185
|
+
Android = "ANDROID",
|
|
186
|
+
Ios = "IOS"
|
|
187
|
+
}
|
|
188
|
+
export interface PricingPhaseAndroid {
|
|
189
|
+
billingCycleCount: number;
|
|
190
|
+
billingPeriod: string;
|
|
192
191
|
formattedPrice: string;
|
|
193
192
|
priceAmountMicros: string;
|
|
194
|
-
};
|
|
195
|
-
type PricingPhaseAndroid = {
|
|
196
|
-
formattedPrice: string;
|
|
197
193
|
priceCurrencyCode: string;
|
|
198
|
-
billingPeriod: string;
|
|
199
|
-
billingCycleCount: number;
|
|
200
|
-
priceAmountMicros: string;
|
|
201
194
|
recurrenceMode: number;
|
|
202
|
-
}
|
|
203
|
-
|
|
195
|
+
}
|
|
196
|
+
export interface PricingPhasesAndroid {
|
|
204
197
|
pricingPhaseList: PricingPhaseAndroid[];
|
|
205
|
-
}
|
|
206
|
-
type
|
|
198
|
+
}
|
|
199
|
+
export type Product = ProductAndroid | ProductIOS;
|
|
200
|
+
export interface ProductAndroid extends ProductCommon {
|
|
201
|
+
currency: string;
|
|
202
|
+
debugDescription?: string | null;
|
|
203
|
+
description: string;
|
|
204
|
+
displayName?: string | null;
|
|
205
|
+
displayPrice: string;
|
|
206
|
+
id: string;
|
|
207
|
+
nameAndroid: string;
|
|
208
|
+
oneTimePurchaseOfferDetailsAndroid?: ProductAndroidOneTimePurchaseOfferDetail | null;
|
|
209
|
+
platform: Platform;
|
|
210
|
+
price?: number | null;
|
|
211
|
+
subscriptionOfferDetailsAndroid?: ProductSubscriptionAndroidOfferDetails[] | null;
|
|
212
|
+
title: string;
|
|
213
|
+
type: ProductType;
|
|
214
|
+
}
|
|
215
|
+
export interface ProductAndroidOneTimePurchaseOfferDetail {
|
|
216
|
+
formattedPrice: string;
|
|
217
|
+
priceAmountMicros: string;
|
|
218
|
+
priceCurrencyCode: string;
|
|
219
|
+
}
|
|
220
|
+
export interface ProductCommon {
|
|
221
|
+
currency: string;
|
|
222
|
+
debugDescription?: string | null;
|
|
223
|
+
description: string;
|
|
224
|
+
displayName?: string | null;
|
|
225
|
+
displayPrice: string;
|
|
226
|
+
id: string;
|
|
227
|
+
platform: Platform;
|
|
228
|
+
price?: number | null;
|
|
229
|
+
title: string;
|
|
230
|
+
type: ProductType;
|
|
231
|
+
}
|
|
232
|
+
export interface ProductIOS extends ProductCommon {
|
|
233
|
+
currency: string;
|
|
234
|
+
debugDescription?: string | null;
|
|
235
|
+
description: string;
|
|
236
|
+
displayName?: string | null;
|
|
237
|
+
displayNameIOS: string;
|
|
238
|
+
displayPrice: string;
|
|
239
|
+
id: string;
|
|
240
|
+
isFamilyShareableIOS: boolean;
|
|
241
|
+
jsonRepresentationIOS: string;
|
|
242
|
+
platform: Platform;
|
|
243
|
+
price?: number | null;
|
|
244
|
+
subscriptionInfoIOS?: SubscriptionInfoIOS | null;
|
|
245
|
+
title: string;
|
|
246
|
+
type: ProductType;
|
|
247
|
+
typeIOS: ProductTypeIOS;
|
|
248
|
+
}
|
|
249
|
+
export declare enum ProductQueryType {
|
|
250
|
+
All = "ALL",
|
|
251
|
+
InApp = "IN_APP",
|
|
252
|
+
Subs = "SUBS"
|
|
253
|
+
}
|
|
254
|
+
export interface ProductRequest {
|
|
255
|
+
skus: string[];
|
|
256
|
+
type?: ProductQueryType | null;
|
|
257
|
+
}
|
|
258
|
+
export type ProductSubscription = ProductSubscriptionAndroid | ProductSubscriptionIOS;
|
|
259
|
+
export interface ProductSubscriptionAndroid extends ProductCommon {
|
|
260
|
+
currency: string;
|
|
261
|
+
debugDescription?: string | null;
|
|
262
|
+
description: string;
|
|
263
|
+
displayName?: string | null;
|
|
264
|
+
displayPrice: string;
|
|
265
|
+
id: string;
|
|
266
|
+
nameAndroid: string;
|
|
267
|
+
oneTimePurchaseOfferDetailsAndroid?: ProductAndroidOneTimePurchaseOfferDetail | null;
|
|
268
|
+
platform: Platform;
|
|
269
|
+
price?: number | null;
|
|
270
|
+
subscriptionOfferDetailsAndroid: ProductSubscriptionAndroidOfferDetails[];
|
|
271
|
+
title: string;
|
|
272
|
+
type: ProductType;
|
|
273
|
+
}
|
|
274
|
+
export interface ProductSubscriptionAndroidOfferDetails {
|
|
207
275
|
basePlanId: string;
|
|
208
|
-
offerId
|
|
209
|
-
offerToken: string;
|
|
276
|
+
offerId?: string | null;
|
|
210
277
|
offerTags: string[];
|
|
211
|
-
pricingPhases: PricingPhasesAndroid;
|
|
212
|
-
};
|
|
213
|
-
type ProductSubscriptionAndroidOfferDetails = {
|
|
214
|
-
basePlanId: string;
|
|
215
|
-
offerId: string | null;
|
|
216
278
|
offerToken: string;
|
|
217
279
|
pricingPhases: PricingPhasesAndroid;
|
|
218
|
-
offerTags: string[];
|
|
219
|
-
};
|
|
220
|
-
export type ProductAndroid = ProductCommon & {
|
|
221
|
-
nameAndroid: string;
|
|
222
|
-
oneTimePurchaseOfferDetailsAndroid?: ProductAndroidOneTimePurchaseOfferDetail;
|
|
223
|
-
platform: 'android';
|
|
224
|
-
subscriptionOfferDetailsAndroid?: ProductSubscriptionAndroidOfferDetail[];
|
|
225
|
-
name?: string;
|
|
226
|
-
oneTimePurchaseOfferDetails?: ProductAndroidOneTimePurchaseOfferDetail;
|
|
227
|
-
subscriptionOfferDetails?: ProductSubscriptionAndroidOfferDetail[];
|
|
228
|
-
};
|
|
229
|
-
export type ProductSubscriptionAndroid = ProductAndroid & {
|
|
230
|
-
subscriptionOfferDetailsAndroid: ProductSubscriptionAndroidOfferDetails[];
|
|
231
|
-
subscriptionOfferDetails?: ProductSubscriptionAndroidOfferDetails[];
|
|
232
|
-
};
|
|
233
|
-
export type PurchaseAndroid = PurchaseCommon & {
|
|
234
|
-
platform: 'android';
|
|
235
|
-
/**
|
|
236
|
-
* @deprecated Use `purchaseToken` instead. This field will be removed in a future version.
|
|
237
|
-
*/
|
|
238
|
-
purchaseTokenAndroid?: string;
|
|
239
|
-
dataAndroid?: string;
|
|
240
|
-
signatureAndroid?: string;
|
|
241
|
-
/** @deprecated Use the common `isAutoRenewing` field instead */
|
|
242
|
-
autoRenewingAndroid?: boolean;
|
|
243
|
-
isAcknowledgedAndroid?: boolean;
|
|
244
|
-
packageNameAndroid?: string;
|
|
245
|
-
developerPayloadAndroid?: string;
|
|
246
|
-
obfuscatedAccountIdAndroid?: string;
|
|
247
|
-
obfuscatedProfileIdAndroid?: string;
|
|
248
|
-
};
|
|
249
|
-
export type ProductPurchaseIOS = PurchaseIOS;
|
|
250
|
-
export type ProductPurchaseAndroid = PurchaseAndroid;
|
|
251
|
-
export type SubscriptionProductIOS = ProductSubscriptionIOS;
|
|
252
|
-
export type SubscriptionProductAndroid = ProductSubscriptionAndroid;
|
|
253
|
-
export type Product = (ProductAndroid & AndroidPlatform) | (ProductIOS & IosPlatform);
|
|
254
|
-
export type SubscriptionProduct = (ProductSubscriptionAndroid & AndroidPlatform) | (ProductSubscriptionIOS & IosPlatform);
|
|
255
|
-
/**
|
|
256
|
-
* Regular product purchase (consumable or non-consumable)
|
|
257
|
-
* Both types appear in getAvailablePurchases until finishTransaction is called
|
|
258
|
-
*/
|
|
259
|
-
export type ProductPurchase = (PurchaseAndroid & AndroidPlatform) | (PurchaseIOS & IosPlatform);
|
|
260
|
-
/**
|
|
261
|
-
* Active subscription purchase
|
|
262
|
-
* Appears in getAvailablePurchases while subscription is active
|
|
263
|
-
*/
|
|
264
|
-
export type SubscriptionPurchase = (PurchaseAndroid & AndroidPlatform & {
|
|
265
|
-
autoRenewingAndroid: boolean;
|
|
266
|
-
}) | (PurchaseIOS & IosPlatform);
|
|
267
|
-
/**
|
|
268
|
-
* Combined purchase type that includes all purchase types
|
|
269
|
-
* Used as return type for getAvailablePurchases
|
|
270
|
-
*/
|
|
271
|
-
export type Purchase = (PurchaseAndroid & AndroidPlatform) | (PurchaseIOS & IosPlatform);
|
|
272
|
-
export interface ProductRequest {
|
|
273
|
-
/** Product SKUs to fetch */
|
|
274
|
-
skus: string[];
|
|
275
|
-
/** Filter type: "inapp" (default), "subs", or "all" */
|
|
276
|
-
type?: 'inapp' | 'subs' | 'all';
|
|
277
280
|
}
|
|
278
|
-
export interface
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
281
|
+
export interface ProductSubscriptionIOS extends ProductCommon {
|
|
282
|
+
currency: string;
|
|
283
|
+
debugDescription?: string | null;
|
|
284
|
+
description: string;
|
|
285
|
+
discountsIOS?: DiscountIOS[] | null;
|
|
286
|
+
displayName?: string | null;
|
|
287
|
+
displayNameIOS: string;
|
|
288
|
+
displayPrice: string;
|
|
289
|
+
id: string;
|
|
290
|
+
introductoryPriceAsAmountIOS?: string | null;
|
|
291
|
+
introductoryPriceIOS?: string | null;
|
|
292
|
+
introductoryPriceNumberOfPeriodsIOS?: string | null;
|
|
293
|
+
introductoryPricePaymentModeIOS?: PaymentModeIOS | null;
|
|
294
|
+
introductoryPriceSubscriptionPeriodIOS?: SubscriptionPeriodIOS | null;
|
|
295
|
+
isFamilyShareableIOS: boolean;
|
|
296
|
+
jsonRepresentationIOS: string;
|
|
297
|
+
platform: Platform;
|
|
298
|
+
price?: number | null;
|
|
299
|
+
subscriptionInfoIOS?: SubscriptionInfoIOS | null;
|
|
300
|
+
subscriptionPeriodNumberIOS?: string | null;
|
|
301
|
+
subscriptionPeriodUnitIOS?: SubscriptionPeriodIOS | null;
|
|
302
|
+
title: string;
|
|
303
|
+
type: ProductType;
|
|
304
|
+
typeIOS: ProductTypeIOS;
|
|
284
305
|
}
|
|
285
|
-
export
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
readonly obfuscatedProfileIdAndroid?: string;
|
|
289
|
-
readonly isOfferPersonalized?: boolean;
|
|
290
|
-
}
|
|
291
|
-
export interface RequestSubscriptionAndroidProps extends RequestPurchaseAndroidProps {
|
|
292
|
-
readonly purchaseTokenAndroid?: string;
|
|
293
|
-
readonly replacementModeAndroid?: number;
|
|
294
|
-
readonly subscriptionOffers: {
|
|
295
|
-
sku: string;
|
|
296
|
-
offerToken: string;
|
|
297
|
-
}[];
|
|
306
|
+
export declare enum ProductType {
|
|
307
|
+
InApp = "IN_APP",
|
|
308
|
+
Subs = "SUBS"
|
|
298
309
|
}
|
|
299
|
-
export
|
|
300
|
-
|
|
301
|
-
|
|
310
|
+
export declare enum ProductTypeIOS {
|
|
311
|
+
AutoRenewableSubscription = "AUTO_RENEWABLE_SUBSCRIPTION",
|
|
312
|
+
Consumable = "CONSUMABLE",
|
|
313
|
+
NonConsumable = "NON_CONSUMABLE",
|
|
314
|
+
NonRenewingSubscription = "NON_RENEWING_SUBSCRIPTION"
|
|
302
315
|
}
|
|
303
|
-
export
|
|
304
|
-
|
|
305
|
-
|
|
316
|
+
export type Purchase = PurchaseAndroid | PurchaseIOS;
|
|
317
|
+
export interface PurchaseAndroid extends PurchaseCommon {
|
|
318
|
+
autoRenewingAndroid?: boolean | null;
|
|
319
|
+
dataAndroid?: string | null;
|
|
320
|
+
developerPayloadAndroid?: string | null;
|
|
321
|
+
id: string;
|
|
322
|
+
ids?: string[] | null;
|
|
323
|
+
isAcknowledgedAndroid?: boolean | null;
|
|
324
|
+
isAutoRenewing: boolean;
|
|
325
|
+
obfuscatedAccountIdAndroid?: string | null;
|
|
326
|
+
obfuscatedProfileIdAndroid?: string | null;
|
|
327
|
+
packageNameAndroid?: string | null;
|
|
328
|
+
platform: Platform;
|
|
329
|
+
productId: string;
|
|
330
|
+
purchaseState: PurchaseState;
|
|
331
|
+
purchaseToken?: string | null;
|
|
332
|
+
quantity: number;
|
|
333
|
+
signatureAndroid?: string | null;
|
|
334
|
+
transactionDate: number;
|
|
335
|
+
}
|
|
336
|
+
export interface PurchaseCommon {
|
|
337
|
+
id: string;
|
|
338
|
+
ids?: string[] | null;
|
|
339
|
+
isAutoRenewing: boolean;
|
|
340
|
+
platform: Platform;
|
|
341
|
+
productId: string;
|
|
342
|
+
purchaseState: PurchaseState;
|
|
343
|
+
/** Unified purchase token (iOS JWS, Android purchaseToken) */
|
|
344
|
+
purchaseToken?: string | null;
|
|
345
|
+
quantity: number;
|
|
346
|
+
transactionDate: number;
|
|
306
347
|
}
|
|
307
|
-
export type RequestPurchaseProps = RequestPurchasePropsByPlatforms;
|
|
308
|
-
export type RequestSubscriptionProps = RequestSubscriptionPropsByPlatforms;
|
|
309
|
-
export declare enum ErrorCode {
|
|
310
|
-
E_UNKNOWN = "E_UNKNOWN",
|
|
311
|
-
E_USER_CANCELLED = "E_USER_CANCELLED",
|
|
312
|
-
E_USER_ERROR = "E_USER_ERROR",
|
|
313
|
-
E_ITEM_UNAVAILABLE = "E_ITEM_UNAVAILABLE",
|
|
314
|
-
E_REMOTE_ERROR = "E_REMOTE_ERROR",
|
|
315
|
-
E_NETWORK_ERROR = "E_NETWORK_ERROR",
|
|
316
|
-
E_SERVICE_ERROR = "E_SERVICE_ERROR",
|
|
317
|
-
E_RECEIPT_FAILED = "E_RECEIPT_FAILED",
|
|
318
|
-
E_RECEIPT_FINISHED_FAILED = "E_RECEIPT_FINISHED_FAILED",
|
|
319
|
-
E_NOT_PREPARED = "E_NOT_PREPARED",
|
|
320
|
-
E_NOT_ENDED = "E_NOT_ENDED",
|
|
321
|
-
E_ALREADY_OWNED = "E_ALREADY_OWNED",
|
|
322
|
-
E_DEVELOPER_ERROR = "E_DEVELOPER_ERROR",
|
|
323
|
-
E_BILLING_RESPONSE_JSON_PARSE_ERROR = "E_BILLING_RESPONSE_JSON_PARSE_ERROR",
|
|
324
|
-
E_DEFERRED_PAYMENT = "E_DEFERRED_PAYMENT",
|
|
325
|
-
E_INTERRUPTED = "E_INTERRUPTED",
|
|
326
|
-
E_IAP_NOT_AVAILABLE = "E_IAP_NOT_AVAILABLE",
|
|
327
|
-
E_PURCHASE_ERROR = "E_PURCHASE_ERROR",
|
|
328
|
-
E_SYNC_ERROR = "E_SYNC_ERROR",
|
|
329
|
-
E_TRANSACTION_VALIDATION_FAILED = "E_TRANSACTION_VALIDATION_FAILED",
|
|
330
|
-
E_ACTIVITY_UNAVAILABLE = "E_ACTIVITY_UNAVAILABLE",
|
|
331
|
-
E_ALREADY_PREPARED = "E_ALREADY_PREPARED",
|
|
332
|
-
E_PENDING = "E_PENDING",
|
|
333
|
-
E_CONNECTION_CLOSED = "E_CONNECTION_CLOSED",
|
|
334
|
-
E_INIT_CONNECTION = "E_INIT_CONNECTION",
|
|
335
|
-
E_SERVICE_DISCONNECTED = "E_SERVICE_DISCONNECTED",
|
|
336
|
-
E_QUERY_PRODUCT = "E_QUERY_PRODUCT",
|
|
337
|
-
E_SKU_NOT_FOUND = "E_SKU_NOT_FOUND",
|
|
338
|
-
E_SKU_OFFER_MISMATCH = "E_SKU_OFFER_MISMATCH",
|
|
339
|
-
E_ITEM_NOT_OWNED = "E_ITEM_NOT_OWNED",
|
|
340
|
-
E_BILLING_UNAVAILABLE = "E_BILLING_UNAVAILABLE",
|
|
341
|
-
E_FEATURE_NOT_SUPPORTED = "E_FEATURE_NOT_SUPPORTED",
|
|
342
|
-
E_EMPTY_SKU_LIST = "E_EMPTY_SKU_LIST"
|
|
343
|
-
}
|
|
344
|
-
export type PurchaseResult = {
|
|
345
|
-
responseCode?: number;
|
|
346
|
-
debugMessage?: string;
|
|
347
|
-
code?: string;
|
|
348
|
-
message?: string;
|
|
349
|
-
/**
|
|
350
|
-
* @deprecated Use `purchaseToken` instead. This field will be removed in a future version.
|
|
351
|
-
*/
|
|
352
|
-
purchaseTokenAndroid?: string;
|
|
353
|
-
purchaseToken?: string;
|
|
354
|
-
};
|
|
355
|
-
export type DiscountOffer = {
|
|
356
|
-
identifier: string;
|
|
357
|
-
keyIdentifier: string;
|
|
358
|
-
nonce: string;
|
|
359
|
-
signature: string;
|
|
360
|
-
timestamp: number;
|
|
361
|
-
};
|
|
362
|
-
export type AppTransactionIOS = {
|
|
363
|
-
appTransactionId?: string;
|
|
364
|
-
originalPlatform?: string;
|
|
365
|
-
bundleId: string;
|
|
366
|
-
appVersion: string;
|
|
367
|
-
originalAppVersion: string;
|
|
368
|
-
originalPurchaseDate: number;
|
|
369
|
-
deviceVerification: string;
|
|
370
|
-
deviceVerificationNonce: string;
|
|
371
|
-
environment: string;
|
|
372
|
-
signedDate: number;
|
|
373
|
-
appId?: number;
|
|
374
|
-
appVersionId?: number;
|
|
375
|
-
preorderDate?: number;
|
|
376
|
-
};
|
|
377
|
-
/**
|
|
378
|
-
* Options for getAvailablePurchases and getPurchaseHistories methods
|
|
379
|
-
*/
|
|
380
|
-
export interface PurchaseOptions {
|
|
381
|
-
/** Whether to also publish purchases to event listener */
|
|
382
|
-
alsoPublishToEventListenerIOS?: boolean;
|
|
383
|
-
/** Whether to only include active items (subscriptions that are still active) */
|
|
384
|
-
onlyIncludeActiveItemsIOS?: boolean;
|
|
385
|
-
}
|
|
386
|
-
/**
|
|
387
|
-
* Parameters for finishTransaction method
|
|
388
|
-
*/
|
|
389
|
-
export interface FinishTransactionParams {
|
|
390
|
-
/** The purchase to finish/consume */
|
|
391
|
-
purchase: Purchase;
|
|
392
|
-
/**
|
|
393
|
-
* Whether this is a consumable product that should be consumed.
|
|
394
|
-
* - Set to true for consumable products (e.g., "20 credits", "100 coins")
|
|
395
|
-
* - Set to false (or omit) for non-consumable products (e.g., "remove ads", "premium features")
|
|
396
|
-
* - Do NOT set to true for subscriptions - they are managed automatically
|
|
397
|
-
* Note: On iOS, this flag doesn't affect behavior as StoreKit handles this automatically.
|
|
398
|
-
* On Android, consumables must be consumed to allow repurchase.
|
|
399
|
-
*/
|
|
400
|
-
isConsumable?: boolean;
|
|
401
|
-
}
|
|
402
|
-
/**
|
|
403
|
-
* Main IAP context interface providing all in-app purchase functionality
|
|
404
|
-
*/
|
|
405
|
-
export interface IapContext {
|
|
406
|
-
/** Current list of available products */
|
|
407
|
-
products: Product[];
|
|
408
|
-
/** Current list of available subscription products */
|
|
409
|
-
subscriptions: SubscriptionProduct[];
|
|
410
|
-
/**
|
|
411
|
-
* List of available purchases (includes all types):
|
|
412
|
-
* - Consumables: Not yet consumed/finished
|
|
413
|
-
* - Non-consumables: Not yet finished
|
|
414
|
-
* - Subscriptions: Currently active
|
|
415
|
-
*/
|
|
416
|
-
availablePurchases: Purchase[];
|
|
417
|
-
/** Currently promoted product (iOS only) */
|
|
418
|
-
promotedProduct?: Product;
|
|
419
|
-
/** Current purchase being processed */
|
|
420
|
-
currentPurchase?: Purchase;
|
|
421
|
-
/** Purchase error if any */
|
|
422
|
-
purchaseError?: PurchaseError;
|
|
423
|
-
/** Initialize connection to the store */
|
|
424
|
-
initConnection(): Promise<boolean>;
|
|
425
|
-
/** End connection to the store */
|
|
426
|
-
endConnection(): Promise<boolean>;
|
|
427
|
-
/** Sync purchases (iOS only) */
|
|
428
|
-
sync(): Promise<void>;
|
|
429
|
-
/**
|
|
430
|
-
* Fetch products from the store
|
|
431
|
-
* @param params.skus - Array of product SKUs to fetch
|
|
432
|
-
* @param params.type - Type of products: 'inapp' for regular products, 'subs' for subscriptions, 'all' to fetch both. Defaults to 'inapp'
|
|
433
|
-
*/
|
|
434
|
-
fetchProducts(params: {
|
|
435
|
-
skus: string[];
|
|
436
|
-
type?: 'inapp' | 'subs' | 'all';
|
|
437
|
-
}): Promise<Product[] | SubscriptionProduct[]>;
|
|
438
|
-
/**
|
|
439
|
-
* Request a purchase for products or subscriptions
|
|
440
|
-
* @param params.request - Platform-specific purchase parameters
|
|
441
|
-
* @param params.type - Type of purchase: 'inapp' for products or 'subs' for subscriptions
|
|
442
|
-
*/
|
|
443
|
-
requestPurchase(params: {
|
|
444
|
-
request: RequestPurchaseProps | RequestSubscriptionProps;
|
|
445
|
-
type?: 'inapp' | 'subs';
|
|
446
|
-
}): Promise<Purchase | Purchase[] | void>;
|
|
447
|
-
/**
|
|
448
|
-
* Finish a transaction and consume if applicable.
|
|
449
|
-
* IMPORTANT: Every purchase must be finished to complete the transaction.
|
|
450
|
-
* - For consumables: Set isConsumable=true to allow repurchase
|
|
451
|
-
* - For non-consumables & subscriptions: Set isConsumable=false or omit
|
|
452
|
-
*/
|
|
453
|
-
finishTransaction(params: FinishTransactionParams): Promise<PurchaseResult | boolean>;
|
|
454
|
-
/**
|
|
455
|
-
* Get all available purchases for the current user.
|
|
456
|
-
* Returns:
|
|
457
|
-
* - Consumables that haven't been consumed (finished with isConsumable=true)
|
|
458
|
-
* - Non-consumables that haven't been finished
|
|
459
|
-
* - Active subscriptions
|
|
460
|
-
*/
|
|
461
|
-
getAvailablePurchases(options?: PurchaseOptions): Promise<Purchase[]>;
|
|
462
|
-
/** Validate a receipt (server-side validation recommended) */
|
|
463
|
-
validateReceipt(sku: string, androidOptions?: {
|
|
464
|
-
packageName: string;
|
|
465
|
-
productToken: string;
|
|
466
|
-
accessToken: string;
|
|
467
|
-
isSub?: boolean;
|
|
468
|
-
}): Promise<ReceiptValidationResult>;
|
|
469
|
-
}
|
|
470
|
-
/**
|
|
471
|
-
* Purchase error type
|
|
472
|
-
*/
|
|
473
348
|
export interface PurchaseError {
|
|
474
|
-
|
|
475
|
-
code: string;
|
|
476
|
-
/** Human-readable error message */
|
|
349
|
+
code: ErrorCode;
|
|
477
350
|
message: string;
|
|
478
|
-
|
|
479
|
-
|
|
351
|
+
productId?: string | null;
|
|
352
|
+
}
|
|
353
|
+
export interface PurchaseIOS extends PurchaseCommon {
|
|
354
|
+
appAccountToken?: string | null;
|
|
355
|
+
appBundleIdIOS?: string | null;
|
|
356
|
+
countryCodeIOS?: string | null;
|
|
357
|
+
currencyCodeIOS?: string | null;
|
|
358
|
+
currencySymbolIOS?: string | null;
|
|
359
|
+
environmentIOS?: string | null;
|
|
360
|
+
expirationDateIOS?: number | null;
|
|
361
|
+
id: string;
|
|
362
|
+
ids?: string[] | null;
|
|
363
|
+
isAutoRenewing: boolean;
|
|
364
|
+
isUpgradedIOS?: boolean | null;
|
|
365
|
+
offerIOS?: PurchaseOfferIOS | null;
|
|
366
|
+
originalTransactionDateIOS?: number | null;
|
|
367
|
+
originalTransactionIdentifierIOS?: string | null;
|
|
368
|
+
ownershipTypeIOS?: string | null;
|
|
369
|
+
platform: Platform;
|
|
370
|
+
productId: string;
|
|
371
|
+
purchaseState: PurchaseState;
|
|
372
|
+
purchaseToken?: string | null;
|
|
373
|
+
quantity: number;
|
|
374
|
+
quantityIOS?: number | null;
|
|
375
|
+
reasonIOS?: string | null;
|
|
376
|
+
reasonStringRepresentationIOS?: string | null;
|
|
377
|
+
revocationDateIOS?: number | null;
|
|
378
|
+
revocationReasonIOS?: string | null;
|
|
379
|
+
storefrontCountryCodeIOS?: string | null;
|
|
380
|
+
subscriptionGroupIdIOS?: string | null;
|
|
381
|
+
transactionDate: number;
|
|
382
|
+
transactionReasonIOS?: string | null;
|
|
383
|
+
webOrderLineItemIdIOS?: string | null;
|
|
384
|
+
}
|
|
385
|
+
export interface PurchaseInput {
|
|
386
|
+
id: string;
|
|
387
|
+
ids?: string[] | null;
|
|
388
|
+
isAutoRenewing: boolean;
|
|
389
|
+
platform: Platform;
|
|
390
|
+
productId: string;
|
|
391
|
+
purchaseState: PurchaseState;
|
|
392
|
+
purchaseToken?: string | null;
|
|
393
|
+
quantity: number;
|
|
394
|
+
transactionDate: number;
|
|
395
|
+
}
|
|
396
|
+
export interface PurchaseOfferIOS {
|
|
397
|
+
id: string;
|
|
398
|
+
paymentMode: string;
|
|
399
|
+
type: string;
|
|
400
|
+
}
|
|
401
|
+
export interface PurchaseOptions {
|
|
402
|
+
/** Also emit results through the iOS event listeners */
|
|
403
|
+
alsoPublishToEventListenerIOS?: boolean | null;
|
|
404
|
+
/** Limit to currently active items on iOS */
|
|
405
|
+
onlyIncludeActiveItemsIOS?: boolean | null;
|
|
406
|
+
}
|
|
407
|
+
export interface PurchaseParams {
|
|
408
|
+
/** Per-platform purchase request props */
|
|
409
|
+
requestPurchase?: RequestPurchasePropsByPlatforms | null;
|
|
410
|
+
/** Per-platform subscription request props */
|
|
411
|
+
requestSubscription?: RequestSubscriptionPropsByPlatforms | null;
|
|
412
|
+
/** Explicit purchase type hint (defaults to in-app) */
|
|
413
|
+
type?: ProductQueryType | null;
|
|
414
|
+
}
|
|
415
|
+
export declare enum PurchaseState {
|
|
416
|
+
Deferred = "DEFERRED",
|
|
417
|
+
Failed = "FAILED",
|
|
418
|
+
Pending = "PENDING",
|
|
419
|
+
Purchased = "PURCHASED",
|
|
420
|
+
Restored = "RESTORED",
|
|
421
|
+
Unknown = "UNKNOWN"
|
|
422
|
+
}
|
|
423
|
+
export interface Query {
|
|
424
|
+
/** Get current StoreKit 2 entitlements (iOS 15+) */
|
|
425
|
+
currentEntitlementIOS: Promise<EntitlementIOS[]>;
|
|
426
|
+
/** Retrieve products or subscriptions from the store */
|
|
427
|
+
fetchProducts: Promise<FetchProductsResult>;
|
|
428
|
+
/** Get active subscriptions (filters by subscriptionIds when provided) */
|
|
429
|
+
getActiveSubscriptions: Promise<ActiveSubscription[]>;
|
|
430
|
+
/** Fetch the current app transaction (iOS 16+) */
|
|
431
|
+
getAppTransactionIOS?: Promise<AppTransaction | null>;
|
|
432
|
+
/** Get all available purchases for the current user */
|
|
433
|
+
getAvailablePurchases: Promise<Purchase[]>;
|
|
434
|
+
/** Retrieve all pending transactions in the StoreKit queue */
|
|
435
|
+
getPendingTransactionsIOS: Promise<PurchaseIOS[]>;
|
|
436
|
+
/** Get the currently promoted product (iOS 11+) */
|
|
437
|
+
getPromotedProductIOS?: Promise<ProductIOS | null>;
|
|
438
|
+
/** Get base64-encoded receipt data for validation */
|
|
439
|
+
getReceiptDataIOS: Promise<string>;
|
|
440
|
+
/** Get the current App Store storefront country code */
|
|
441
|
+
getStorefrontIOS: Promise<string>;
|
|
442
|
+
/** Get the transaction JWS (StoreKit 2) */
|
|
443
|
+
getTransactionJwsIOS: Promise<string>;
|
|
444
|
+
/** Check whether the user has active subscriptions */
|
|
445
|
+
hasActiveSubscriptions: Promise<boolean>;
|
|
446
|
+
/** Check introductory offer eligibility for specific products */
|
|
447
|
+
isEligibleForIntroOfferIOS: Promise<boolean>;
|
|
448
|
+
/** Verify a StoreKit 2 transaction signature */
|
|
449
|
+
isTransactionVerifiedIOS: Promise<boolean>;
|
|
450
|
+
/** Get the latest transaction for a product using StoreKit 2 */
|
|
451
|
+
latestTransactionIOS?: Promise<PurchaseIOS | null>;
|
|
452
|
+
/** Get StoreKit 2 subscription status details (iOS 15+) */
|
|
453
|
+
subscriptionStatusIOS: Promise<SubscriptionStatusIOS[]>;
|
|
454
|
+
}
|
|
455
|
+
export interface QuerycurrentEntitlementIOSArgs {
|
|
456
|
+
skus?: string[] | null;
|
|
457
|
+
}
|
|
458
|
+
export interface QueryfetchProductsArgs {
|
|
459
|
+
params: ProductRequest;
|
|
460
|
+
}
|
|
461
|
+
export interface QuerygetActiveSubscriptionsArgs {
|
|
462
|
+
subscriptionIds?: string[] | null;
|
|
463
|
+
}
|
|
464
|
+
export interface QuerygetAvailablePurchasesArgs {
|
|
465
|
+
options?: PurchaseOptions | null;
|
|
466
|
+
}
|
|
467
|
+
export interface QuerygetTransactionJwsIOSArgs {
|
|
468
|
+
transactionId: string;
|
|
469
|
+
}
|
|
470
|
+
export interface QueryhasActiveSubscriptionsArgs {
|
|
471
|
+
subscriptionIds?: string[] | null;
|
|
472
|
+
}
|
|
473
|
+
export interface QueryisEligibleForIntroOfferIOSArgs {
|
|
474
|
+
productIds: string[];
|
|
475
|
+
}
|
|
476
|
+
export interface QueryisTransactionVerifiedIOSArgs {
|
|
477
|
+
transactionId: string;
|
|
478
|
+
}
|
|
479
|
+
export interface QuerylatestTransactionIOSArgs {
|
|
480
|
+
sku: string;
|
|
481
|
+
}
|
|
482
|
+
export interface QuerysubscriptionStatusIOSArgs {
|
|
483
|
+
skus?: string[] | null;
|
|
484
|
+
}
|
|
485
|
+
export interface ReceiptValidationAndroidOptions {
|
|
486
|
+
accessToken: string;
|
|
487
|
+
isSub?: boolean | null;
|
|
488
|
+
packageName: string;
|
|
489
|
+
productToken: string;
|
|
480
490
|
}
|
|
481
|
-
/**
|
|
482
|
-
* Validation options for receipt validation
|
|
483
|
-
*/
|
|
484
491
|
export interface ReceiptValidationProps {
|
|
492
|
+
/** Android-specific validation options */
|
|
493
|
+
androidOptions?: ReceiptValidationAndroidOptions | null;
|
|
485
494
|
/** Product SKU to validate */
|
|
486
495
|
sku: string;
|
|
487
|
-
/** Android-specific validation options */
|
|
488
|
-
androidOptions?: {
|
|
489
|
-
packageName: string;
|
|
490
|
-
productToken: string;
|
|
491
|
-
accessToken: string;
|
|
492
|
-
isSub?: boolean;
|
|
493
|
-
};
|
|
494
|
-
}
|
|
495
|
-
/**
|
|
496
|
-
* iOS receipt validation result
|
|
497
|
-
*/
|
|
498
|
-
export interface ReceiptValidationResultIOS {
|
|
499
|
-
/** Whether the receipt is valid */
|
|
500
|
-
isValid: boolean;
|
|
501
|
-
/** Receipt data string */
|
|
502
|
-
receiptData: string;
|
|
503
|
-
/** JWS representation */
|
|
504
|
-
jwsRepresentation: string;
|
|
505
|
-
/** Latest transaction if available */
|
|
506
|
-
latestTransaction?: Purchase;
|
|
507
496
|
}
|
|
508
|
-
|
|
509
|
-
* Android receipt validation result
|
|
510
|
-
*/
|
|
497
|
+
export type ReceiptValidationResult = ReceiptValidationResultAndroid | ReceiptValidationResultIOS;
|
|
511
498
|
export interface ReceiptValidationResultAndroid {
|
|
512
499
|
autoRenewing: boolean;
|
|
513
500
|
betaProduct: boolean;
|
|
514
|
-
cancelDate
|
|
515
|
-
cancelReason
|
|
516
|
-
deferredDate
|
|
517
|
-
deferredSku
|
|
501
|
+
cancelDate?: number | null;
|
|
502
|
+
cancelReason?: string | null;
|
|
503
|
+
deferredDate?: number | null;
|
|
504
|
+
deferredSku?: number | null;
|
|
518
505
|
freeTrialEndDate: number;
|
|
519
506
|
gracePeriodEndDate: number;
|
|
520
507
|
parentProductId: string;
|
|
521
508
|
productId: string;
|
|
522
|
-
productType:
|
|
509
|
+
productType: string;
|
|
523
510
|
purchaseDate: number;
|
|
524
511
|
quantity: number;
|
|
525
512
|
receiptId: string;
|
|
@@ -528,34 +515,135 @@ export interface ReceiptValidationResultAndroid {
|
|
|
528
515
|
termSku: string;
|
|
529
516
|
testTransaction: boolean;
|
|
530
517
|
}
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
/**
|
|
552
|
-
|
|
553
|
-
/**
|
|
554
|
-
|
|
555
|
-
/**
|
|
556
|
-
|
|
557
|
-
/**
|
|
558
|
-
|
|
559
|
-
}
|
|
560
|
-
export {
|
|
518
|
+
export interface ReceiptValidationResultIOS {
|
|
519
|
+
/** Whether the receipt is valid */
|
|
520
|
+
isValid: boolean;
|
|
521
|
+
/** JWS representation */
|
|
522
|
+
jwsRepresentation: string;
|
|
523
|
+
/** Latest transaction if available */
|
|
524
|
+
latestTransaction?: Purchase | null;
|
|
525
|
+
/** Receipt data string */
|
|
526
|
+
receiptData: string;
|
|
527
|
+
}
|
|
528
|
+
export interface RefundResultIOS {
|
|
529
|
+
message?: string | null;
|
|
530
|
+
status: string;
|
|
531
|
+
}
|
|
532
|
+
export interface RenewalInfoIOS {
|
|
533
|
+
autoRenewPreference?: string | null;
|
|
534
|
+
jsonRepresentation?: string | null;
|
|
535
|
+
willAutoRenew: boolean;
|
|
536
|
+
}
|
|
537
|
+
export interface RequestPurchaseAndroidProps {
|
|
538
|
+
/** Personalized offer flag */
|
|
539
|
+
isOfferPersonalized?: boolean | null;
|
|
540
|
+
/** Obfuscated account ID */
|
|
541
|
+
obfuscatedAccountIdAndroid?: string | null;
|
|
542
|
+
/** Obfuscated profile ID */
|
|
543
|
+
obfuscatedProfileIdAndroid?: string | null;
|
|
544
|
+
/** List of product SKUs */
|
|
545
|
+
skus: string[];
|
|
546
|
+
}
|
|
547
|
+
export interface RequestPurchaseIosProps {
|
|
548
|
+
/** Auto-finish transaction (dangerous) */
|
|
549
|
+
andDangerouslyFinishTransactionAutomatically?: boolean | null;
|
|
550
|
+
/** App account token for user tracking */
|
|
551
|
+
appAccountToken?: string | null;
|
|
552
|
+
/** Purchase quantity */
|
|
553
|
+
quantity?: number | null;
|
|
554
|
+
/** Product SKU */
|
|
555
|
+
sku: string;
|
|
556
|
+
/** Discount offer to apply */
|
|
557
|
+
withOffer?: DiscountOfferInputIOS | null;
|
|
558
|
+
}
|
|
559
|
+
export interface RequestPurchaseProps {
|
|
560
|
+
/** Android-specific purchase parameters */
|
|
561
|
+
android?: RequestPurchaseAndroidProps | null;
|
|
562
|
+
/** iOS-specific purchase parameters */
|
|
563
|
+
ios?: RequestPurchaseIosProps | null;
|
|
564
|
+
}
|
|
565
|
+
export interface RequestPurchasePropsByPlatforms {
|
|
566
|
+
/** Android-specific purchase parameters */
|
|
567
|
+
android?: RequestPurchaseAndroidProps | null;
|
|
568
|
+
/** iOS-specific purchase parameters */
|
|
569
|
+
ios?: RequestPurchaseIosProps | null;
|
|
570
|
+
}
|
|
571
|
+
export interface RequestPurchaseResult {
|
|
572
|
+
purchase?: Purchase | null;
|
|
573
|
+
purchases?: Purchase[] | null;
|
|
574
|
+
}
|
|
575
|
+
export interface RequestSubscriptionAndroidProps {
|
|
576
|
+
/** Personalized offer flag */
|
|
577
|
+
isOfferPersonalized?: boolean | null;
|
|
578
|
+
/** Obfuscated account ID */
|
|
579
|
+
obfuscatedAccountIdAndroid?: string | null;
|
|
580
|
+
/** Obfuscated profile ID */
|
|
581
|
+
obfuscatedProfileIdAndroid?: string | null;
|
|
582
|
+
/** Purchase token for upgrades/downgrades */
|
|
583
|
+
purchaseTokenAndroid?: string | null;
|
|
584
|
+
/** Replacement mode for subscription changes */
|
|
585
|
+
replacementModeAndroid?: number | null;
|
|
586
|
+
/** List of subscription SKUs */
|
|
587
|
+
skus: string[];
|
|
588
|
+
/** Subscription offers */
|
|
589
|
+
subscriptionOffers?: AndroidSubscriptionOfferInput[] | null;
|
|
590
|
+
}
|
|
591
|
+
export interface RequestSubscriptionIosProps {
|
|
592
|
+
andDangerouslyFinishTransactionAutomatically?: boolean | null;
|
|
593
|
+
appAccountToken?: string | null;
|
|
594
|
+
quantity?: number | null;
|
|
595
|
+
sku: string;
|
|
596
|
+
withOffer?: DiscountOfferInputIOS | null;
|
|
597
|
+
}
|
|
598
|
+
export interface RequestSubscriptionPropsByPlatforms {
|
|
599
|
+
/** Android-specific subscription parameters */
|
|
600
|
+
android?: RequestSubscriptionAndroidProps | null;
|
|
601
|
+
/** iOS-specific subscription parameters */
|
|
602
|
+
ios?: RequestPurchaseIosProps | null;
|
|
603
|
+
}
|
|
604
|
+
export interface Subscription {
|
|
605
|
+
/** Fires when the App Store surfaces a promoted product (iOS only) */
|
|
606
|
+
promotedProductIOS: string;
|
|
607
|
+
/** Fires when a purchase fails or is cancelled */
|
|
608
|
+
purchaseError: PurchaseError;
|
|
609
|
+
/** Fires when a purchase completes successfully or a pending purchase resolves */
|
|
610
|
+
purchaseUpdated: Purchase;
|
|
611
|
+
}
|
|
612
|
+
export interface SubscriptionInfoIOS {
|
|
613
|
+
introductoryOffer?: SubscriptionOfferIOS | null;
|
|
614
|
+
promotionalOffers?: SubscriptionOfferIOS[] | null;
|
|
615
|
+
subscriptionGroupId: string;
|
|
616
|
+
subscriptionPeriod: SubscriptionPeriodValueIOS;
|
|
617
|
+
}
|
|
618
|
+
export interface SubscriptionOfferIOS {
|
|
619
|
+
displayPrice: string;
|
|
620
|
+
id: string;
|
|
621
|
+
paymentMode: PaymentModeIOS;
|
|
622
|
+
period: SubscriptionPeriodValueIOS;
|
|
623
|
+
periodCount: number;
|
|
624
|
+
price: number;
|
|
625
|
+
type: SubscriptionOfferTypeIOS;
|
|
626
|
+
}
|
|
627
|
+
export declare enum SubscriptionOfferTypeIOS {
|
|
628
|
+
Introductory = "INTRODUCTORY",
|
|
629
|
+
Promotional = "PROMOTIONAL"
|
|
630
|
+
}
|
|
631
|
+
export declare enum SubscriptionPeriodIOS {
|
|
632
|
+
Day = "DAY",
|
|
633
|
+
Empty = "EMPTY",
|
|
634
|
+
Month = "MONTH",
|
|
635
|
+
Week = "WEEK",
|
|
636
|
+
Year = "YEAR"
|
|
637
|
+
}
|
|
638
|
+
export interface SubscriptionPeriodValueIOS {
|
|
639
|
+
unit: SubscriptionPeriodIOS;
|
|
640
|
+
value: number;
|
|
641
|
+
}
|
|
642
|
+
export interface SubscriptionStatusIOS {
|
|
643
|
+
renewalInfo?: RenewalInfoIOS | null;
|
|
644
|
+
state: string;
|
|
645
|
+
}
|
|
646
|
+
export interface VoidResult {
|
|
647
|
+
success: boolean;
|
|
648
|
+
}
|
|
561
649
|
//# sourceMappingURL=types.d.ts.map
|