react-native-iap 15.2.0 → 15.2.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.
Files changed (95) hide show
  1. package/android/src/main/java/com/margelo/nitro/iap/HybridRnIap.kt +117 -114
  2. package/android/src/main/java/com/margelo/nitro/iap/ProductQueryHelpers.kt +42 -0
  3. package/android/src/test/java/com/margelo/nitro/iap/ProductQueryHelpersTest.kt +140 -0
  4. package/ios/HybridRnIap.swift +33 -0
  5. package/lib/module/hooks/useIAP.js.map +1 -1
  6. package/lib/module/hooks/useWebhookEvents.js +113 -0
  7. package/lib/module/hooks/useWebhookEvents.js.map +1 -0
  8. package/lib/module/index.js +331 -131
  9. package/lib/module/index.js.map +1 -1
  10. package/lib/module/kit-api.js +161 -0
  11. package/lib/module/kit-api.js.map +1 -0
  12. package/lib/module/types.js +16 -0
  13. package/lib/module/types.js.map +1 -1
  14. package/lib/module/utils/error.js.map +1 -1
  15. package/lib/module/utils/errorMapping.js +6 -0
  16. package/lib/module/utils/errorMapping.js.map +1 -1
  17. package/lib/module/webhook-client.js +164 -0
  18. package/lib/module/webhook-client.js.map +1 -0
  19. package/lib/typescript/plugin/src/withIAP.d.ts +1 -1
  20. package/lib/typescript/src/hooks/useIAP.d.ts +162 -2
  21. package/lib/typescript/src/hooks/useIAP.d.ts.map +1 -1
  22. package/lib/typescript/src/hooks/useWebhookEvents.d.ts +55 -0
  23. package/lib/typescript/src/hooks/useWebhookEvents.d.ts.map +1 -0
  24. package/lib/typescript/src/index.d.ts +282 -129
  25. package/lib/typescript/src/index.d.ts.map +1 -1
  26. package/lib/typescript/src/kit-api.d.ts +54 -0
  27. package/lib/typescript/src/kit-api.d.ts.map +1 -0
  28. package/lib/typescript/src/specs/RnIap.nitro.d.ts +7 -0
  29. package/lib/typescript/src/specs/RnIap.nitro.d.ts.map +1 -1
  30. package/lib/typescript/src/types.d.ts +304 -74
  31. package/lib/typescript/src/types.d.ts.map +1 -1
  32. package/lib/typescript/src/utils/error.d.ts +3 -0
  33. package/lib/typescript/src/utils/error.d.ts.map +1 -1
  34. package/lib/typescript/src/utils/errorMapping.d.ts +6 -0
  35. package/lib/typescript/src/utils/errorMapping.d.ts.map +1 -1
  36. package/lib/typescript/src/webhook-client.d.ts +82 -0
  37. package/lib/typescript/src/webhook-client.d.ts.map +1 -0
  38. package/nitrogen/generated/android/NitroIap+autolinking.cmake +3 -0
  39. package/nitrogen/generated/android/c++/JAdvancedCommerceInfoIOS.hpp +118 -0
  40. package/nitrogen/generated/android/c++/JAdvancedCommerceItemDetailsIOS.hpp +62 -0
  41. package/nitrogen/generated/android/c++/JAdvancedCommerceItemIOS.hpp +78 -0
  42. package/nitrogen/generated/android/c++/JAdvancedCommerceRefundIOS.hpp +62 -0
  43. package/nitrogen/generated/android/c++/JHybridRnIapSpec.cpp +44 -0
  44. package/nitrogen/generated/android/c++/JHybridRnIapSpec.hpp +1 -0
  45. package/nitrogen/generated/android/c++/JPurchase.hpp +11 -0
  46. package/nitrogen/generated/android/c++/JPurchaseIOS.hpp +16 -1
  47. package/nitrogen/generated/android/c++/JRequestPurchaseResult.hpp +11 -0
  48. package/nitrogen/generated/android/c++/JVariant_NullType_AdvancedCommerceInfoIOS.cpp +26 -0
  49. package/nitrogen/generated/android/c++/JVariant_NullType_AdvancedCommerceInfoIOS.hpp +84 -0
  50. package/nitrogen/generated/android/c++/JVariant_NullType_AdvancedCommerceItemDetailsIOS.cpp +26 -0
  51. package/nitrogen/generated/android/c++/JVariant_NullType_AdvancedCommerceItemDetailsIOS.hpp +74 -0
  52. package/nitrogen/generated/android/c++/JVariant_NullType_Array_AdvancedCommerceRefundIOS_.cpp +35 -0
  53. package/nitrogen/generated/android/c++/JVariant_NullType_Array_AdvancedCommerceRefundIOS_.hpp +84 -0
  54. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/AdvancedCommerceInfoIOS.kt +59 -0
  55. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/AdvancedCommerceItemDetailsIOS.kt +38 -0
  56. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/AdvancedCommerceItemIOS.kt +44 -0
  57. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/AdvancedCommerceRefundIOS.kt +38 -0
  58. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/HybridRnIapSpec.kt +4 -0
  59. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/PurchaseIOS.kt +5 -2
  60. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/Variant_NullType_AdvancedCommerceInfoIOS.kt +53 -0
  61. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/Variant_NullType_AdvancedCommerceItemDetailsIOS.kt +53 -0
  62. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/Variant_NullType_Array_AdvancedCommerceRefundIOS_.kt +53 -0
  63. package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Bridge.hpp +166 -0
  64. package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Umbrella.hpp +12 -0
  65. package/nitrogen/generated/ios/c++/HybridRnIapSpecSwift.hpp +20 -0
  66. package/nitrogen/generated/ios/swift/AdvancedCommerceInfoIOS.swift +294 -0
  67. package/nitrogen/generated/ios/swift/AdvancedCommerceItemDetailsIOS.swift +61 -0
  68. package/nitrogen/generated/ios/swift/AdvancedCommerceItemIOS.swift +141 -0
  69. package/nitrogen/generated/ios/swift/AdvancedCommerceRefundIOS.swift +61 -0
  70. package/nitrogen/generated/ios/swift/HybridRnIapSpec.swift +1 -0
  71. package/nitrogen/generated/ios/swift/HybridRnIapSpec_cxx.swift +25 -0
  72. package/nitrogen/generated/ios/swift/PurchaseIOS.swift +39 -2
  73. package/nitrogen/generated/ios/swift/Variant_NullType_AdvancedCommerceInfoIOS.swift +18 -0
  74. package/nitrogen/generated/ios/swift/Variant_NullType_AdvancedCommerceItemDetailsIOS.swift +18 -0
  75. package/nitrogen/generated/ios/swift/Variant_NullType__AdvancedCommerceRefundIOS_.swift +18 -0
  76. package/nitrogen/generated/shared/c++/AdvancedCommerceInfoIOS.hpp +117 -0
  77. package/nitrogen/generated/shared/c++/AdvancedCommerceItemDetailsIOS.hpp +86 -0
  78. package/nitrogen/generated/shared/c++/AdvancedCommerceItemIOS.hpp +99 -0
  79. package/nitrogen/generated/shared/c++/AdvancedCommerceRefundIOS.hpp +86 -0
  80. package/nitrogen/generated/shared/c++/HybridRnIapSpec.cpp +1 -0
  81. package/nitrogen/generated/shared/c++/HybridRnIapSpec.hpp +1 -0
  82. package/nitrogen/generated/shared/c++/PurchaseIOS.hpp +9 -2
  83. package/openiap-versions.json +3 -3
  84. package/package.json +1 -1
  85. package/plugin/build/withIAP.d.ts +1 -1
  86. package/plugin/src/withIAP.ts +1 -1
  87. package/src/hooks/useIAP.ts +162 -2
  88. package/src/hooks/useWebhookEvents.ts +180 -0
  89. package/src/index.ts +348 -130
  90. package/src/kit-api.ts +225 -0
  91. package/src/specs/RnIap.nitro.ts +8 -0
  92. package/src/types.ts +314 -74
  93. package/src/utils/error.ts +3 -0
  94. package/src/utils/errorMapping.ts +12 -0
  95. package/src/webhook-client.ts +312 -0
package/src/types.ts CHANGED
@@ -36,6 +36,56 @@ export interface ActiveSubscription {
36
36
  willExpireSoon?: (boolean | null);
37
37
  }
38
38
 
39
+ /**
40
+ * Advanced Commerce metadata from a transaction (iOS 18.4+).
41
+ * Contains item details, tax information, and refund data for purchases
42
+ * made through the Advanced Commerce API using generic SKUs.
43
+ * Only present for transactions that use the Advanced Commerce API.
44
+ */
45
+ export interface AdvancedCommerceInfoIOS {
46
+ /** Optional description */
47
+ description?: (string | null);
48
+ /** Optional display name */
49
+ displayName?: (string | null);
50
+ /** Estimated tax amount (decimal string) */
51
+ estimatedTax?: (string | null);
52
+ /** The items purchased as part of this transaction */
53
+ items: AdvancedCommerceItemIOS[];
54
+ /** Request reference identifier for tracking */
55
+ requestReferenceId?: (string | null);
56
+ /** Tax code for the transaction */
57
+ taxCode?: (string | null);
58
+ /** Price excluding tax (decimal string) */
59
+ taxExclusivePrice?: (string | null);
60
+ /** Tax rate applied (decimal string) */
61
+ taxRate?: (string | null);
62
+ }
63
+
64
+ /** Details of an Advanced Commerce item (iOS 18.4+). */
65
+ export interface AdvancedCommerceItemDetailsIOS {
66
+ /** JSON representation of the item details */
67
+ jsonRepresentation?: (string | null);
68
+ }
69
+
70
+ /**
71
+ * An item purchased through the Advanced Commerce API (iOS 18.4+).
72
+ * Represents a developer-defined product within a generic SKU transaction.
73
+ */
74
+ export interface AdvancedCommerceItemIOS {
75
+ /** The item's detail information */
76
+ details?: (AdvancedCommerceItemDetailsIOS | null);
77
+ /** Refunds issued for this item, if any */
78
+ refunds?: (AdvancedCommerceRefundIOS[] | null);
79
+ /** Date access to this item was revoked (milliseconds since epoch) */
80
+ revocationDate?: (number | null);
81
+ }
82
+
83
+ /** Refund information for an Advanced Commerce item (iOS 18.4+). */
84
+ export interface AdvancedCommerceRefundIOS {
85
+ /** JSON representation of the refund details */
86
+ jsonRepresentation?: (string | null);
87
+ }
88
+
39
89
  /**
40
90
  * Alternative billing mode for Android
41
91
  * Controls which billing system is used
@@ -535,118 +585,176 @@ export interface LimitedQuantityInfoAndroid {
535
585
  }
536
586
 
537
587
  export interface Mutation {
538
- /** Acknowledge a non-consumable purchase or subscription */
588
+ /**
589
+ * Acknowledge a non-consumable purchase. Required within 3 days or Google auto-refunds.
590
+ * See: https://www.openiap.dev/docs/apis/android/acknowledge-purchase-android
591
+ */
539
592
  acknowledgePurchaseAndroid: Promise<boolean>;
540
- /** Initiate a refund request for a product (iOS 15+) */
593
+ /**
594
+ * Present the refund request sheet (iOS 15+). See also Features → Refund.
595
+ * See: https://www.openiap.dev/docs/apis/ios/begin-refund-request-ios
596
+ */
541
597
  beginRefundRequestIOS?: Promise<(string | null)>;
542
598
  /**
543
- * Check if alternative billing is available for this user/device
544
- * Step 1 of alternative billing flow
599
+ * Check whether alternative billing is available for the user. Step 1 of the alternative billing flow.
545
600
  *
546
- * Returns true if available, false otherwise
547
- * Throws OpenIapError.NotPrepared if billing client not ready
601
+ * Returns true if available, false otherwise.
602
+ * Throws OpenIapError.NotPrepared if billing client not ready.
603
+ * See: https://www.openiap.dev/docs/apis/android/check-alternative-billing-availability-android
548
604
  */
549
605
  checkAlternativeBillingAvailabilityAndroid: Promise<boolean>;
550
- /** Clear pending transactions from the StoreKit payment queue */
606
+ /**
607
+ * Clear pending transactions in the queue (sandbox helper).
608
+ * See: https://www.openiap.dev/docs/apis/ios/clear-transaction-ios
609
+ */
551
610
  clearTransactionIOS: Promise<boolean>;
552
- /** Consume a purchase token so it can be repurchased */
611
+ /**
612
+ * Consume a consumable purchase so it can be re-bought.
613
+ * See: https://www.openiap.dev/docs/apis/android/consume-purchase-android
614
+ */
553
615
  consumePurchaseAndroid: Promise<boolean>;
554
616
  /**
555
- * Create external transaction token for Google Play reporting
556
- * Step 3 of alternative billing flow
557
- * Must be called AFTER successful payment in your payment system
558
- * Token must be reported to Google Play backend within 24 hours
617
+ * Create a reporting token for an alternative billing flow. Step 3 of the alternative billing flow.
618
+ * Must be called AFTER successful payment in your payment system.
619
+ * Token must be reported to Google Play backend within 24 hours.
559
620
  *
560
- * Returns token string, or null if creation failed
561
- * Throws OpenIapError.NotPrepared if billing client not ready
621
+ * Returns token string, or null if creation failed.
622
+ * Throws OpenIapError.NotPrepared if billing client not ready.
623
+ * See: https://www.openiap.dev/docs/apis/android/create-alternative-billing-token-android
562
624
  */
563
625
  createAlternativeBillingTokenAndroid?: Promise<(string | null)>;
564
626
  /**
565
- * Create reporting details for a billing program
566
- * Replaces the deprecated createExternalOfferReportingDetailsAsync API
627
+ * Create the reporting payload Google requires after a Developer-Provided Billing transaction (Play Billing 8.3.0+).
628
+ * Replaces the deprecated createExternalOfferReportingDetailsAsync API.
567
629
  *
568
- * Available in Google Play Billing Library 8.2.0+
569
- * Returns external transaction token needed for reporting external transactions
570
- * Throws OpenIapError.NotPrepared if billing client not ready
630
+ * Returns external transaction token needed for reporting external transactions.
631
+ * Throws OpenIapError.NotPrepared if billing client not ready.
632
+ * See: https://www.openiap.dev/docs/apis/android/create-billing-program-reporting-details-android
571
633
  */
572
634
  createBillingProgramReportingDetailsAndroid: Promise<BillingProgramReportingDetailsAndroid>;
573
- /** Open the native subscription management surface */
635
+ /**
636
+ * Open the platform's subscription management UI.
637
+ * See: https://www.openiap.dev/docs/apis/deep-link-to-subscriptions
638
+ */
574
639
  deepLinkToSubscriptions: Promise<void>;
575
- /** Close the platform billing connection */
640
+ /**
641
+ * Close the store connection and release resources.
642
+ * See: https://www.openiap.dev/docs/apis/end-connection
643
+ */
576
644
  endConnection: Promise<boolean>;
577
- /** Finish a transaction after validating receipts */
645
+ /**
646
+ * Complete a transaction after server-side verification. Required on Android within 3 days.
647
+ * See: https://www.openiap.dev/docs/apis/finish-transaction
648
+ */
578
649
  finishTransaction: Promise<void>;
579
- /** Establish the platform billing connection */
650
+ /**
651
+ * Initialize the store connection. Call before any IAP API.
652
+ * See: https://www.openiap.dev/docs/apis/init-connection
653
+ */
580
654
  initConnection: Promise<boolean>;
581
655
  /**
582
- * Check if a billing program is available for the current user
583
- * Replaces the deprecated isExternalOfferAvailableAsync API
656
+ * Check whether a billing program (e.g., External Payments) is available for the current user.
657
+ * Replaces the deprecated isExternalOfferAvailableAsync API.
584
658
  *
585
- * Available in Google Play Billing Library 8.2.0+
586
- * Returns availability result with isAvailable flag
587
- * Throws OpenIapError.NotPrepared if billing client not ready
659
+ * Available in Google Play Billing Library 8.2.0+.
660
+ * Returns availability result with isAvailable flag.
661
+ * Throws OpenIapError.NotPrepared if billing client not ready.
662
+ * See: https://www.openiap.dev/docs/apis/android/is-billing-program-available-android
588
663
  */
589
664
  isBillingProgramAvailableAndroid: Promise<BillingProgramAvailabilityResultAndroid>;
590
665
  /**
591
- * Launch external link flow for external billing programs
592
- * Replaces the deprecated showExternalOfferInformationDialog API
666
+ * Launch an external content/offer link from inside the Billing Programs flow (Play Billing 8.2.0+).
667
+ * Replaces the deprecated showExternalOfferInformationDialog API.
593
668
  *
594
- * Available in Google Play Billing Library 8.2.0+
595
- * Shows Play Store dialog and optionally launches external URL
596
- * Throws OpenIapError.NotPrepared if billing client not ready
669
+ * Shows Play Store dialog and optionally launches external URL.
670
+ * Throws OpenIapError.NotPrepared if billing client not ready.
671
+ * See: https://www.openiap.dev/docs/apis/android/launch-external-link-android
597
672
  */
598
673
  launchExternalLinkAndroid: Promise<boolean>;
599
- /** Present the App Store code redemption sheet */
674
+ /**
675
+ * Show the App Store offer code redemption sheet.
676
+ * See: https://www.openiap.dev/docs/apis/ios/present-code-redemption-sheet-ios
677
+ */
600
678
  presentCodeRedemptionSheetIOS: Promise<boolean>;
601
- /** Present external purchase custom link with StoreKit UI */
679
+ /**
680
+ * Present an external purchase link, StoreKit External (iOS 16+).
681
+ * See: https://www.openiap.dev/docs/apis/ios/present-external-purchase-link-ios
682
+ */
602
683
  presentExternalPurchaseLinkIOS: Promise<ExternalPurchaseLinkResultIOS>;
603
684
  /**
604
- * Present external purchase notice sheet (iOS 17.4+).
605
- * Uses ExternalPurchase.presentNoticeSheet() which returns a token when user continues.
685
+ * Present the external purchase notice sheet (iOS 17.4+).
686
+ * Uses ExternalPurchase.presentNoticeSheet() which returns a token when the user continues.
606
687
  * Reference: https://developer.apple.com/documentation/storekit/externalpurchase/presentnoticesheet()
688
+ * See: https://www.openiap.dev/docs/apis/ios/present-external-purchase-notice-sheet-ios
607
689
  */
608
690
  presentExternalPurchaseNoticeSheetIOS: Promise<ExternalPurchaseNoticeResultIOS>;
609
- /** Initiate a purchase flow; rely on events for final state */
691
+ /**
692
+ * Initiate a purchase or subscription flow; rely on events for final state.
693
+ * See: https://www.openiap.dev/docs/apis/request-purchase
694
+ */
610
695
  requestPurchase?: Promise<(Purchase | Purchase[] | null)>;
611
696
  /**
612
- * Purchase the promoted product surfaced by the App Store.
697
+ * Buy the currently promoted product.
613
698
  *
614
699
  * @deprecated Use promotedProductListenerIOS to receive the productId,
615
700
  * then call requestPurchase with that SKU instead. In StoreKit 2,
616
701
  * promoted products can be purchased directly via the standard purchase flow.
702
+ * See: https://www.openiap.dev/docs/apis/ios/request-purchase-on-promoted-product-ios
617
703
  * @deprecated Use promotedProductListenerIOS + requestPurchase instead
618
704
  */
619
705
  requestPurchaseOnPromotedProductIOS: Promise<boolean>;
620
- /** Restore completed purchases across platforms */
706
+ /**
707
+ * Restore non-consumable and active subscription purchases.
708
+ * See: https://www.openiap.dev/docs/apis/restore-purchases
709
+ */
621
710
  restorePurchases: Promise<void>;
622
711
  /**
623
- * Show alternative billing information dialog to user
624
- * Step 2 of alternative billing flow
625
- * Must be called BEFORE processing payment in your payment system
712
+ * Display Google's alternative billing information dialog. Step 2 of the alternative billing flow.
713
+ * Must be called BEFORE processing payment in your payment system.
626
714
  *
627
- * Returns true if user accepted, false if user canceled
628
- * Throws OpenIapError.NotPrepared if billing client not ready
715
+ * Returns true if user accepted, false if user canceled.
716
+ * Throws OpenIapError.NotPrepared if billing client not ready.
717
+ * See: https://www.openiap.dev/docs/apis/android/show-alternative-billing-dialog-android
629
718
  */
630
719
  showAlternativeBillingDialogAndroid: Promise<boolean>;
631
720
  /**
632
- * Show ExternalPurchaseCustomLink notice sheet (iOS 18.1+).
633
- * Displays the system disclosure notice sheet for custom external purchase links.
721
+ * Present the disclosure sheet required before linking out via ExternalPurchaseCustomLink (iOS 18.1+).
634
722
  * Call this after a deliberate customer interaction before linking out to external purchases.
635
723
  * Reference: https://developer.apple.com/documentation/storekit/externalpurchasecustomlink/shownotice(type:)
724
+ * See: https://www.openiap.dev/docs/apis/ios/show-external-purchase-custom-link-notice-ios
636
725
  */
637
726
  showExternalPurchaseCustomLinkNoticeIOS: Promise<ExternalPurchaseCustomLinkNoticeResultIOS>;
638
- /** Open subscription management UI and return changed purchases (iOS 15+) */
727
+ /**
728
+ * Present the manage-subscriptions sheet and return changed purchases (iOS 15+).
729
+ * See: https://www.openiap.dev/docs/apis/ios/show-manage-subscriptions-ios
730
+ */
639
731
  showManageSubscriptionsIOS: Promise<PurchaseIOS[]>;
640
- /** Force a StoreKit sync for transactions (iOS 15+) */
732
+ /**
733
+ * Force sync transactions with the App Store (iOS 15+).
734
+ * See: https://www.openiap.dev/docs/apis/ios/sync-ios
735
+ */
641
736
  syncIOS: Promise<boolean>;
642
737
  /**
643
- * Validate purchase receipts with the configured providers
738
+ * Deprecated. Validate purchase receipts with the configured providers — use verifyPurchase instead.
739
+ * See: https://www.openiap.dev/docs/features/validation#verify-purchase
644
740
  * @deprecated Use verifyPurchase
645
741
  */
646
742
  validateReceipt: Promise<VerifyPurchaseResult>;
647
- /** Verify purchases with the configured providers */
743
+ /**
744
+ * Verify a purchase against your own backend. Returns a platform-specific
745
+ * variant of VerifyPurchaseResult — VerifyPurchaseResultIOS exposes isValid
746
+ * + receipt/JWS metadata, VerifyPurchaseResultAndroid carries Play Store
747
+ * receipt fields (no isValid), and VerifyPurchaseResultHorizon uses success.
748
+ * Inspect the concrete variant before reading fields.
749
+ * See: https://www.openiap.dev/docs/features/validation#verify-purchase
750
+ */
648
751
  verifyPurchase: Promise<VerifyPurchaseResult>;
649
- /** Verify purchases with a specific provider (e.g., IAPKit) */
752
+ /**
753
+ * Verify via a managed provider without standing up your own server. The
754
+ * PurchaseVerificationProvider enum currently exposes only IAPKit; platform
755
+ * availability may differ by implementation.
756
+ * See: https://www.openiap.dev/docs/features/validation#verify-purchase-with-provider
757
+ */
650
758
  verifyPurchaseWithProvider: Promise<VerifyPurchaseWithProviderResult>;
651
759
  }
652
760
 
@@ -1107,11 +1215,21 @@ export interface PurchaseCommon {
1107
1215
  export interface PurchaseError {
1108
1216
  code: ErrorCode;
1109
1217
  debugMessage?: (string | null);
1218
+ isEmptyProductList?: (boolean | null);
1110
1219
  message: string;
1111
1220
  productId?: (string | null);
1221
+ productIds?: (string[] | null);
1222
+ productType?: (string | null);
1223
+ responseCode?: (number | null);
1112
1224
  }
1113
1225
 
1114
1226
  export interface PurchaseIOS extends PurchaseCommon {
1227
+ /**
1228
+ * Advanced Commerce API metadata (iOS 18.4+).
1229
+ * Present only for transactions that use the Advanced Commerce API.
1230
+ * Contains item details, tax information, and refund data for generic SKU purchases.
1231
+ */
1232
+ advancedCommerceInfoIOS?: (AdvancedCommerceInfoIOS | null);
1115
1233
  appAccountToken?: (string | null);
1116
1234
  appBundleIdIOS?: (string | null);
1117
1235
  countryCodeIOS?: (string | null);
@@ -1178,59 +1296,117 @@ export type PurchaseVerificationProvider = 'iapkit';
1178
1296
 
1179
1297
  export interface Query {
1180
1298
  /**
1181
- * Check if external purchase notice sheet can be presented (iOS 17.4+)
1182
- * Uses ExternalPurchase.canPresent
1299
+ * Check eligibility for the external purchase notice sheet (iOS 17.4+).
1300
+ * Uses ExternalPurchase.canPresent.
1301
+ * See: https://www.openiap.dev/docs/apis/ios/can-present-external-purchase-notice-ios
1183
1302
  */
1184
1303
  canPresentExternalPurchaseNoticeIOS: Promise<boolean>;
1185
- /** Get current StoreKit 2 entitlements (iOS 15+) */
1304
+ /**
1305
+ * Get the user's current entitlement for a product, using StoreKit 2 (iOS 15+).
1306
+ * See: https://www.openiap.dev/docs/apis/ios/current-entitlement-ios
1307
+ */
1186
1308
  currentEntitlementIOS?: Promise<(PurchaseIOS | null)>;
1187
- /** Retrieve products or subscriptions from the store */
1309
+ /**
1310
+ * Fetch products or subscriptions from the store.
1311
+ * See: https://www.openiap.dev/docs/apis/fetch-products
1312
+ */
1188
1313
  fetchProducts: Promise<(ProductOrSubscription[] | Product[] | ProductSubscription[] | null)>;
1189
- /** Get active subscriptions (filters by subscriptionIds when provided) */
1314
+ /**
1315
+ * Get details of all currently active subscriptions (filters by subscriptionIds when provided).
1316
+ * See: https://www.openiap.dev/docs/apis/get-active-subscriptions
1317
+ */
1190
1318
  getActiveSubscriptions: Promise<ActiveSubscription[]>;
1191
- /** Fetch the current app transaction (iOS 16+) */
1319
+ /**
1320
+ * List every StoreKit transaction (finished + unfinished) for the current user.
1321
+ * Requires the SK2ConsumableTransactionHistory Info.plist key in the host app
1322
+ * for finished consumables to be included (iOS 18+).
1323
+ * Unlike getAvailablePurchases, always returns the iOS-specific PurchaseIOS shape.
1324
+ * See: https://www.openiap.dev/docs/apis/ios/get-all-transactions-ios
1325
+ */
1326
+ getAllTransactionsIOS: Promise<PurchaseIOS[]>;
1327
+ /**
1328
+ * Fetch the app transaction (iOS 16+).
1329
+ * See: https://www.openiap.dev/docs/apis/ios/get-app-transaction-ios
1330
+ */
1192
1331
  getAppTransactionIOS?: Promise<(AppTransaction | null)>;
1193
- /** Get all available purchases for the current user */
1332
+ /**
1333
+ * List active purchases for the current user.
1334
+ * See: https://www.openiap.dev/docs/apis/get-available-purchases
1335
+ */
1194
1336
  getAvailablePurchases: Promise<Purchase[]>;
1195
1337
  /**
1196
- * Get external purchase token for reporting to Apple (iOS 18.1+).
1197
- * Use this token with Apple's External Purchase Server API to report transactions.
1338
+ * Fetch a token for Apple's External Purchase Server reporting API (iOS 18.1+).
1339
+ * Use this token to report transactions made through ExternalPurchaseCustomLink.
1198
1340
  * Reference: https://developer.apple.com/documentation/storekit/externalpurchasecustomlink/token(for:)
1341
+ * See: https://www.openiap.dev/docs/apis/ios/get-external-purchase-custom-link-token-ios
1199
1342
  */
1200
1343
  getExternalPurchaseCustomLinkTokenIOS: Promise<ExternalPurchaseCustomLinkTokenResultIOS>;
1201
- /** Retrieve all pending transactions in the StoreKit queue */
1344
+ /**
1345
+ * List unfinished StoreKit transactions in the queue.
1346
+ * See: https://www.openiap.dev/docs/apis/ios/get-pending-transactions-ios
1347
+ */
1202
1348
  getPendingTransactionsIOS: Promise<PurchaseIOS[]>;
1203
- /** Get the currently promoted product (iOS 11+) */
1349
+ /**
1350
+ * Read the App Store-promoted product, if any (iOS 11+).
1351
+ * See: https://www.openiap.dev/docs/apis/ios/get-promoted-product-ios
1352
+ */
1204
1353
  getPromotedProductIOS?: Promise<(ProductIOS | null)>;
1205
- /** Get base64-encoded receipt data for validation */
1354
+ /**
1355
+ * Get base64-encoded receipt data (legacy validation).
1356
+ * See: https://www.openiap.dev/docs/apis/ios/get-receipt-data-ios
1357
+ */
1206
1358
  getReceiptDataIOS?: Promise<(string | null)>;
1207
- /** Get the current storefront country code */
1359
+ /**
1360
+ * Return the user's storefront country code.
1361
+ * See: https://www.openiap.dev/docs/apis/get-storefront
1362
+ */
1208
1363
  getStorefront: Promise<string>;
1209
1364
  /**
1210
- * Get the current App Store storefront country code
1365
+ * Deprecated. Get the current App Store storefront country code — use cross-platform getStorefront instead.
1366
+ * See: https://www.openiap.dev/docs/apis/ios/get-storefront-ios
1211
1367
  * @deprecated Use getStorefront
1212
1368
  */
1213
1369
  getStorefrontIOS: Promise<string>;
1214
- /** Get the transaction JWS (StoreKit 2) */
1370
+ /**
1371
+ * Return the JWS string for a transaction (StoreKit 2).
1372
+ * See: https://www.openiap.dev/docs/apis/ios/get-transaction-jws-ios
1373
+ */
1215
1374
  getTransactionJwsIOS?: Promise<(string | null)>;
1216
- /** Check whether the user has active subscriptions */
1375
+ /**
1376
+ * Check whether the user has any active subscription.
1377
+ * See: https://www.openiap.dev/docs/apis/has-active-subscriptions
1378
+ */
1217
1379
  hasActiveSubscriptions: Promise<boolean>;
1218
1380
  /**
1219
- * Check if app is eligible for ExternalPurchaseCustomLink API (iOS 18.1+).
1381
+ * Check eligibility for the custom-link variant of external purchase (iOS 18.1+).
1220
1382
  * Returns true if the app can use custom external purchase links.
1221
1383
  * Reference: https://developer.apple.com/documentation/storekit/externalpurchasecustomlink/iseligible
1384
+ * See: https://www.openiap.dev/docs/apis/ios/is-eligible-for-external-purchase-custom-link-ios
1222
1385
  */
1223
1386
  isEligibleForExternalPurchaseCustomLinkIOS: Promise<boolean>;
1224
- /** Check introductory offer eligibility for a subscription group */
1387
+ /**
1388
+ * Check intro-offer eligibility for a subscription group.
1389
+ * See: https://www.openiap.dev/docs/apis/ios/is-eligible-for-intro-offer-ios
1390
+ */
1225
1391
  isEligibleForIntroOfferIOS: Promise<boolean>;
1226
- /** Verify a StoreKit 2 transaction signature */
1392
+ /**
1393
+ * Check whether a transaction's JWS verification passed (StoreKit 2).
1394
+ * See: https://www.openiap.dev/docs/apis/ios/is-transaction-verified-ios
1395
+ */
1227
1396
  isTransactionVerifiedIOS: Promise<boolean>;
1228
- /** Get the latest transaction for a product using StoreKit 2 */
1397
+ /**
1398
+ * Get the latest verified transaction for a product, using StoreKit 2.
1399
+ * See: https://www.openiap.dev/docs/apis/ios/latest-transaction-ios
1400
+ */
1229
1401
  latestTransactionIOS?: Promise<(PurchaseIOS | null)>;
1230
- /** Get StoreKit 2 subscription status details (iOS 15+) */
1402
+ /**
1403
+ * Get subscription status objects from StoreKit 2 (iOS 15+).
1404
+ * See: https://www.openiap.dev/docs/apis/ios/subscription-status-ios
1405
+ */
1231
1406
  subscriptionStatusIOS: Promise<SubscriptionStatusIOS[]>;
1232
1407
  /**
1233
- * Validate a receipt for a specific product
1408
+ * Deprecated. Legacy App Store receipt validation use verifyPurchase instead.
1409
+ * See: https://www.openiap.dev/docs/apis/ios/validate-receipt-ios
1234
1410
  * @deprecated Use verifyPurchase
1235
1411
  */
1236
1412
  validateReceiptIOS: Promise<VerifyPurchaseResultIOS>;
@@ -1724,6 +1900,8 @@ export interface SubscriptionProductReplacementParamsAndroid {
1724
1900
  */
1725
1901
  export type SubscriptionReplacementModeAndroid = 'unknown-replacement-mode' | 'with-time-proration' | 'charge-prorated-price' | 'charge-full-price' | 'without-proration' | 'deferred' | 'keep-existing';
1726
1902
 
1903
+ export type SubscriptionState = 'active' | 'expired' | 'in-billing-retry' | 'in-grace-period' | 'paused' | 'refunded' | 'revoked' | 'unknown';
1904
+
1727
1905
  export interface SubscriptionStatusIOS {
1728
1906
  renewalInfo?: (RenewalInfoIOS | null);
1729
1907
  state: string;
@@ -1885,6 +2063,67 @@ export interface VerifyPurchaseWithProviderResult {
1885
2063
 
1886
2064
  export type VoidResult = void;
1887
2065
 
2066
+ export type WebhookCancellationReason = 'billing-error' | 'other' | 'price-increase-declined' | 'product-unavailable' | 'refunded' | 'user-canceled';
2067
+
2068
+ export interface WebhookEvent {
2069
+ /** Reason for cancellation, when applicable. */
2070
+ cancellationReason?: (WebhookCancellationReason | null);
2071
+ /** Localized currency code (ISO 4217) at event time, when available. */
2072
+ currency?: (string | null);
2073
+ environment: WebhookEventEnvironment;
2074
+ /** When the current subscription period ends. Epoch milliseconds. */
2075
+ expiresAt?: (number | null);
2076
+ /**
2077
+ * Stable identifier suitable for idempotency. Derived from the source notification
2078
+ * UUID where the store provides one (ASN v2 `notificationUUID`, RTDN message id);
2079
+ * otherwise hashed from the canonicalized payload.
2080
+ */
2081
+ id: string;
2082
+ /** Time the underlying event occurred at the store. Epoch milliseconds. */
2083
+ occurredAt: number;
2084
+ platform: IapPlatform;
2085
+ /**
2086
+ * Price in micros (1/1,000,000 of the currency unit) at event time, when available.
2087
+ * Matches Google Play's `priceAmountMicros` convention; iOS values are converted.
2088
+ */
2089
+ priceAmountMicros?: (number | null);
2090
+ /** Product the event pertains to. May be null for account-level events. */
2091
+ productId?: (string | null);
2092
+ /** kit project that owns the subscription / purchase this event refers to. */
2093
+ projectId: string;
2094
+ /**
2095
+ * Cross-platform purchase identity used to correlate this event with an existing
2096
+ * purchase record. iOS: `originalTransactionId`. Android: `purchaseToken`.
2097
+ * Null for `TestNotification` events (Apple ASN v2 / Google RTDN test
2098
+ * payloads carry no transaction); always present for every other event type.
2099
+ */
2100
+ purchaseToken?: (string | null);
2101
+ /**
2102
+ * Original signed payload from the store. ASN v2 events expose the JWS string;
2103
+ * RTDN events expose the base64-decoded Pub/Sub message JSON. Provided so that
2104
+ * consumers can independently verify or extract platform-specific fields. kit
2105
+ * always validates this payload before emitting the event.
2106
+ */
2107
+ rawSignedPayload?: (string | null);
2108
+ /** Time kit ingested and normalized this event. Epoch milliseconds. */
2109
+ receivedAt: number;
2110
+ /** When auto-renewal will charge again. Epoch milliseconds. */
2111
+ renewsAt?: (number | null);
2112
+ source: WebhookEventSource;
2113
+ /**
2114
+ * Normalized subscription state at the time of event, when the event refers to
2115
+ * a subscription. Null for one-time purchase events.
2116
+ */
2117
+ subscriptionState?: (SubscriptionState | null);
2118
+ type: WebhookEventType;
2119
+ }
2120
+
2121
+ export type WebhookEventEnvironment = 'production' | 'sandbox' | 'xcode';
2122
+
2123
+ export type WebhookEventSource = 'apple-app-store-server-notifications-v2' | 'google-play-real-time-developer-notifications' | 'meta-horizon-reconciler';
2124
+
2125
+ export type WebhookEventType = 'purchase-consumption-request' | 'purchase-refunded' | 'subscription-canceled' | 'subscription-expired' | 'subscription-in-billing-retry' | 'subscription-in-grace-period' | 'subscription-paused' | 'subscription-price-change' | 'subscription-product-changed' | 'subscription-recovered' | 'subscription-renewed' | 'subscription-resumed' | 'subscription-revoked' | 'subscription-started' | 'subscription-uncanceled' | 'test-notification';
2126
+
1888
2127
  /**
1889
2128
  * Win-back offer input for iOS 18+ (StoreKit 2)
1890
2129
  * Win-back offers are used to re-engage churned subscribers.
@@ -1901,6 +2140,7 @@ export type QueryArgsMap = {
1901
2140
  currentEntitlementIOS: QueryCurrentEntitlementIosArgs;
1902
2141
  fetchProducts: QueryFetchProductsArgs;
1903
2142
  getActiveSubscriptions: QueryGetActiveSubscriptionsArgs;
2143
+ getAllTransactionsIOS: never;
1904
2144
  getAppTransactionIOS: never;
1905
2145
  getAvailablePurchases: QueryGetAvailablePurchasesArgs;
1906
2146
  getExternalPurchaseCustomLinkTokenIOS: QueryGetExternalPurchaseCustomLinkTokenIosArgs;
@@ -10,6 +10,9 @@ export interface IapError {
10
10
  responseCode?: number;
11
11
  debugMessage?: string;
12
12
  productId?: string;
13
+ productIds?: string[];
14
+ productType?: string;
15
+ isEmptyProductList?: boolean;
13
16
  [key: string]: any; // Allow additional platform-specific fields
14
17
  }
15
18
 
@@ -51,6 +51,9 @@ export interface PurchaseErrorProps {
51
51
  debugMessage?: string;
52
52
  code?: ErrorCode | string | number;
53
53
  productId?: string;
54
+ productIds?: string[];
55
+ productType?: string;
56
+ isEmptyProductList?: boolean;
54
57
  platform?: IapPlatform;
55
58
  }
56
59
 
@@ -59,6 +62,9 @@ export interface PurchaseError extends Error {
59
62
  debugMessage?: string;
60
63
  code?: ErrorCode;
61
64
  productId?: string;
65
+ productIds?: string[];
66
+ productType?: string;
67
+ isEmptyProductList?: boolean;
62
68
  platform?: IapPlatform;
63
69
  }
64
70
 
@@ -137,6 +143,9 @@ export const createPurchaseError = (
137
143
  error.debugMessage = props.debugMessage;
138
144
  error.code = errorCode;
139
145
  error.productId = props.productId;
146
+ error.productIds = props.productIds;
147
+ error.productType = props.productType;
148
+ error.isEmptyProductList = props.isEmptyProductList;
140
149
  error.platform = props.platform;
141
150
  return error;
142
151
  };
@@ -158,6 +167,9 @@ export const createPurchaseErrorFromPlatform = (
158
167
  debugMessage: errorData.debugMessage,
159
168
  code: errorCode,
160
169
  productId: errorData.productId,
170
+ productIds: errorData.productIds,
171
+ productType: errorData.productType,
172
+ isEmptyProductList: errorData.isEmptyProductList,
161
173
  platform,
162
174
  });
163
175
  };