-
-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathtypes.ts
More file actions
2255 lines (2082 loc) · 83.4 KB
/
Copy pathtypes.ts
File metadata and controls
2255 lines (2082 loc) · 83.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
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
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// ============================================================================
// AUTO-GENERATED TYPES — DO NOT EDIT DIRECTLY
// Run `npm run generate` after updating any *.graphql schema file.
// ============================================================================
export interface ActiveSubscription {
autoRenewingAndroid?: (boolean | null);
basePlanIdAndroid?: (string | null);
/**
* The current plan identifier. This is:
* - On Android: the basePlanId (e.g., "premium", "premium-year")
* - On iOS: the productId (e.g., "com.example.premium_monthly", "com.example.premium_yearly")
* This provides a unified way to identify which specific plan/tier the user is subscribed to.
*/
currentPlanId?: (string | null);
daysUntilExpirationIOS?: (number | null);
environmentIOS?: (string | null);
expirationDateIOS?: (number | null);
isActive: boolean;
productId: string;
purchaseToken?: (string | null);
/** Required for subscription upgrade/downgrade on Android */
purchaseTokenAndroid?: (string | null);
/**
* Renewal information from StoreKit 2 (iOS only). Contains details about subscription renewal status,
* pending upgrades/downgrades, and auto-renewal preferences.
*/
renewalInfoIOS?: (RenewalInfoIOS | null);
transactionDate: number;
transactionId: string;
/**
* @deprecated iOS only - use daysUntilExpirationIOS instead.
* Whether the subscription will expire soon (within 7 days).
* Consider using daysUntilExpirationIOS for more precise control.
*/
willExpireSoon?: (boolean | null);
}
/**
* Advanced Commerce metadata from a transaction (iOS 18.4+).
* Contains item details, tax information, and refund data for purchases
* made through the Advanced Commerce API using generic SKUs.
* Only present for transactions that use the Advanced Commerce API.
*/
export interface AdvancedCommerceInfoIOS {
/** Optional description */
description?: (string | null);
/** Optional display name */
displayName?: (string | null);
/** Estimated tax amount (decimal string) */
estimatedTax?: (string | null);
/** The items purchased as part of this transaction */
items: AdvancedCommerceItemIOS[];
/** Request reference identifier for tracking */
requestReferenceId?: (string | null);
/** Tax code for the transaction */
taxCode?: (string | null);
/** Price excluding tax (decimal string) */
taxExclusivePrice?: (string | null);
/** Tax rate applied (decimal string) */
taxRate?: (string | null);
}
/** Details of an Advanced Commerce item (iOS 18.4+). */
export interface AdvancedCommerceItemDetailsIOS {
/** JSON representation of the item details */
jsonRepresentation?: (string | null);
}
/**
* An item purchased through the Advanced Commerce API (iOS 18.4+).
* Represents a developer-defined product within a generic SKU transaction.
*/
export interface AdvancedCommerceItemIOS {
/** The item's detail information */
details?: (AdvancedCommerceItemDetailsIOS | null);
/** Refunds issued for this item, if any */
refunds?: (AdvancedCommerceRefundIOS[] | null);
/** Date access to this item was revoked (milliseconds since epoch) */
revocationDate?: (number | null);
}
/** Refund information for an Advanced Commerce item (iOS 18.4+). */
export interface AdvancedCommerceRefundIOS {
/** JSON representation of the refund details */
jsonRepresentation?: (string | null);
}
/**
* Alternative billing mode for Android
* Controls which billing system is used
* @deprecated Use enableBillingProgramAndroid with BillingProgramAndroid instead.
* Use USER_CHOICE_BILLING for user choice billing, EXTERNAL_OFFER for alternative only.
*/
export type AlternativeBillingModeAndroid = 'none' | 'user-choice' | 'alternative-only';
export interface AndroidSubscriptionOfferInput {
/** Offer token */
offerToken: string;
/** Product SKU */
sku: string;
}
export interface AppTransaction {
appId: number;
appTransactionId?: (string | null);
appVersion: string;
appVersionId: number;
bundleId: string;
deviceVerification: string;
deviceVerificationNonce: string;
environment: string;
originalAppVersion: string;
originalPlatform?: (string | null);
originalPurchaseDate: number;
preorderDate?: (number | null);
signedDate: number;
}
/**
* Billing program types for external content links, external offers, and external payments (Android)
* Available in Google Play Billing Library 8.2.0+, EXTERNAL_PAYMENTS added in 8.3.0
*/
export type BillingProgramAndroid = 'unspecified' | 'user-choice-billing' | 'external-content-link' | 'external-offer' | 'external-payments';
/**
* Result of checking billing program availability (Android)
* Available in Google Play Billing Library 8.2.0+
*/
export interface BillingProgramAvailabilityResultAndroid {
/** The billing program that was checked */
billingProgram: BillingProgramAndroid;
/** Whether the billing program is available for the user */
isAvailable: boolean;
}
/**
* Reporting details for transactions made outside of Google Play Billing (Android)
* Contains the external transaction token needed for reporting
* Available in Google Play Billing Library 8.2.0+
*/
export interface BillingProgramReportingDetailsAndroid {
/** The billing program that the reporting details are associated with */
billingProgram: BillingProgramAndroid;
/**
* External transaction token used to report transactions made outside of Google Play Billing.
* This token must be used when reporting the external transaction to Google.
*/
externalTransactionToken: string;
}
/**
* Extended billing result with sub-response code (Android)
* Available in Google Play Billing Library 8.0.0+
*/
export interface BillingResultAndroid {
/** Debug message from the billing library */
debugMessage?: (string | null);
/** The response code from the billing operation */
responseCode: number;
/**
* Sub-response code for more granular error information (8.0+).
* Provides additional context when responseCode indicates an error.
*/
subResponseCode?: (SubResponseCodeAndroid | null);
}
export interface DeepLinkOptions {
/** Android package name to target (required on Android) */
packageNameAndroid?: (string | null);
/** Android SKU to open (required on Android) */
skuAndroid?: (string | null);
}
/**
* Launch mode for developer billing option (Android)
* Determines how the external payment URL is launched
* Available in Google Play Billing Library 8.3.0+
*/
export type DeveloperBillingLaunchModeAndroid = 'unspecified' | 'launch-in-external-browser-or-app' | 'caller-will-launch-link';
/**
* Parameters for developer billing option in purchase flow (Android)
* Used with BillingFlowParams to enable external payments flow
* Available in Google Play Billing Library 8.3.0+
*/
export interface DeveloperBillingOptionParamsAndroid {
/** The billing program (should be EXTERNAL_PAYMENTS for external payments flow) */
billingProgram: BillingProgramAndroid;
/** The launch mode for the external payment link */
launchMode: DeveloperBillingLaunchModeAndroid;
/** The URI where the external payment will be processed */
linkUri: string;
}
/**
* Details provided when user selects developer billing option (Android)
* Received via DeveloperProvidedBillingListener callback
* Available in Google Play Billing Library 8.3.0+
*/
export interface DeveloperProvidedBillingDetailsAndroid {
/**
* External transaction token used to report transactions made through developer billing.
* This token must be used when reporting the external transaction to Google Play.
* Must be reported within 24 hours of the transaction.
*/
externalTransactionToken: string;
}
/**
* Discount amount details for one-time purchase offers (Android)
* Available in Google Play Billing Library 7.0+
*/
export interface DiscountAmountAndroid {
/** Discount amount in micro-units (1,000,000 = 1 unit of currency) */
discountAmountMicros: string;
/** Formatted discount amount with currency sign (e.g., "$4.99") */
formattedDiscountAmount: string;
}
/**
* Discount display information for one-time purchase offers (Android)
* Available in Google Play Billing Library 7.0+
*/
export interface DiscountDisplayInfoAndroid {
/**
* Absolute discount amount details
* Only returned for fixed amount discounts
*/
discountAmount?: (DiscountAmountAndroid | null);
/**
* Percentage discount (e.g., 33 for 33% off)
* Only returned for percentage-based discounts
*/
percentageDiscount?: (number | null);
}
/**
* Discount information returned from the store.
* @deprecated Use the standardized SubscriptionOffer type instead for cross-platform compatibility.
* @see https://openiap.dev/docs/types#subscription-offer
*/
export interface DiscountIOS {
identifier: string;
localizedPrice?: (string | null);
numberOfPeriods: number;
paymentMode: PaymentModeIOS;
price: string;
priceAmount: number;
subscriptionPeriod: string;
type: string;
}
/**
* Standardized one-time product discount offer.
* Provides a unified interface for one-time purchase discounts across platforms.
*
* Currently supported on Android (Google Play Billing 7.0+).
* iOS does not support one-time purchase discounts in the same way.
*
* @see https://openiap.dev/docs/features/discount
*/
export interface DiscountOffer {
/** Currency code (ISO 4217, e.g., "USD") */
currency: string;
/**
* [Android] Fixed discount amount in micro-units.
* Only present for fixed amount discounts.
*/
discountAmountMicrosAndroid?: (string | null);
/** Formatted display price string (e.g., "$4.99") */
displayPrice: string;
/** [Android] Formatted discount amount string (e.g., "$5.00 OFF"). */
formattedDiscountAmountAndroid?: (string | null);
/**
* [Android] Original full price in micro-units before discount.
* Divide by 1,000,000 to get the actual price.
* Use for displaying strikethrough original price.
*/
fullPriceMicrosAndroid?: (string | null);
/**
* Unique identifier for the offer.
* - iOS: Not applicable (one-time discounts not supported)
* - Android: offerId from ProductAndroidOneTimePurchaseOfferDetail
*/
id?: (string | null);
/**
* [Android] Limited quantity information.
* Contains maximumQuantity and remainingQuantity.
*/
limitedQuantityInfoAndroid?: (LimitedQuantityInfoAndroid | null);
/** [Android] List of tags associated with this offer. */
offerTagsAndroid?: (string[] | null);
/**
* [Android] Offer token required for purchase.
* Must be passed to requestPurchase() when purchasing with this offer.
*/
offerTokenAndroid?: (string | null);
/**
* [Android] Percentage discount (e.g., 33 for 33% off).
* Only present for percentage-based discounts.
*/
percentageDiscountAndroid?: (number | null);
/**
* [Android] Pre-order details if this is a pre-order offer.
* Available in Google Play Billing Library 8.1.0+
*/
preorderDetailsAndroid?: (PreorderDetailsAndroid | null);
/** Numeric price value */
price: number;
/**
* [Android] Purchase option ID for this offer.
* Used to identify which purchase option the user selected.
* Available in Google Play Billing Library 7.0+
*/
purchaseOptionIdAndroid?: (string | null);
/** [Android] Rental details if this is a rental offer. */
rentalDetailsAndroid?: (RentalDetailsAndroid | null);
/** Type of discount offer */
type: DiscountOfferType;
/**
* [Android] Valid time window for the offer.
* Contains startTimeMillis and endTimeMillis.
*/
validTimeWindowAndroid?: (ValidTimeWindowAndroid | null);
}
/**
* iOS DiscountOffer (output type).
* @deprecated Use the standardized SubscriptionOffer type instead for cross-platform compatibility.
* @see https://openiap.dev/docs/types#subscription-offer
*/
export interface DiscountOfferIOS {
/** Discount identifier */
identifier: string;
/** Key identifier for validation */
keyIdentifier: string;
/** Cryptographic nonce */
nonce: string;
/** Signature for validation */
signature: string;
/** Timestamp of discount offer */
timestamp: number;
}
export interface DiscountOfferInputIOS {
/** Discount identifier */
identifier: string;
/** Key identifier for validation */
keyIdentifier: string;
/** Cryptographic nonce */
nonce: string;
/** Signature for validation */
signature: string;
/** Timestamp of discount offer */
timestamp: number;
}
/**
* Discount offer type enumeration.
* Categorizes the type of discount or promotional offer.
*/
export type DiscountOfferType = 'introductory' | 'promotional' | 'one-time';
export interface EntitlementIOS {
jsonRepresentation: string;
sku: string;
transactionId: string;
}
export enum ErrorCode {
ActivityUnavailable = 'activity-unavailable',
AlreadyOwned = 'already-owned',
AlreadyPrepared = 'already-prepared',
BillingResponseJsonParseError = 'billing-response-json-parse-error',
BillingUnavailable = 'billing-unavailable',
ConnectionClosed = 'connection-closed',
DeferredPayment = 'deferred-payment',
DeveloperError = 'developer-error',
DuplicatePurchase = 'duplicate-purchase',
EmptySkuList = 'empty-sku-list',
FeatureNotSupported = 'feature-not-supported',
IapNotAvailable = 'iap-not-available',
InitConnection = 'init-connection',
Interrupted = 'interrupted',
ItemNotOwned = 'item-not-owned',
ItemUnavailable = 'item-unavailable',
NetworkError = 'network-error',
NotEnded = 'not-ended',
NotPrepared = 'not-prepared',
Pending = 'pending',
PurchaseError = 'purchase-error',
PurchaseVerificationFailed = 'purchase-verification-failed',
PurchaseVerificationFinishFailed = 'purchase-verification-finish-failed',
PurchaseVerificationFinished = 'purchase-verification-finished',
QueryProduct = 'query-product',
ReceiptFailed = 'receipt-failed',
ReceiptFinished = 'receipt-finished',
ReceiptFinishedFailed = 'receipt-finished-failed',
RemoteError = 'remote-error',
ServiceDisconnected = 'service-disconnected',
ServiceError = 'service-error',
ServiceTimeout = 'service-timeout',
SkuNotFound = 'sku-not-found',
SkuOfferMismatch = 'sku-offer-mismatch',
SyncError = 'sync-error',
TransactionValidationFailed = 'transaction-validation-failed',
Unknown = 'unknown',
UserCancelled = 'user-cancelled',
UserError = 'user-error'
}
/**
* Launch mode for external link flow (Android)
* Determines how the external URL is launched
* Available in Google Play Billing Library 8.2.0+
*/
export type ExternalLinkLaunchModeAndroid = 'unspecified' | 'launch-in-external-browser-or-app' | 'caller-will-launch-link';
/**
* Link type for external link flow (Android)
* Specifies the type of external link destination
* Available in Google Play Billing Library 8.2.0+
*/
export type ExternalLinkTypeAndroid = 'unspecified' | 'link-to-digital-content-offer' | 'link-to-app-download';
/**
* External offer availability result (Android)
* @deprecated Use BillingProgramAvailabilityResultAndroid with isBillingProgramAvailableAsync instead
* Available in Google Play Billing Library 6.2.0+, deprecated in 8.2.0
*/
export interface ExternalOfferAvailabilityResultAndroid {
/** Whether external offers are available for the user */
isAvailable: boolean;
}
/**
* External offer reporting details (Android)
* @deprecated Use BillingProgramReportingDetailsAndroid with createBillingProgramReportingDetailsAsync instead
* Available in Google Play Billing Library 6.2.0+, deprecated in 8.2.0
*/
export interface ExternalOfferReportingDetailsAndroid {
/** External transaction token for reporting external offer transactions */
externalTransactionToken: string;
}
/** Result of showing ExternalPurchaseCustomLink notice (iOS 18.1+). */
export interface ExternalPurchaseCustomLinkNoticeResultIOS {
/** Whether the user chose to continue to external purchase */
continued: boolean;
/** Optional error message if the presentation failed */
error?: (string | null);
}
/**
* Notice types for ExternalPurchaseCustomLink (iOS 18.1+).
* Determines the style of disclosure notice to display.
* Reference: https://developer.apple.com/documentation/storekit/externalpurchasecustomlink/noticetype
*/
export type ExternalPurchaseCustomLinkNoticeTypeIOS = 'browser';
/** Result of requesting an ExternalPurchaseCustomLink token (iOS 18.1+). */
export interface ExternalPurchaseCustomLinkTokenResultIOS {
/** Optional error message if token retrieval failed */
error?: (string | null);
/**
* The external purchase token string.
* Report this token to Apple's External Purchase Server API.
*/
token?: (string | null);
}
/**
* Token types for ExternalPurchaseCustomLink (iOS 18.1+).
* Used to request different types of external purchase tokens for reporting to Apple.
* Reference: https://developer.apple.com/documentation/storekit/externalpurchasecustomlink/token(for:)
*/
export type ExternalPurchaseCustomLinkTokenTypeIOS = 'acquisition' | 'services';
/** Result of presenting an external purchase link */
export interface ExternalPurchaseLinkResultIOS {
/** Optional error message if the presentation failed */
error?: (string | null);
/** Whether the user completed the external purchase flow */
success: boolean;
}
/** User actions on external purchase notice sheet (iOS 17.4+) */
export type ExternalPurchaseNoticeAction = 'continue' | 'dismissed';
/**
* Result of presenting external purchase notice sheet (iOS 17.4+)
* Returns the token when user continues to external purchase.
*/
export interface ExternalPurchaseNoticeResultIOS {
/** Optional error message if the presentation failed */
error?: (string | null);
/**
* External purchase token returned when user continues (iOS 17.4+).
* This token should be reported to Apple's External Purchase Server API.
* Only present when result is Continue.
*/
externalPurchaseToken?: (string | null);
/** Notice result indicating user action */
result: ExternalPurchaseNoticeAction;
}
export type FetchProductsResult = ProductOrSubscription[] | Product[] | ProductSubscription[] | null;
export type IapEvent = 'purchase-updated' | 'purchase-error' | 'promoted-product-ios' | 'user-choice-billing-android' | 'developer-provided-billing-android' | 'subscription-billing-issue';
export type IapPlatform = 'ios' | 'android';
export type IapStore = 'unknown' | 'apple' | 'google' | 'horizon';
/** Unified purchase states from IAPKit verification response. */
export type IapkitPurchaseState = 'entitled' | 'pending-acknowledgment' | 'pending' | 'canceled' | 'expired' | 'ready-to-consume' | 'consumed' | 'unknown' | 'inauthentic';
/** Connection initialization configuration */
export interface InitConnectionConfig {
/**
* Alternative billing mode for Android
* If not specified, defaults to NONE (standard Google Play billing)
* @deprecated Use enableBillingProgramAndroid instead.
* Use USER_CHOICE_BILLING for user choice billing, EXTERNAL_OFFER for alternative only.
*/
alternativeBillingModeAndroid?: (AlternativeBillingModeAndroid | null);
/**
* Enable a specific billing program for Android (7.0+)
* When set, enables the specified billing program for external transactions.
* - USER_CHOICE_BILLING: User can select between Google Play or alternative (7.0+)
* - EXTERNAL_CONTENT_LINK: Link to external content (8.2.0+)
* - EXTERNAL_OFFER: External offers for digital content (8.2.0+)
* - EXTERNAL_PAYMENTS: Developer provided billing, Japan only (8.3.0+)
*/
enableBillingProgramAndroid?: (BillingProgramAndroid | null);
}
/**
* Installment plan details for subscription offers (Android)
* Contains information about the installment plan commitment.
* Available in Google Play Billing Library 7.0+
*/
export interface InstallmentPlanDetailsAndroid {
/**
* Committed payments count after a user signs up for this subscription plan.
* For example, for a monthly subscription with commitmentPaymentsCount of 12,
* users will be charged monthly for 12 months after signup.
*/
commitmentPaymentsCount: number;
/**
* Subsequent committed payments count after the subscription plan renews.
* For example, for a monthly subscription with subsequentCommitmentPaymentsCount of 12,
* users will be committed to another 12 monthly payments when the plan renews.
* Returns 0 if the installment plan has no subsequent commitment (reverts to normal plan).
*/
subsequentCommitmentPaymentsCount: number;
}
/**
* Parameters for launching an external link (Android)
* Used with launchExternalLink to initiate external offer or app install flows
* Available in Google Play Billing Library 8.2.0+
*/
export interface LaunchExternalLinkParamsAndroid {
/** The billing program (EXTERNAL_CONTENT_LINK or EXTERNAL_OFFER) */
billingProgram: BillingProgramAndroid;
/** The external link launch mode */
launchMode: ExternalLinkLaunchModeAndroid;
/** The type of the external link */
linkType: ExternalLinkTypeAndroid;
/** The URI where the content will be accessed from */
linkUri: string;
}
/**
* Limited quantity information for one-time purchase offers (Android)
* Available in Google Play Billing Library 7.0+
*/
export interface LimitedQuantityInfoAndroid {
/** Maximum quantity a user can purchase */
maximumQuantity: number;
/** Remaining quantity the user can still purchase */
remainingQuantity: number;
}
export interface Mutation {
/**
* Acknowledge a non-consumable purchase. Required within 3 days or Google auto-refunds.
* See: https://openiap.dev/docs/apis/android/acknowledge-purchase-android
*/
acknowledgePurchaseAndroid: Promise<boolean>;
/**
* Present the refund request sheet (iOS 15+). See also Features → Refund.
* See: https://openiap.dev/docs/apis/ios/begin-refund-request-ios
*/
beginRefundRequestIOS?: Promise<(string | null)>;
/**
* Check whether alternative billing is available for the user. Step 1 of the alternative billing flow.
*
* Returns true if available, false otherwise.
* Throws OpenIapError.NotPrepared if billing client not ready.
* See: https://openiap.dev/docs/apis/android/check-alternative-billing-availability-android
*/
checkAlternativeBillingAvailabilityAndroid: Promise<boolean>;
/**
* Clear pending transactions in the queue (sandbox helper).
* See: https://openiap.dev/docs/apis/ios/clear-transaction-ios
*/
clearTransactionIOS: Promise<boolean>;
/**
* Consume a consumable purchase so it can be re-bought.
* See: https://openiap.dev/docs/apis/android/consume-purchase-android
*/
consumePurchaseAndroid: Promise<boolean>;
/**
* Create a reporting token for an alternative billing flow. Step 3 of the alternative billing flow.
* Must be called AFTER successful payment in your payment system.
* Token must be reported to Google Play backend within 24 hours.
*
* Returns token string, or null if creation failed.
* Throws OpenIapError.NotPrepared if billing client not ready.
* See: https://openiap.dev/docs/apis/android/create-alternative-billing-token-android
*/
createAlternativeBillingTokenAndroid?: Promise<(string | null)>;
/**
* Create the reporting payload Google requires after a Developer-Provided Billing transaction (Play Billing 8.3.0+).
* Replaces the deprecated createExternalOfferReportingDetailsAsync API.
*
* Returns external transaction token needed for reporting external transactions.
* Throws OpenIapError.NotPrepared if billing client not ready.
* See: https://openiap.dev/docs/apis/android/create-billing-program-reporting-details-android
*/
createBillingProgramReportingDetailsAndroid: Promise<BillingProgramReportingDetailsAndroid>;
/**
* Open the platform's subscription management UI.
* See: https://openiap.dev/docs/apis/deep-link-to-subscriptions
*/
deepLinkToSubscriptions: Promise<void>;
/**
* Close the store connection and release resources.
* See: https://openiap.dev/docs/apis/end-connection
*/
endConnection: Promise<boolean>;
/**
* Complete a transaction after server-side verification. Required on Android within 3 days.
* See: https://openiap.dev/docs/apis/finish-transaction
*/
finishTransaction: Promise<void>;
/**
* Initialize the store connection. Call before any IAP API.
* See: https://openiap.dev/docs/apis/init-connection
*/
initConnection: Promise<boolean>;
/**
* Check whether a billing program (e.g., External Payments) is available for the current user.
* Replaces the deprecated isExternalOfferAvailableAsync API.
*
* Available in Google Play Billing Library 8.2.0+.
* Returns availability result with isAvailable flag.
* Throws OpenIapError.NotPrepared if billing client not ready.
* See: https://openiap.dev/docs/apis/android/is-billing-program-available-android
*/
isBillingProgramAvailableAndroid: Promise<BillingProgramAvailabilityResultAndroid>;
/**
* Launch an external content/offer link from inside the Billing Programs flow (Play Billing 8.2.0+).
* Replaces the deprecated showExternalOfferInformationDialog API.
*
* Shows Play Store dialog and optionally launches external URL.
* Throws OpenIapError.NotPrepared if billing client not ready.
* See: https://openiap.dev/docs/apis/android/launch-external-link-android
*/
launchExternalLinkAndroid: Promise<boolean>;
/**
* Show the App Store offer code redemption sheet.
* See: https://openiap.dev/docs/apis/ios/present-code-redemption-sheet-ios
*/
presentCodeRedemptionSheetIOS: Promise<boolean>;
/**
* Present an external purchase link, StoreKit External (iOS 16+).
* See: https://openiap.dev/docs/apis/ios/present-external-purchase-link-ios
*/
presentExternalPurchaseLinkIOS: Promise<ExternalPurchaseLinkResultIOS>;
/**
* Present the external purchase notice sheet (iOS 17.4+).
* Uses ExternalPurchase.presentNoticeSheet() which returns a token when the user continues.
* Reference: https://developer.apple.com/documentation/storekit/externalpurchase/presentnoticesheet()
* See: https://openiap.dev/docs/apis/ios/present-external-purchase-notice-sheet-ios
*/
presentExternalPurchaseNoticeSheetIOS: Promise<ExternalPurchaseNoticeResultIOS>;
/**
* Initiate a purchase or subscription flow; rely on events for final state.
* See: https://openiap.dev/docs/apis/request-purchase
*/
requestPurchase?: Promise<(Purchase | Purchase[] | null)>;
/**
* Buy the currently promoted product.
*
* @deprecated Use promotedProductListenerIOS to receive the productId,
* then call requestPurchase with that SKU instead. In StoreKit 2,
* promoted products can be purchased directly via the standard purchase flow.
* See: https://openiap.dev/docs/apis/ios/request-purchase-on-promoted-product-ios
* @deprecated Use promotedProductListenerIOS + requestPurchase instead
*/
requestPurchaseOnPromotedProductIOS: Promise<boolean>;
/**
* Restore non-consumable and active subscription purchases.
* See: https://openiap.dev/docs/apis/restore-purchases
*/
restorePurchases: Promise<void>;
/**
* Display Google's alternative billing information dialog. Step 2 of the alternative billing flow.
* Must be called BEFORE processing payment in your payment system.
*
* Returns true if user accepted, false if user canceled.
* Throws OpenIapError.NotPrepared if billing client not ready.
* See: https://openiap.dev/docs/apis/android/show-alternative-billing-dialog-android
*/
showAlternativeBillingDialogAndroid: Promise<boolean>;
/**
* Present the disclosure sheet required before linking out via ExternalPurchaseCustomLink (iOS 18.1+).
* Call this after a deliberate customer interaction before linking out to external purchases.
* Reference: https://developer.apple.com/documentation/storekit/externalpurchasecustomlink/shownotice(type:)
* See: https://openiap.dev/docs/apis/ios/show-external-purchase-custom-link-notice-ios
*/
showExternalPurchaseCustomLinkNoticeIOS: Promise<ExternalPurchaseCustomLinkNoticeResultIOS>;
/**
* Present the manage-subscriptions sheet and return changed purchases (iOS 15+).
* See: https://openiap.dev/docs/apis/ios/show-manage-subscriptions-ios
*/
showManageSubscriptionsIOS: Promise<PurchaseIOS[]>;
/**
* Force sync transactions with the App Store (iOS 15+).
* See: https://openiap.dev/docs/apis/ios/sync-ios
*/
syncIOS: Promise<boolean>;
/**
* Deprecated. Validate purchase receipts with the configured providers — use verifyPurchase instead.
* See: https://openiap.dev/docs/features/validation#verify-purchase
* @deprecated Use verifyPurchase
*/
validateReceipt: Promise<VerifyPurchaseResult>;
/**
* Verify a purchase against your own backend. Returns a platform-specific
* variant of VerifyPurchaseResult — VerifyPurchaseResultIOS exposes isValid
* + receipt/JWS metadata, VerifyPurchaseResultAndroid carries Play Store
* receipt fields (no isValid), and VerifyPurchaseResultHorizon uses success.
* Inspect the concrete variant before reading fields.
* See: https://openiap.dev/docs/features/validation#verify-purchase
*/
verifyPurchase: Promise<VerifyPurchaseResult>;
/**
* Verify via a managed provider without standing up your own server. The
* PurchaseVerificationProvider enum currently exposes only IAPKit; platform
* availability may differ by implementation.
* See: https://openiap.dev/docs/features/validation#verify-purchase-with-provider
*/
verifyPurchaseWithProvider: Promise<VerifyPurchaseWithProviderResult>;
}
export type MutationAcknowledgePurchaseAndroidArgs = string;
export type MutationBeginRefundRequestIosArgs = string;
export type MutationConsumePurchaseAndroidArgs = string;
export type MutationCreateBillingProgramReportingDetailsAndroidArgs = BillingProgramAndroid;
export type MutationDeepLinkToSubscriptionsArgs = (DeepLinkOptions | null) | undefined;
export interface MutationFinishTransactionArgs {
isConsumable?: (boolean | null);
purchase: PurchaseInput;
}
export type MutationInitConnectionArgs = (InitConnectionConfig | null) | undefined;
export type MutationIsBillingProgramAvailableAndroidArgs = BillingProgramAndroid;
export type MutationLaunchExternalLinkAndroidArgs = LaunchExternalLinkParamsAndroid;
export type MutationPresentExternalPurchaseLinkIosArgs = string;
export type MutationRequestPurchaseArgs =
| {
/** Per-platform purchase request props */
request: RequestPurchasePropsByPlatforms;
type: 'in-app';
/** Use alternative billing (Google Play alternative billing, Apple external purchase link) */
useAlternativeBilling?: boolean | null;
}
| {
/** Per-platform subscription request props */
request: RequestSubscriptionPropsByPlatforms;
type: 'subs';
/** Use alternative billing (Google Play alternative billing, Apple external purchase link) */
useAlternativeBilling?: boolean | null;
};
export type MutationShowExternalPurchaseCustomLinkNoticeIosArgs = ExternalPurchaseCustomLinkNoticeTypeIOS;
export type MutationValidateReceiptArgs = VerifyPurchaseProps;
export type MutationVerifyPurchaseArgs = VerifyPurchaseProps;
export type MutationVerifyPurchaseWithProviderArgs = VerifyPurchaseWithProviderProps;
/**
* Payment mode for subscription offers.
* Determines how the user pays during the offer period.
*/
export type PaymentMode = 'free-trial' | 'pay-as-you-go' | 'pay-up-front' | 'unknown';
export type PaymentModeIOS = 'empty' | 'free-trial' | 'pay-as-you-go' | 'pay-up-front';
/**
* Pending purchase update for subscription upgrades/downgrades (Android)
* When a user initiates a subscription change (upgrade/downgrade), the new purchase
* may be pending until the current billing period ends. This type contains the
* details of the pending change.
* Available in Google Play Billing Library 5.0+
*/
export interface PendingPurchaseUpdateAndroid {
/**
* Product IDs for the pending purchase update.
* These are the new products the user is switching to.
*/
products: string[];
/**
* Purchase token for the pending transaction.
* Use this token to track or manage the pending purchase update.
*/
purchaseToken: string;
}
/**
* Pre-order details for one-time purchase products (Android)
* Available in Google Play Billing Library 8.1.0+
*/
export interface PreorderDetailsAndroid {
/**
* Pre-order presale end time in milliseconds since epoch.
* This is when the presale period ends and the product will be released.
*/
preorderPresaleEndTimeMillis: string;
/**
* Pre-order release time in milliseconds since epoch.
* This is when the product will be available to users who pre-ordered.
*/
preorderReleaseTimeMillis: string;
}
export interface PricingPhaseAndroid {
billingCycleCount: number;
billingPeriod: string;
formattedPrice: string;
priceAmountMicros: string;
priceCurrencyCode: string;
recurrenceMode: number;
}
export interface PricingPhasesAndroid {
pricingPhaseList: PricingPhaseAndroid[];
}
export type Product = ProductAndroid | ProductIOS;
export interface ProductAndroid extends ProductCommon {
currency: string;
debugDescription?: (string | null);
description: string;
/**
* Standardized discount offers for one-time products.
* Cross-platform type with Android-specific fields using suffix.
* @see https://openiap.dev/docs/types#discount-offer
*/
discountOffers?: (DiscountOffer[] | null);
displayName?: (string | null);
displayPrice: string;
id: string;
nameAndroid: string;
/**
* One-time purchase offer details including discounts (Android)
* Returns all eligible offers. Available in Google Play Billing Library 7.0+
* @deprecated Use discountOffers instead for cross-platform compatibility.
* @deprecated Use discountOffers instead
*/
oneTimePurchaseOfferDetailsAndroid?: (ProductAndroidOneTimePurchaseOfferDetail[] | null);
platform: 'android';
price?: (number | null);
/**
* Product-level status code indicating fetch result (Android 8.0+)
* OK = product fetched successfully
* NOT_FOUND = SKU doesn't exist
* NO_OFFERS_AVAILABLE = user not eligible for any offers
* Available in Google Play Billing Library 8.0.0+
*/
productStatusAndroid?: (ProductStatusAndroid | null);
/**
* @deprecated Use subscriptionOffers instead for cross-platform compatibility.
* @deprecated Use subscriptionOffers instead
*/
subscriptionOfferDetailsAndroid?: (ProductSubscriptionAndroidOfferDetails[] | null);
/**
* Standardized subscription offers.
* Cross-platform type with Android-specific fields using suffix.
* @see https://openiap.dev/docs/types#subscription-offer
*/
subscriptionOffers?: (SubscriptionOffer[] | null);
title: string;
type: 'in-app';
}
/**
* One-time purchase offer details (Android).
* Available in Google Play Billing Library 7.0+
* @deprecated Use the standardized DiscountOffer type instead for cross-platform compatibility.
* @see https://openiap.dev/docs/types#discount-offer
*/
export interface ProductAndroidOneTimePurchaseOfferDetail {
/**
* Discount display information
* Only available for discounted offers
*/
discountDisplayInfo?: (DiscountDisplayInfoAndroid | null);
formattedPrice: string;
/**
* Full (non-discounted) price in micro-units
* Only available for discounted offers
*/
fullPriceMicros?: (string | null);
/** Limited quantity information */
limitedQuantityInfo?: (LimitedQuantityInfoAndroid | null);
/** Offer ID */
offerId?: (string | null);
/** List of offer tags */
offerTags: string[];
/** Offer token for use in BillingFlowParams when purchasing */
offerToken: string;
/**
* Pre-order details for products available for pre-order
* Available in Google Play Billing Library 8.1.0+
*/
preorderDetailsAndroid?: (PreorderDetailsAndroid | null);
priceAmountMicros: string;
priceCurrencyCode: string;
/**
* Purchase option ID for this offer (Android)
* Used to identify which purchase option the user selected.
* Available in Google Play Billing Library 7.0+
*/
purchaseOptionId?: (string | null);
/** Rental details for rental offers */
rentalDetailsAndroid?: (RentalDetailsAndroid | null);
/** Valid time window for the offer */
validTimeWindow?: (ValidTimeWindowAndroid | null);
}
export interface ProductCommon {
currency: string;
debugDescription?: (string | null);
description: string;
displayName?: (string | null);
displayPrice: string;
id: string;
platform: 'android' | 'ios';
price?: (number | null);
title: string;
type: 'in-app' | 'subs';
}
export interface ProductIOS extends ProductCommon {
currency: string;
debugDescription?: (string | null);
description: string;
displayName?: (string | null);
displayNameIOS: string;
displayPrice: string;
id: string;
isFamilyShareableIOS: boolean;
jsonRepresentationIOS: string;
platform: 'ios';
price?: (number | null);
/**
* @deprecated Use subscriptionOffers instead for cross-platform compatibility.
* @deprecated Use subscriptionOffers instead
*/
subscriptionInfoIOS?: (SubscriptionInfoIOS | null);
/**
* Standardized subscription offers.
* Cross-platform type with iOS-specific fields using suffix.
* Note: iOS does not support one-time product discounts.
* @see https://openiap.dev/docs/types#subscription-offer
*/
subscriptionOffers?: (SubscriptionOffer[] | null);
title: string;