expo-iap 3.1.38 → 3.3.0-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/.prettierignore +1 -0
- package/android/src/main/java/expo/modules/iap/ExpoIapModule.kt +124 -0
- package/build/index.d.ts +15 -6
- package/build/index.d.ts.map +1 -1
- package/build/index.js +30 -17
- package/build/index.js.map +1 -1
- package/build/modules/android.d.ts +53 -1
- package/build/modules/android.d.ts.map +1 -1
- package/build/modules/android.js +61 -0
- package/build/modules/android.js.map +1 -1
- package/build/types.d.ts +255 -11
- package/build/types.d.ts.map +1 -1
- package/build/types.js.map +1 -1
- package/build/useIAP.d.ts.map +1 -1
- package/build/useIAP.js +2 -0
- package/build/useIAP.js.map +1 -1
- package/coverage/clover.xml +147 -139
- package/coverage/coverage-final.json +5 -5
- package/coverage/lcov-report/block-navigation.js +1 -1
- package/coverage/lcov-report/index.html +23 -23
- package/coverage/lcov-report/sorter.js +7 -21
- package/coverage/lcov-report/src/ExpoIap.types.ts.html +1396 -0
- package/coverage/lcov-report/src/helpers/index.html +116 -0
- package/coverage/lcov-report/src/helpers/subscription.ts.html +499 -0
- package/coverage/lcov-report/src/index.html +14 -14
- package/coverage/lcov-report/src/index.ts.html +64 -25
- package/coverage/lcov-report/src/modules/android.ts.html +233 -8
- package/coverage/lcov-report/src/modules/index.html +15 -15
- package/coverage/lcov-report/src/modules/ios.ts.html +1 -1
- package/coverage/lcov-report/src/onside/ExpoOnsideMarketplaceAvailabilityModule.ts.html +145 -0
- package/coverage/lcov-report/src/onside/index.html +131 -0
- package/coverage/lcov-report/src/onside/index.ts.html +253 -0
- package/coverage/lcov-report/src/types/ExpoIapAndroid.types.ts.html +502 -0
- package/coverage/lcov-report/src/types/index.html +116 -0
- package/coverage/lcov-report/src/useIAP.ts.html +1654 -0
- package/coverage/lcov-report/src/utils/constants.ts.html +127 -0
- package/coverage/lcov-report/src/utils/debug.ts.html +1 -1
- package/coverage/lcov-report/src/utils/errorMapping.ts.html +1 -1
- package/coverage/lcov-report/src/utils/index.html +1 -1
- package/coverage/lcov.info +249 -232
- package/ios/expoiap.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
- package/ios/expoiap.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/openiap-versions.json +3 -3
- package/package.json +1 -1
- package/plugin/tsconfig.tsbuildinfo +1 -1
- package/src/index.ts +30 -17
- package/src/modules/android.ts +75 -0
- package/src/types.ts +273 -12
- package/src/useIAP.ts +2 -0
package/src/types.ts
CHANGED
|
@@ -65,6 +65,38 @@ export interface AppTransaction {
|
|
|
65
65
|
signedDate: number;
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
+
/**
|
|
69
|
+
* Billing program types for external content links and external offers (Android)
|
|
70
|
+
* Available in Google Play Billing Library 8.2.0+
|
|
71
|
+
*/
|
|
72
|
+
export type BillingProgramAndroid = 'unspecified' | 'external-content-link' | 'external-offer';
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Result of checking billing program availability (Android)
|
|
76
|
+
* Available in Google Play Billing Library 8.2.0+
|
|
77
|
+
*/
|
|
78
|
+
export interface BillingProgramAvailabilityResultAndroid {
|
|
79
|
+
/** The billing program that was checked */
|
|
80
|
+
billingProgram: BillingProgramAndroid;
|
|
81
|
+
/** Whether the billing program is available for the user */
|
|
82
|
+
isAvailable: boolean;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Reporting details for transactions made outside of Google Play Billing (Android)
|
|
87
|
+
* Contains the external transaction token needed for reporting
|
|
88
|
+
* Available in Google Play Billing Library 8.2.0+
|
|
89
|
+
*/
|
|
90
|
+
export interface BillingProgramReportingDetailsAndroid {
|
|
91
|
+
/** The billing program that the reporting details are associated with */
|
|
92
|
+
billingProgram: BillingProgramAndroid;
|
|
93
|
+
/**
|
|
94
|
+
* External transaction token used to report transactions made outside of Google Play Billing.
|
|
95
|
+
* This token must be used when reporting the external transaction to Google.
|
|
96
|
+
*/
|
|
97
|
+
externalTransactionToken: string;
|
|
98
|
+
}
|
|
99
|
+
|
|
68
100
|
export interface DeepLinkOptions {
|
|
69
101
|
/** Android package name to target (required on Android) */
|
|
70
102
|
packageNameAndroid?: (string | null);
|
|
@@ -72,6 +104,34 @@ export interface DeepLinkOptions {
|
|
|
72
104
|
skuAndroid?: (string | null);
|
|
73
105
|
}
|
|
74
106
|
|
|
107
|
+
/**
|
|
108
|
+
* Discount amount details for one-time purchase offers (Android)
|
|
109
|
+
* Available in Google Play Billing Library 7.0+
|
|
110
|
+
*/
|
|
111
|
+
export interface DiscountAmountAndroid {
|
|
112
|
+
/** Discount amount in micro-units (1,000,000 = 1 unit of currency) */
|
|
113
|
+
discountAmountMicros: string;
|
|
114
|
+
/** Formatted discount amount with currency sign (e.g., "$4.99") */
|
|
115
|
+
formattedDiscountAmount: string;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Discount display information for one-time purchase offers (Android)
|
|
120
|
+
* Available in Google Play Billing Library 7.0+
|
|
121
|
+
*/
|
|
122
|
+
export interface DiscountDisplayInfoAndroid {
|
|
123
|
+
/**
|
|
124
|
+
* Absolute discount amount details
|
|
125
|
+
* Only returned for fixed amount discounts
|
|
126
|
+
*/
|
|
127
|
+
discountAmount?: (DiscountAmountAndroid | null);
|
|
128
|
+
/**
|
|
129
|
+
* Percentage discount (e.g., 33 for 33% off)
|
|
130
|
+
* Only returned for percentage-based discounts
|
|
131
|
+
*/
|
|
132
|
+
percentageDiscount?: (number | null);
|
|
133
|
+
}
|
|
134
|
+
|
|
75
135
|
export interface DiscountIOS {
|
|
76
136
|
identifier: string;
|
|
77
137
|
localizedPrice?: (string | null);
|
|
@@ -155,6 +215,40 @@ export enum ErrorCode {
|
|
|
155
215
|
UserError = 'user-error'
|
|
156
216
|
}
|
|
157
217
|
|
|
218
|
+
/**
|
|
219
|
+
* Launch mode for external link flow (Android)
|
|
220
|
+
* Determines how the external URL is launched
|
|
221
|
+
* Available in Google Play Billing Library 8.2.0+
|
|
222
|
+
*/
|
|
223
|
+
export type ExternalLinkLaunchModeAndroid = 'unspecified' | 'launch-in-external-browser-or-app' | 'caller-will-launch-link';
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* Link type for external link flow (Android)
|
|
227
|
+
* Specifies the type of external link destination
|
|
228
|
+
* Available in Google Play Billing Library 8.2.0+
|
|
229
|
+
*/
|
|
230
|
+
export type ExternalLinkTypeAndroid = 'unspecified' | 'link-to-digital-content-offer' | 'link-to-app-download';
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* External offer availability result (Android)
|
|
234
|
+
* @deprecated Use BillingProgramAvailabilityResultAndroid with isBillingProgramAvailableAsync instead
|
|
235
|
+
* Available in Google Play Billing Library 6.2.0+, deprecated in 8.2.0
|
|
236
|
+
*/
|
|
237
|
+
export interface ExternalOfferAvailabilityResultAndroid {
|
|
238
|
+
/** Whether external offers are available for the user */
|
|
239
|
+
isAvailable: boolean;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* External offer reporting details (Android)
|
|
244
|
+
* @deprecated Use BillingProgramReportingDetailsAndroid with createBillingProgramReportingDetailsAsync instead
|
|
245
|
+
* Available in Google Play Billing Library 6.2.0+, deprecated in 8.2.0
|
|
246
|
+
*/
|
|
247
|
+
export interface ExternalOfferReportingDetailsAndroid {
|
|
248
|
+
/** External transaction token for reporting external offer transactions */
|
|
249
|
+
externalTransactionToken: string;
|
|
250
|
+
}
|
|
251
|
+
|
|
158
252
|
/** Result of presenting an external purchase link (iOS 18.2+) */
|
|
159
253
|
export interface ExternalPurchaseLinkResultIOS {
|
|
160
254
|
/** Optional error message if the presentation failed */
|
|
@@ -180,11 +274,11 @@ export type IapEvent = 'purchase-updated' | 'purchase-error' | 'promoted-product
|
|
|
180
274
|
|
|
181
275
|
export type IapPlatform = 'ios' | 'android';
|
|
182
276
|
|
|
277
|
+
export type IapStore = 'unknown' | 'apple' | 'google' | 'horizon';
|
|
278
|
+
|
|
183
279
|
/** Unified purchase states from IAPKit verification response. */
|
|
184
280
|
export type IapkitPurchaseState = 'entitled' | 'pending-acknowledgment' | 'pending' | 'canceled' | 'expired' | 'ready-to-consume' | 'consumed' | 'unknown' | 'inauthentic';
|
|
185
281
|
|
|
186
|
-
export type IapkitStore = 'apple' | 'google';
|
|
187
|
-
|
|
188
282
|
/** Connection initialization configuration */
|
|
189
283
|
export interface InitConnectionConfig {
|
|
190
284
|
/**
|
|
@@ -194,6 +288,33 @@ export interface InitConnectionConfig {
|
|
|
194
288
|
alternativeBillingModeAndroid?: (AlternativeBillingModeAndroid | null);
|
|
195
289
|
}
|
|
196
290
|
|
|
291
|
+
/**
|
|
292
|
+
* Parameters for launching an external link (Android)
|
|
293
|
+
* Used with launchExternalLink to initiate external offer or app install flows
|
|
294
|
+
* Available in Google Play Billing Library 8.2.0+
|
|
295
|
+
*/
|
|
296
|
+
export interface LaunchExternalLinkParamsAndroid {
|
|
297
|
+
/** The billing program (EXTERNAL_CONTENT_LINK or EXTERNAL_OFFER) */
|
|
298
|
+
billingProgram: BillingProgramAndroid;
|
|
299
|
+
/** The external link launch mode */
|
|
300
|
+
launchMode: ExternalLinkLaunchModeAndroid;
|
|
301
|
+
/** The type of the external link */
|
|
302
|
+
linkType: ExternalLinkTypeAndroid;
|
|
303
|
+
/** The URI where the content will be accessed from */
|
|
304
|
+
linkUri: string;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
/**
|
|
308
|
+
* Limited quantity information for one-time purchase offers (Android)
|
|
309
|
+
* Available in Google Play Billing Library 7.0+
|
|
310
|
+
*/
|
|
311
|
+
export interface LimitedQuantityInfoAndroid {
|
|
312
|
+
/** Maximum quantity a user can purchase */
|
|
313
|
+
maximumQuantity: number;
|
|
314
|
+
/** Remaining quantity the user can still purchase */
|
|
315
|
+
remainingQuantity: number;
|
|
316
|
+
}
|
|
317
|
+
|
|
197
318
|
export interface Mutation {
|
|
198
319
|
/** Acknowledge a non-consumable purchase or subscription */
|
|
199
320
|
acknowledgePurchaseAndroid: Promise<boolean>;
|
|
@@ -310,6 +431,23 @@ export type MutationVerifyPurchaseWithProviderArgs = VerifyPurchaseWithProviderP
|
|
|
310
431
|
|
|
311
432
|
export type PaymentModeIOS = 'empty' | 'free-trial' | 'pay-as-you-go' | 'pay-up-front';
|
|
312
433
|
|
|
434
|
+
/**
|
|
435
|
+
* Pre-order details for one-time purchase products (Android)
|
|
436
|
+
* Available in Google Play Billing Library 8.1.0+
|
|
437
|
+
*/
|
|
438
|
+
export interface PreorderDetailsAndroid {
|
|
439
|
+
/**
|
|
440
|
+
* Pre-order presale end time in milliseconds since epoch.
|
|
441
|
+
* This is when the presale period ends and the product will be released.
|
|
442
|
+
*/
|
|
443
|
+
preorderPresaleEndTimeMillis: string;
|
|
444
|
+
/**
|
|
445
|
+
* Pre-order release time in milliseconds since epoch.
|
|
446
|
+
* This is when the product will be available to users who pre-ordered.
|
|
447
|
+
*/
|
|
448
|
+
preorderReleaseTimeMillis: string;
|
|
449
|
+
}
|
|
450
|
+
|
|
313
451
|
export interface PricingPhaseAndroid {
|
|
314
452
|
billingCycleCount: number;
|
|
315
453
|
billingPeriod: string;
|
|
@@ -333,7 +471,11 @@ export interface ProductAndroid extends ProductCommon {
|
|
|
333
471
|
displayPrice: string;
|
|
334
472
|
id: string;
|
|
335
473
|
nameAndroid: string;
|
|
336
|
-
|
|
474
|
+
/**
|
|
475
|
+
* One-time purchase offer details including discounts (Android)
|
|
476
|
+
* Returns all eligible offers. Available in Google Play Billing Library 7.0+
|
|
477
|
+
*/
|
|
478
|
+
oneTimePurchaseOfferDetailsAndroid?: (ProductAndroidOneTimePurchaseOfferDetail[] | null);
|
|
337
479
|
platform: 'android';
|
|
338
480
|
price?: (number | null);
|
|
339
481
|
subscriptionOfferDetailsAndroid?: (ProductSubscriptionAndroidOfferDetails[] | null);
|
|
@@ -341,10 +483,41 @@ export interface ProductAndroid extends ProductCommon {
|
|
|
341
483
|
type: 'in-app';
|
|
342
484
|
}
|
|
343
485
|
|
|
486
|
+
/**
|
|
487
|
+
* One-time purchase offer details (Android)
|
|
488
|
+
* Available in Google Play Billing Library 7.0+
|
|
489
|
+
*/
|
|
344
490
|
export interface ProductAndroidOneTimePurchaseOfferDetail {
|
|
491
|
+
/**
|
|
492
|
+
* Discount display information
|
|
493
|
+
* Only available for discounted offers
|
|
494
|
+
*/
|
|
495
|
+
discountDisplayInfo?: (DiscountDisplayInfoAndroid | null);
|
|
345
496
|
formattedPrice: string;
|
|
497
|
+
/**
|
|
498
|
+
* Full (non-discounted) price in micro-units
|
|
499
|
+
* Only available for discounted offers
|
|
500
|
+
*/
|
|
501
|
+
fullPriceMicros?: (string | null);
|
|
502
|
+
/** Limited quantity information */
|
|
503
|
+
limitedQuantityInfo?: (LimitedQuantityInfoAndroid | null);
|
|
504
|
+
/** Offer ID */
|
|
505
|
+
offerId?: (string | null);
|
|
506
|
+
/** List of offer tags */
|
|
507
|
+
offerTags: string[];
|
|
508
|
+
/** Offer token for use in BillingFlowParams when purchasing */
|
|
509
|
+
offerToken: string;
|
|
510
|
+
/**
|
|
511
|
+
* Pre-order details for products available for pre-order
|
|
512
|
+
* Available in Google Play Billing Library 8.1.0+
|
|
513
|
+
*/
|
|
514
|
+
preorderDetailsAndroid?: (PreorderDetailsAndroid | null);
|
|
346
515
|
priceAmountMicros: string;
|
|
347
516
|
priceCurrencyCode: string;
|
|
517
|
+
/** Rental details for rental offers */
|
|
518
|
+
rentalDetailsAndroid?: (RentalDetailsAndroid | null);
|
|
519
|
+
/** Valid time window for the offer */
|
|
520
|
+
validTimeWindow?: (ValidTimeWindowAndroid | null);
|
|
348
521
|
}
|
|
349
522
|
|
|
350
523
|
export interface ProductCommon {
|
|
@@ -397,7 +570,11 @@ export interface ProductSubscriptionAndroid extends ProductCommon {
|
|
|
397
570
|
displayPrice: string;
|
|
398
571
|
id: string;
|
|
399
572
|
nameAndroid: string;
|
|
400
|
-
|
|
573
|
+
/**
|
|
574
|
+
* One-time purchase offer details including discounts (Android)
|
|
575
|
+
* Returns all eligible offers. Available in Google Play Billing Library 7.0+
|
|
576
|
+
*/
|
|
577
|
+
oneTimePurchaseOfferDetailsAndroid?: (ProductAndroidOneTimePurchaseOfferDetail[] | null);
|
|
401
578
|
platform: 'android';
|
|
402
579
|
price?: (number | null);
|
|
403
580
|
subscriptionOfferDetailsAndroid: ProductSubscriptionAndroidOfferDetails[];
|
|
@@ -454,15 +631,26 @@ export interface PurchaseAndroid extends PurchaseCommon {
|
|
|
454
631
|
ids?: (string[] | null);
|
|
455
632
|
isAcknowledgedAndroid?: (boolean | null);
|
|
456
633
|
isAutoRenewing: boolean;
|
|
634
|
+
/**
|
|
635
|
+
* Whether the subscription is suspended (Android)
|
|
636
|
+
* A suspended subscription means the user's payment method failed and they need to fix it.
|
|
637
|
+
* Users should be directed to the subscription center to resolve the issue.
|
|
638
|
+
* Do NOT grant entitlements for suspended subscriptions.
|
|
639
|
+
* Available in Google Play Billing Library 8.1.0+
|
|
640
|
+
*/
|
|
641
|
+
isSuspendedAndroid?: (boolean | null);
|
|
457
642
|
obfuscatedAccountIdAndroid?: (string | null);
|
|
458
643
|
obfuscatedProfileIdAndroid?: (string | null);
|
|
459
644
|
packageNameAndroid?: (string | null);
|
|
645
|
+
/** @deprecated Use store instead */
|
|
460
646
|
platform: IapPlatform;
|
|
461
647
|
productId: string;
|
|
462
648
|
purchaseState: PurchaseState;
|
|
463
649
|
purchaseToken?: (string | null);
|
|
464
650
|
quantity: number;
|
|
465
651
|
signatureAndroid?: (string | null);
|
|
652
|
+
/** Store where purchase was made */
|
|
653
|
+
store: IapStore;
|
|
466
654
|
transactionDate: number;
|
|
467
655
|
transactionId?: (string | null);
|
|
468
656
|
}
|
|
@@ -478,12 +666,15 @@ export interface PurchaseCommon {
|
|
|
478
666
|
id: string;
|
|
479
667
|
ids?: (string[] | null);
|
|
480
668
|
isAutoRenewing: boolean;
|
|
669
|
+
/** @deprecated Use store instead */
|
|
481
670
|
platform: IapPlatform;
|
|
482
671
|
productId: string;
|
|
483
672
|
purchaseState: PurchaseState;
|
|
484
673
|
/** Unified purchase token (iOS JWS, Android purchaseToken) */
|
|
485
674
|
purchaseToken?: (string | null);
|
|
486
675
|
quantity: number;
|
|
676
|
+
/** Store where purchase was made */
|
|
677
|
+
store: IapStore;
|
|
487
678
|
transactionDate: number;
|
|
488
679
|
}
|
|
489
680
|
|
|
@@ -510,6 +701,7 @@ export interface PurchaseIOS extends PurchaseCommon {
|
|
|
510
701
|
originalTransactionDateIOS?: (number | null);
|
|
511
702
|
originalTransactionIdentifierIOS?: (string | null);
|
|
512
703
|
ownershipTypeIOS?: (string | null);
|
|
704
|
+
/** @deprecated Use store instead */
|
|
513
705
|
platform: IapPlatform;
|
|
514
706
|
productId: string;
|
|
515
707
|
purchaseState: PurchaseState;
|
|
@@ -521,6 +713,8 @@ export interface PurchaseIOS extends PurchaseCommon {
|
|
|
521
713
|
renewalInfoIOS?: (RenewalInfoIOS | null);
|
|
522
714
|
revocationDateIOS?: (number | null);
|
|
523
715
|
revocationReasonIOS?: (string | null);
|
|
716
|
+
/** Store where purchase was made */
|
|
717
|
+
store: IapStore;
|
|
524
718
|
storefrontCountryCodeIOS?: (string | null);
|
|
525
719
|
subscriptionGroupIdIOS?: (string | null);
|
|
526
720
|
transactionDate: number;
|
|
@@ -669,6 +863,20 @@ export interface RenewalInfoIOS {
|
|
|
669
863
|
willAutoRenew: boolean;
|
|
670
864
|
}
|
|
671
865
|
|
|
866
|
+
/**
|
|
867
|
+
* Rental details for one-time purchase products that can be rented (Android)
|
|
868
|
+
* Available in Google Play Billing Library 7.0+
|
|
869
|
+
*/
|
|
870
|
+
export interface RentalDetailsAndroid {
|
|
871
|
+
/**
|
|
872
|
+
* Rental expiration period in ISO 8601 format
|
|
873
|
+
* Time after rental period ends when user can still extend
|
|
874
|
+
*/
|
|
875
|
+
rentalExpirationPeriod?: (string | null);
|
|
876
|
+
/** Rental period in ISO 8601 format (e.g., P7D for 7 days) */
|
|
877
|
+
rentalPeriod: string;
|
|
878
|
+
}
|
|
879
|
+
|
|
672
880
|
export interface RequestPurchaseAndroidProps {
|
|
673
881
|
/** Personalized offer flag */
|
|
674
882
|
isOfferPersonalized?: (boolean | null);
|
|
@@ -710,9 +918,13 @@ export type RequestPurchaseProps =
|
|
|
710
918
|
};
|
|
711
919
|
|
|
712
920
|
export interface RequestPurchasePropsByPlatforms {
|
|
713
|
-
/**
|
|
921
|
+
/** @deprecated Use google instead */
|
|
714
922
|
android?: (RequestPurchaseAndroidProps | null);
|
|
715
|
-
/**
|
|
923
|
+
/** Apple-specific purchase parameters */
|
|
924
|
+
apple?: (RequestPurchaseIosProps | null);
|
|
925
|
+
/** Google-specific purchase parameters */
|
|
926
|
+
google?: (RequestPurchaseAndroidProps | null);
|
|
927
|
+
/** @deprecated Use apple instead */
|
|
716
928
|
ios?: (RequestPurchaseIosProps | null);
|
|
717
929
|
}
|
|
718
930
|
|
|
@@ -727,12 +939,20 @@ export interface RequestSubscriptionAndroidProps {
|
|
|
727
939
|
obfuscatedProfileIdAndroid?: (string | null);
|
|
728
940
|
/** Purchase token for upgrades/downgrades */
|
|
729
941
|
purchaseTokenAndroid?: (string | null);
|
|
730
|
-
/**
|
|
942
|
+
/**
|
|
943
|
+
* Replacement mode for subscription changes
|
|
944
|
+
* @deprecated Use subscriptionProductReplacementParams instead for item-level replacement (8.1.0+)
|
|
945
|
+
*/
|
|
731
946
|
replacementModeAndroid?: (number | null);
|
|
732
947
|
/** List of subscription SKUs */
|
|
733
948
|
skus: string[];
|
|
734
949
|
/** Subscription offers */
|
|
735
950
|
subscriptionOffers?: (AndroidSubscriptionOfferInput[] | null);
|
|
951
|
+
/**
|
|
952
|
+
* Product-level replacement parameters (8.1.0+)
|
|
953
|
+
* Use this instead of replacementModeAndroid for item-level replacement
|
|
954
|
+
*/
|
|
955
|
+
subscriptionProductReplacementParams?: (SubscriptionProductReplacementParamsAndroid | null);
|
|
736
956
|
}
|
|
737
957
|
|
|
738
958
|
export interface RequestSubscriptionIosProps {
|
|
@@ -744,9 +964,13 @@ export interface RequestSubscriptionIosProps {
|
|
|
744
964
|
}
|
|
745
965
|
|
|
746
966
|
export interface RequestSubscriptionPropsByPlatforms {
|
|
747
|
-
/**
|
|
967
|
+
/** @deprecated Use google instead */
|
|
748
968
|
android?: (RequestSubscriptionAndroidProps | null);
|
|
749
|
-
/**
|
|
969
|
+
/** Apple-specific subscription parameters */
|
|
970
|
+
apple?: (RequestSubscriptionIosProps | null);
|
|
971
|
+
/** Google-specific subscription parameters */
|
|
972
|
+
google?: (RequestSubscriptionAndroidProps | null);
|
|
973
|
+
/** @deprecated Use apple instead */
|
|
750
974
|
ios?: (RequestSubscriptionIosProps | null);
|
|
751
975
|
}
|
|
752
976
|
|
|
@@ -774,7 +998,7 @@ export interface RequestVerifyPurchaseWithIapkitResult {
|
|
|
774
998
|
isValid: boolean;
|
|
775
999
|
/** The current state of the purchase. */
|
|
776
1000
|
state: IapkitPurchaseState;
|
|
777
|
-
store:
|
|
1001
|
+
store: IapStore;
|
|
778
1002
|
}
|
|
779
1003
|
|
|
780
1004
|
export interface Subscription {
|
|
@@ -818,6 +1042,25 @@ export interface SubscriptionPeriodValueIOS {
|
|
|
818
1042
|
value: number;
|
|
819
1043
|
}
|
|
820
1044
|
|
|
1045
|
+
/**
|
|
1046
|
+
* Product-level subscription replacement parameters (Android)
|
|
1047
|
+
* Used with setSubscriptionProductReplacementParams in BillingFlowParams.ProductDetailsParams
|
|
1048
|
+
* Available in Google Play Billing Library 8.1.0+
|
|
1049
|
+
*/
|
|
1050
|
+
export interface SubscriptionProductReplacementParamsAndroid {
|
|
1051
|
+
/** The old product ID that needs to be replaced */
|
|
1052
|
+
oldProductId: string;
|
|
1053
|
+
/** The replacement mode for this product change */
|
|
1054
|
+
replacementMode: SubscriptionReplacementModeAndroid;
|
|
1055
|
+
}
|
|
1056
|
+
|
|
1057
|
+
/**
|
|
1058
|
+
* Replacement mode for subscription changes (Android)
|
|
1059
|
+
* These modes determine how the subscription replacement affects billing.
|
|
1060
|
+
* Available in Google Play Billing Library 8.1.0+
|
|
1061
|
+
*/
|
|
1062
|
+
export type SubscriptionReplacementModeAndroid = 'unknown-replacement-mode' | 'with-time-proration' | 'charge-prorated-price' | 'charge-full-price' | 'without-proration' | 'deferred' | 'keep-existing';
|
|
1063
|
+
|
|
821
1064
|
export interface SubscriptionStatusIOS {
|
|
822
1065
|
renewalInfo?: (RenewalInfoIOS | null);
|
|
823
1066
|
state: string;
|
|
@@ -834,6 +1077,17 @@ export interface UserChoiceBillingDetails {
|
|
|
834
1077
|
products: string[];
|
|
835
1078
|
}
|
|
836
1079
|
|
|
1080
|
+
/**
|
|
1081
|
+
* Valid time window for when an offer is available (Android)
|
|
1082
|
+
* Available in Google Play Billing Library 7.0+
|
|
1083
|
+
*/
|
|
1084
|
+
export interface ValidTimeWindowAndroid {
|
|
1085
|
+
/** End time in milliseconds since epoch */
|
|
1086
|
+
endTimeMillis: string;
|
|
1087
|
+
/** Start time in milliseconds since epoch */
|
|
1088
|
+
startTimeMillis: string;
|
|
1089
|
+
}
|
|
1090
|
+
|
|
837
1091
|
export interface VerifyPurchaseAndroidOptions {
|
|
838
1092
|
accessToken: string;
|
|
839
1093
|
isSub?: (boolean | null);
|
|
@@ -882,14 +1136,21 @@ export interface VerifyPurchaseResultIOS {
|
|
|
882
1136
|
receiptData: string;
|
|
883
1137
|
}
|
|
884
1138
|
|
|
1139
|
+
export interface VerifyPurchaseWithProviderError {
|
|
1140
|
+
code?: (string | null);
|
|
1141
|
+
message: string;
|
|
1142
|
+
}
|
|
1143
|
+
|
|
885
1144
|
export interface VerifyPurchaseWithProviderProps {
|
|
886
1145
|
iapkit?: (RequestVerifyPurchaseWithIapkitProps | null);
|
|
887
1146
|
provider: PurchaseVerificationProvider;
|
|
888
1147
|
}
|
|
889
1148
|
|
|
890
1149
|
export interface VerifyPurchaseWithProviderResult {
|
|
891
|
-
/**
|
|
892
|
-
|
|
1150
|
+
/** Error details if verification failed */
|
|
1151
|
+
errors?: (VerifyPurchaseWithProviderError[] | null);
|
|
1152
|
+
/** IAPKit verification result */
|
|
1153
|
+
iapkit?: (RequestVerifyPurchaseWithIapkitResult | null);
|
|
893
1154
|
provider: PurchaseVerificationProvider;
|
|
894
1155
|
}
|
|
895
1156
|
|
package/src/useIAP.ts
CHANGED
|
@@ -203,7 +203,9 @@ export function useIAP(options?: UseIAPOptions): UseIap {
|
|
|
203
203
|
purchaseState: purchase.purchaseState,
|
|
204
204
|
purchaseToken: purchase.purchaseToken ?? null,
|
|
205
205
|
quantity: purchase.quantity,
|
|
206
|
+
store: purchase.store,
|
|
206
207
|
transactionDate: purchase.transactionDate,
|
|
208
|
+
transactionId: purchase.transactionId,
|
|
207
209
|
}),
|
|
208
210
|
[],
|
|
209
211
|
);
|