expo-iap 4.5.2 → 4.6.0

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.
@@ -50,10 +50,11 @@ export declare const validateReceiptAndroid: ({ packageName, productId, productT
50
50
  */
51
51
  export declare const consumePurchaseAndroid: MutationField<'consumePurchaseAndroid'>;
52
52
  /**
53
- * Acknowledge a product (on Android.) No-op on iOS.
53
+ * Acknowledge a non-consumable purchase or subscription (Android only).
54
54
  * @param {Object} params - The parameters object
55
55
  * @param {string} params.token - The product's token (on Android)
56
56
  * @returns {Promise<VoidResult | void>}
57
+ * @throws Error if called on a non-Android platform
57
58
  *
58
59
  * @see {@link https://openiap.dev/docs/apis/android/acknowledge-purchase-android}
59
60
  */
@@ -1 +1 @@
1
- {"version":3,"file":"android.d.ts","sourceRoot":"","sources":["../../src/modules/android.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAEV,qBAAqB,EAErB,qCAAqC,EAErC,eAAe,EACf,2BAA2B,EAI3B,uDAAuD,EACvD,aAAa,EACb,UAAU,EACV,2BAA2B,EAC5B,MAAM,UAAU,CAAC;AAalB,wBAAgB,gBAAgB,CAAC,CAAC,SAAS;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAC,EAC5D,IAAI,EAAE,OAAO,GACZ,IAAI,IAAI,CAAC,GAAG;IAAC,QAAQ,EAAE,SAAS,CAAA;CAAC,CAQnC;AAED;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,8BAA8B,GACzC,UAAU,eAAe,GAAG,IAAI,KAC/B,OAAO,CAAC,IAAI,CAuBd,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,sBAAsB,GAAU,+DAM1C;IACD,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,OAAO,CAAC;CAC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;;;;;;;;;GAyBG;AACH,eAAO,MAAM,mCAAmC,EAAE,aAAa,CAC7D,qCAAqC,CAItC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,oCAAoC,EAAE,aAAa,CAC9D,sCAAsC,CAIvC,CAAC;AAMF;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,gCAAgC,EAAE,aAAa,CAC1D,kCAAkC,CAInC,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,2BAA2B,EAAE,UAAU,CAClD,6BAA6B,CAW9B,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,yBAAyB,EAAE,aAAa,CACnD,2BAA2B,CAI5B,CAAC;AAiCF,wBAAgB,2CAA2C,CACzD,IAAI,EAAE,uDAAuD,GAC5D,OAAO,CAAC,qCAAqC,CAAC,CAAC;AAClD,wBAAgB,2CAA2C,CACzD,OAAO,EAAE,qBAAqB,EAC9B,oBAAoB,CAAC,EAAE,2BAA2B,GAAG,IAAI,GACxD,OAAO,CAAC,qCAAqC,CAAC,CAAC;AAclD;;;;;;;;;GASG;AACH,eAAO,MAAM,0CAA0C,EAAE,aAAa,CACpE,4CAA4C,CAS7C,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,wBAAwB,EAAE,aAAa,CAClD,0BAA0B,CAM3B,CAAC"}
@@ -1,8 +1,22 @@
1
1
  // External dependencies
2
- import { Linking } from 'react-native';
2
+ import { Linking, Platform } from 'react-native';
3
3
  // Internal modules
4
4
  import ExpoIapModule from '../ExpoIapModule';
5
+ import { isVegaOS } from '../vega';
5
6
  const nativeAndroidModule = ExpoIapModule;
7
+ /**
8
+ * Enforce the documented Android-only contract. Vega OS is treated as an
9
+ * Android store runtime (matching `isAndroidStoreRuntime` in src/index.ts),
10
+ * so it passes through. Without this guard, calling a suffixed wrapper on
11
+ * another platform falls through to the native proxy and surfaces as an
12
+ * opaque `TypeError: ExpoIapModule.<name> is not a function` instead of the
13
+ * promised platform error.
14
+ */
15
+ const requireAndroidPlatform = (methodName) => {
16
+ if (Platform.OS !== 'android' && !isVegaOS()) {
17
+ throw new Error(`${methodName} is only available on Android and Vega OS`);
18
+ }
19
+ };
6
20
  // Type guards
7
21
  export function isProductAndroid(item) {
8
22
  return (item != null &&
@@ -85,6 +99,7 @@ export const validateReceiptAndroid = async ({ packageName, productId, productTo
85
99
  * @see {@link https://openiap.dev/docs/apis/android/consume-purchase-android}
86
100
  */
87
101
  export const consumePurchaseAndroid = async (purchaseToken) => {
102
+ requireAndroidPlatform('consumePurchaseAndroid');
88
103
  const result = await ExpoIapModule.consumePurchaseAndroid(purchaseToken);
89
104
  if (typeof result === 'boolean') {
90
105
  return result;
@@ -101,14 +116,16 @@ export const consumePurchaseAndroid = async (purchaseToken) => {
101
116
  throw new Error(`consumePurchaseAndroid returned an unexpected response payload: ${JSON.stringify(result)}`);
102
117
  };
103
118
  /**
104
- * Acknowledge a product (on Android.) No-op on iOS.
119
+ * Acknowledge a non-consumable purchase or subscription (Android only).
105
120
  * @param {Object} params - The parameters object
106
121
  * @param {string} params.token - The product's token (on Android)
107
122
  * @returns {Promise<VoidResult | void>}
123
+ * @throws Error if called on a non-Android platform
108
124
  *
109
125
  * @see {@link https://openiap.dev/docs/apis/android/acknowledge-purchase-android}
110
126
  */
111
127
  export const acknowledgePurchaseAndroid = async (purchaseToken) => {
128
+ requireAndroidPlatform('acknowledgePurchaseAndroid');
112
129
  const result = await ExpoIapModule.acknowledgePurchaseAndroid(purchaseToken);
113
130
  if (typeof result === 'boolean') {
114
131
  return result;
@@ -154,6 +171,7 @@ export const openRedeemOfferCodeAndroid = async () => {
154
171
  * @see {@link https://openiap.dev/docs/apis/android/check-alternative-billing-availability-android}
155
172
  */
156
173
  export const checkAlternativeBillingAvailabilityAndroid = async () => {
174
+ requireAndroidPlatform('checkAlternativeBillingAvailabilityAndroid');
157
175
  return ExpoIapModule.checkAlternativeBillingAvailabilityAndroid();
158
176
  };
159
177
  /**
@@ -183,6 +201,7 @@ export const checkAlternativeBillingAvailabilityAndroid = async () => {
183
201
  * @see {@link https://openiap.dev/docs/apis/android/show-alternative-billing-dialog-android}
184
202
  */
185
203
  export const showAlternativeBillingDialogAndroid = async () => {
204
+ requireAndroidPlatform('showAlternativeBillingDialogAndroid');
186
205
  return ExpoIapModule.showAlternativeBillingDialogAndroid();
187
206
  };
188
207
  /**
@@ -212,6 +231,7 @@ export const showAlternativeBillingDialogAndroid = async () => {
212
231
  * @see {@link https://openiap.dev/docs/apis/android/create-alternative-billing-token-android}
213
232
  */
214
233
  export const createAlternativeBillingTokenAndroid = async (sku) => {
234
+ requireAndroidPlatform('createAlternativeBillingTokenAndroid');
215
235
  return ExpoIapModule.createAlternativeBillingTokenAndroid(sku);
216
236
  };
217
237
  // ============================================================================
@@ -236,6 +256,7 @@ export const createAlternativeBillingTokenAndroid = async (sku) => {
236
256
  * @see {@link https://openiap.dev/docs/apis/android/is-billing-program-available-android}
237
257
  */
238
258
  export const isBillingProgramAvailableAndroid = async (program) => {
259
+ requireAndroidPlatform('isBillingProgramAvailableAndroid');
239
260
  return ExpoIapModule.isBillingProgramAvailableAndroid(program);
240
261
  };
241
262
  /**
@@ -248,6 +269,7 @@ export const isBillingProgramAvailableAndroid = async (program) => {
248
269
  * @see {@link https://openiap.dev/docs/apis/android/get-billing-choice-info-android}
249
270
  */
250
271
  export const getBillingChoiceInfoAndroid = async (params = {}) => {
272
+ requireAndroidPlatform('getBillingChoiceInfoAndroid');
251
273
  return ExpoIapModule.getBillingChoiceInfoAndroid({
252
274
  billingProgram: params.billingProgram ?? 'billing-choice',
253
275
  playBillingChoiceImageLayout: params.playBillingChoiceImageLayout ?? 'rectangular-four-by-one',
@@ -276,6 +298,7 @@ export const getBillingChoiceInfoAndroid = async (params = {}) => {
276
298
  * @see {@link https://openiap.dev/docs/apis/android/launch-external-link-android}
277
299
  */
278
300
  export const launchExternalLinkAndroid = async (params) => {
301
+ requireAndroidPlatform('launchExternalLinkAndroid');
279
302
  return ExpoIapModule.launchExternalLinkAndroid(params);
280
303
  };
281
304
  /**
@@ -297,7 +320,10 @@ export const launchExternalLinkAndroid = async (params) => {
297
320
  *
298
321
  * @see {@link https://openiap.dev/docs/apis/android/create-billing-program-reporting-details-android}
299
322
  */
300
- const createBillingProgramReportingDetailsAndroidField = async (args) => ExpoIapModule.createBillingProgramReportingDetailsAndroid(args.program, args.developerBillingType ?? null);
323
+ const createBillingProgramReportingDetailsAndroidField = async (args) => {
324
+ requireAndroidPlatform('createBillingProgramReportingDetailsAndroid');
325
+ return ExpoIapModule.createBillingProgramReportingDetailsAndroid(args.program, args.developerBillingType ?? null);
326
+ };
301
327
  export function createBillingProgramReportingDetailsAndroid(programOrArgs, developerBillingType) {
302
328
  const args = typeof programOrArgs === 'string'
303
329
  ? { program: programOrArgs, developerBillingType }
@@ -315,6 +341,7 @@ export function createBillingProgramReportingDetailsAndroid(programOrArgs, devel
315
341
  * @see {@link https://openiap.dev/docs/apis/android/show-billing-program-information-dialog-android}
316
342
  */
317
343
  export const showBillingProgramInformationDialogAndroid = async (params) => {
344
+ requireAndroidPlatform('showBillingProgramInformationDialogAndroid');
318
345
  return ExpoIapModule.showBillingProgramInformationDialogAndroid({
319
346
  billingProgram: params.billingProgram ?? 'billing-choice',
320
347
  externalTransactionToken: params.externalTransactionToken,
@@ -330,6 +357,7 @@ export const showBillingProgramInformationDialogAndroid = async (params) => {
330
357
  * @see {@link https://openiap.dev/docs/apis/android/show-in-app-messages-android}
331
358
  */
332
359
  export const showInAppMessagesAndroid = async (params) => {
360
+ requireAndroidPlatform('showInAppMessagesAndroid');
333
361
  return ExpoIapModule.showInAppMessagesAndroid(params ?? null);
334
362
  };
335
363
  //# sourceMappingURL=android.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"android.js","sourceRoot":"","sources":["../../src/modules/android.ts"],"names":[],"mappings":"AAAA,wBAAwB;AACxB,OAAO,EAAC,OAAO,EAA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aAAa,KAAK,QAAQ;QAC/B,CAAC,CAAC,EAAC,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAC;QAChD,CAAC,CAAC,aAAa,CAAC;IACpB,OAAO,gDAAgD,CAAC,IAAI,CAAC,CAAC;AAChE,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,0CAA0C,GAEnD,KAAK,EACP,MAAoD,EACrB,EAAE;IACjC,OAAO,aAAa,CAAC,0CAA0C,CAAC;QAC9D,cAAc,EAAE,MAAM,CAAC,cAAc,IAAI,gBAAgB;QACzD,wBAAwB,EAAE,MAAM,CAAC,wBAAwB;KAC1D,CAAC,CAAC;AACL,CAAC,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAEjC,KAAK,EACP,MAAyC,EACL,EAAE;IACtC,OAAO,aAAa,CAAC,wBAAwB,CAAC,MAAM,IAAI,IAAI,CAAC,CAAC;AAChE,CAAC,CAAC","sourcesContent":["// External dependencies\nimport {Linking} from 'react-native';\n\n// Internal modules\nimport ExpoIapModule from '../ExpoIapModule';\n\n// Types\nimport type {\n BillingChoiceInfoAndroid,\n BillingProgramAndroid,\n BillingProgramInformationDialogParamsAndroid,\n BillingProgramReportingDetailsAndroid,\n BillingResultAndroid,\n DeepLinkOptions,\n DeveloperBillingTypeAndroid,\n GetBillingChoiceInfoParamsAndroid,\n InAppMessageParamsAndroid,\n InAppMessageResultAndroid,\n MutationCreateBillingProgramReportingDetailsAndroidArgs,\n MutationField,\n QueryField,\n VerifyPurchaseResultAndroid,\n} from '../types';\n\ntype NativeAndroidModule = {\n deepLinkToSubscriptionsAndroid?: (params: {\n skuAndroid?: string;\n packageNameAndroid?: string;\n }) => Promise<void> | void;\n getStorefront?: () => Promise<string> | string;\n};\n\nconst nativeAndroidModule = ExpoIapModule as NativeAndroidModule;\n\n// Type guards\nexport function isProductAndroid<T extends {platform?: string}>(\n item: unknown,\n): item is T & {platform: 'android'} {\n return (\n item != null &&\n typeof item === 'object' &&\n 'platform' in item &&\n typeof (item as any).platform === 'string' &&\n (item as any).platform.toLowerCase() === 'android'\n );\n}\n\n/**\n * Deep link to subscriptions screen on Android.\n * @param {Object} params - The parameters object\n * @param {string} params.skuAndroid - The product's SKU (on Android)\n * @param {string} params.packageNameAndroid - The package name of your Android app (e.g., 'com.example.app')\n * @returns {Promise<void>}\n *\n * @example\n * ```typescript\n * await deepLinkToSubscriptionsAndroid({\n * skuAndroid: 'subscription_id',\n * packageNameAndroid: 'com.example.app'\n * });\n * ```\n */\nexport const deepLinkToSubscriptionsAndroid = async (\n options?: DeepLinkOptions | null,\n): Promise<void> => {\n const sku = options?.skuAndroid ?? undefined;\n const packageName = options?.packageNameAndroid ?? undefined;\n\n // Prefer native deep link implementation via OpenIAP module\n if (nativeAndroidModule?.deepLinkToSubscriptionsAndroid) {\n return nativeAndroidModule.deepLinkToSubscriptionsAndroid({\n skuAndroid: sku,\n packageNameAndroid: packageName,\n });\n }\n\n // Fallback to Linking if native method unavailable\n if (!packageName) {\n throw new Error(\n 'packageName is required for deepLinkToSubscriptionsAndroid',\n );\n }\n const base = `https://play.google.com/store/account/subscriptions?package=${encodeURIComponent(\n packageName,\n )}`;\n const url = sku ? `${base}&sku=${encodeURIComponent(sku)}` : base;\n return Linking.openURL(url);\n};\n\n/**\n * Validate receipt for Android. NOTE: This method is here for debugging purposes only. Including\n * your access token in the binary you ship to users is potentially dangerous.\n * Use server side validation instead for your production builds\n *\n * @deprecated Use verifyPurchase instead\n * @param {Object} params - The parameters object\n * @param {string} params.packageName - package name of your app.\n * @param {string} params.productId - product id for your in app product.\n * @param {string} params.productToken - token for your purchase (called 'token' in the API documentation).\n * @param {string} params.accessToken - OAuth access token with androidpublisher scope. Required for authentication.\n * @param {boolean} params.isSub - whether this is subscription or in-app. `true` for subscription.\n * @returns {Promise<ReceiptAndroid>}\n */\nexport const validateReceiptAndroid = async ({\n packageName,\n productId,\n productToken,\n accessToken,\n isSub,\n}: {\n packageName: string;\n productId: string;\n productToken: string;\n accessToken: string;\n isSub?: boolean;\n}): Promise<VerifyPurchaseResultAndroid> => {\n const type = isSub ? 'subscriptions' : 'products';\n\n const url =\n 'https://androidpublisher.googleapis.com/androidpublisher/v3/applications' +\n `/${packageName}/purchases/${type}/${productId}` +\n `/tokens/${productToken}`;\n\n const response = await fetch(url, {\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json',\n Authorization: `Bearer ${accessToken}`,\n },\n });\n\n if (!response.ok) {\n throw Object.assign(new Error(response.statusText), {\n statusCode: response.status,\n });\n }\n\n return response.json();\n};\n\n/**\n * Consume a purchase token so the user can purchase the same product again\n * (Android consumable products). Prefer using `finishTransaction` with\n * `isConsumable: true`, which dispatches to this under the hood.\n *\n * @see {@link https://openiap.dev/docs/apis/android/consume-purchase-android}\n */\nexport const consumePurchaseAndroid: MutationField<\n 'consumePurchaseAndroid'\n> = async (purchaseToken) => {\n const result = await ExpoIapModule.consumePurchaseAndroid(purchaseToken);\n\n if (typeof result === 'boolean') {\n return result;\n }\n\n if (result && typeof result === 'object') {\n const record = result as Record<string, unknown>;\n if (typeof record.success === 'boolean') {\n return record.success;\n }\n if (typeof record.responseCode === 'number') {\n return record.responseCode === 0;\n }\n }\n\n throw new Error(\n `consumePurchaseAndroid returned an unexpected response payload: ${JSON.stringify(\n result,\n )}`,\n );\n};\n\n/**\n * Acknowledge a product (on Android.) No-op on iOS.\n * @param {Object} params - The parameters object\n * @param {string} params.token - The product's token (on Android)\n * @returns {Promise<VoidResult | void>}\n *\n * @see {@link https://openiap.dev/docs/apis/android/acknowledge-purchase-android}\n */\nexport const acknowledgePurchaseAndroid: MutationField<\n 'acknowledgePurchaseAndroid'\n> = async (purchaseToken) => {\n const result = await ExpoIapModule.acknowledgePurchaseAndroid(purchaseToken);\n\n if (typeof result === 'boolean') {\n return result;\n }\n\n if (result && typeof result === 'object') {\n const record = result as Record<string, unknown>;\n if (typeof record.success === 'boolean') {\n return record.success;\n }\n if (typeof record.responseCode === 'number') {\n return record.responseCode === 0;\n }\n }\n\n return true;\n};\n\n/**\n * Open the Google Play Store to redeem offer codes (Android only).\n * Note: Google Play does not provide a direct API to redeem codes within the app.\n * This function opens the Play Store where users can manually enter their codes.\n *\n * @returns {Promise<void>}\n */\nexport const openRedeemOfferCodeAndroid = async (): Promise<void> => {\n return Linking.openURL(`https://play.google.com/redeem?code=`);\n};\n\n/**\n * Check if alternative billing is available for this user/device (Android only).\n * Step 1 of alternative billing flow.\n *\n * Returns true if available, false otherwise.\n * Throws OpenIapError.NotPrepared if billing client not ready.\n *\n * @returns {Promise<boolean>}\n *\n * @example\n * ```typescript\n * const isAvailable = await checkAlternativeBillingAvailabilityAndroid();\n * if (isAvailable) {\n * // Proceed with alternative billing flow\n * }\n * ```\n *\n * @see {@link https://openiap.dev/docs/apis/android/check-alternative-billing-availability-android}\n */\nexport const checkAlternativeBillingAvailabilityAndroid: MutationField<\n 'checkAlternativeBillingAvailabilityAndroid'\n> = async () => {\n return ExpoIapModule.checkAlternativeBillingAvailabilityAndroid();\n};\n\n/**\n * Show alternative billing information dialog to user (Android only).\n * Step 2 of alternative billing flow.\n * Must be called BEFORE processing payment in your payment system.\n *\n * Returns true if user accepted, false if user canceled.\n * Throws OpenIapError.NotPrepared if billing client not ready.\n *\n * @returns {Promise<boolean>}\n *\n * @example\n * ```typescript\n * const userAccepted = await showAlternativeBillingDialogAndroid();\n * if (userAccepted) {\n * // Process payment in your payment system\n * const success = await processCustomPayment();\n * if (success) {\n * // Create reporting token\n * const token = await createAlternativeBillingTokenAndroid();\n * // Send token to your backend for Google Play reporting\n * }\n * }\n * ```\n *\n * @see {@link https://openiap.dev/docs/apis/android/show-alternative-billing-dialog-android}\n */\nexport const showAlternativeBillingDialogAndroid: MutationField<\n 'showAlternativeBillingDialogAndroid'\n> = async () => {\n return ExpoIapModule.showAlternativeBillingDialogAndroid();\n};\n\n/**\n * Create external transaction token for Google Play reporting (Android only).\n * Step 3 of alternative billing flow.\n * Must be called AFTER successful payment in your payment system.\n * Token must be reported to Google Play backend within 24 hours.\n *\n * Returns token string, or null if creation failed.\n * Throws OpenIapError.NotPrepared if billing client not ready.\n *\n * @param {string} sku - The product SKU that was purchased\n * @returns {Promise<string | null>}\n *\n * @example\n * ```typescript\n * const token = await createAlternativeBillingTokenAndroid('premium_subscription');\n * if (token) {\n * // Send token to your backend\n * await fetch('/api/report-transaction', {\n * method: 'POST',\n * body: JSON.stringify({ token, sku: 'premium_subscription' })\n * });\n * }\n * ```\n *\n * @see {@link https://openiap.dev/docs/apis/android/create-alternative-billing-token-android}\n */\nexport const createAlternativeBillingTokenAndroid: MutationField<\n 'createAlternativeBillingTokenAndroid'\n> = async (sku?: string) => {\n return ExpoIapModule.createAlternativeBillingTokenAndroid(sku);\n};\n\n// ============================================================================\n// Billing Programs API (Google Play Billing Library 8.2.0+)\n// ============================================================================\n\n/**\n * Check if a specific billing program is available for this user/device (Android only).\n * Available in Google Play Billing Library 8.2.0+. Billing Choice availability\n * details, including the configured renderer and external-link support, require 9.1.0+.\n *\n * @param program - The billing program to check\n * @returns Promise resolving to availability result\n *\n * @example\n * ```typescript\n * const result = await isBillingProgramAvailableAndroid('external-offer');\n * if (result.isAvailable) {\n * // Proceed with billing program flow\n * }\n * ```\n *\n * @see {@link https://openiap.dev/docs/apis/android/is-billing-program-available-android}\n */\nexport const isBillingProgramAvailableAndroid: MutationField<\n 'isBillingProgramAvailableAndroid'\n> = async (program) => {\n return ExpoIapModule.isBillingProgramAvailableAndroid(program);\n};\n\n/**\n * Fetch Play Billing assets and loyalty text for developer-rendered Billing Choice screens.\n * Available in Google Play Billing Library 9.1.0+.\n *\n * @param params - Billing Choice info request parameters\n * @returns Promise resolving to Play Billing Choice display information\n *\n * @see {@link https://openiap.dev/docs/apis/android/get-billing-choice-info-android}\n */\nexport const getBillingChoiceInfoAndroid: QueryField<\n 'getBillingChoiceInfoAndroid'\n> = async (\n params: GetBillingChoiceInfoParamsAndroid = {},\n): Promise<BillingChoiceInfoAndroid> => {\n return ExpoIapModule.getBillingChoiceInfoAndroid({\n billingProgram: params.billingProgram ?? 'billing-choice',\n playBillingChoiceImageLayout:\n params.playBillingChoiceImageLayout ?? 'rectangular-four-by-one',\n userLocale: params.userLocale ?? null,\n });\n};\n\n/**\n * Launch an external link for the specified billing program (Android only).\n * Available in Google Play Billing Library 8.2.0+; developer-rendered Billing\n * Choice external-link flows require 9.1.0+ and `externalTransactionToken`.\n *\n * @param params - The external link parameters\n * @returns Promise resolving to true if the link was launched successfully\n *\n * @example\n * ```typescript\n * await launchExternalLinkAndroid({\n * billingProgram: 'billing-choice',\n * externalTransactionToken: 'pre-generated-token',\n * launchMode: 'launch-in-external-browser-or-app',\n * linkType: 'link-to-digital-content-offer',\n * linkUri: 'https://your-payment-site.com',\n * });\n * ```\n *\n * @see {@link https://openiap.dev/docs/apis/android/launch-external-link-android}\n */\nexport const launchExternalLinkAndroid: MutationField<\n 'launchExternalLinkAndroid'\n> = async (params) => {\n return ExpoIapModule.launchExternalLinkAndroid(params);\n};\n\n/**\n * Create billing program reporting details for Google Play reporting (Android only).\n * Available in Google Play Billing Library 8.2.0+.\n *\n * Must be called AFTER successful payment in your payment system.\n * Token must be reported to Google Play backend within 24 hours.\n *\n * @param program - The billing program type\n * @returns Promise resolving to reporting details including the external transaction token\n *\n * @example\n * ```typescript\n * const details = await createBillingProgramReportingDetailsAndroid('external-offer');\n * // Report details.externalTransactionToken to Google Play within 24 hours\n * await reportToGooglePlay(details.externalTransactionToken);\n * ```\n *\n * @see {@link https://openiap.dev/docs/apis/android/create-billing-program-reporting-details-android}\n */\nconst createBillingProgramReportingDetailsAndroidField: MutationField<\n 'createBillingProgramReportingDetailsAndroid'\n> = async (\n args: MutationCreateBillingProgramReportingDetailsAndroidArgs,\n): Promise<BillingProgramReportingDetailsAndroid> =>\n ExpoIapModule.createBillingProgramReportingDetailsAndroid(\n args.program,\n args.developerBillingType ?? null,\n );\n\nexport function createBillingProgramReportingDetailsAndroid(\n args: MutationCreateBillingProgramReportingDetailsAndroidArgs,\n): Promise<BillingProgramReportingDetailsAndroid>;\nexport function createBillingProgramReportingDetailsAndroid(\n program: BillingProgramAndroid,\n developerBillingType?: DeveloperBillingTypeAndroid | null,\n): Promise<BillingProgramReportingDetailsAndroid>;\nexport function createBillingProgramReportingDetailsAndroid(\n programOrArgs:\n | BillingProgramAndroid\n | MutationCreateBillingProgramReportingDetailsAndroidArgs,\n developerBillingType?: DeveloperBillingTypeAndroid | null,\n): Promise<BillingProgramReportingDetailsAndroid> {\n const args =\n typeof programOrArgs === 'string'\n ? {program: programOrArgs, developerBillingType}\n : programOrArgs;\n return createBillingProgramReportingDetailsAndroidField(args);\n}\n\n/**\n * Show Google's mandatory information dialog before a developer-rendered,\n * in-app Billing Choice screen.\n * Available in Google Play Billing Library 9.1.0+.\n *\n * @param params - Dialog parameters with the external transaction token\n * @returns Promise resolving to BillingResult\n *\n * @see {@link https://openiap.dev/docs/apis/android/show-billing-program-information-dialog-android}\n */\nexport const showBillingProgramInformationDialogAndroid: MutationField<\n 'showBillingProgramInformationDialogAndroid'\n> = async (\n params: BillingProgramInformationDialogParamsAndroid,\n): Promise<BillingResultAndroid> => {\n return ExpoIapModule.showBillingProgramInformationDialogAndroid({\n billingProgram: params.billingProgram ?? 'billing-choice',\n externalTransactionToken: params.externalTransactionToken,\n });\n};\n\n/**\n * Show Play Billing in-app messages, such as transactional subscription updates.\n * Available in Google Play Billing Library 4.1.0+.\n *\n * @param params - Optional in-app message categories\n * @returns Promise resolving to in-app message result\n *\n * @see {@link https://openiap.dev/docs/apis/android/show-in-app-messages-android}\n */\nexport const showInAppMessagesAndroid: MutationField<\n 'showInAppMessagesAndroid'\n> = async (\n params?: InAppMessageParamsAndroid | null,\n): Promise<InAppMessageResultAndroid> => {\n return ExpoIapModule.showInAppMessagesAndroid(params ?? null);\n};\n"]}
1
+ {"version":3,"file":"android.js","sourceRoot":"","sources":["../../src/modules/android.ts"],"names":[],"mappings":"AAAA,wBAAwB;A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CAAC,MAAM,wBAAwB,GAEjC,KAAK,EACP,MAAyC,EACL,EAAE;IACtC,sBAAsB,CAAC,0BAA0B,CAAC,CAAC;IACnD,OAAO,aAAa,CAAC,wBAAwB,CAAC,MAAM,IAAI,IAAI,CAAC,CAAC;AAChE,CAAC,CAAC","sourcesContent":["// External dependencies\nimport {Linking, Platform} from 'react-native';\n\n// Internal modules\nimport ExpoIapModule from '../ExpoIapModule';\nimport {isVegaOS} from '../vega';\n\n// Types\nimport type {\n BillingChoiceInfoAndroid,\n BillingProgramAndroid,\n BillingProgramInformationDialogParamsAndroid,\n BillingProgramReportingDetailsAndroid,\n BillingResultAndroid,\n DeepLinkOptions,\n DeveloperBillingTypeAndroid,\n GetBillingChoiceInfoParamsAndroid,\n InAppMessageParamsAndroid,\n InAppMessageResultAndroid,\n MutationCreateBillingProgramReportingDetailsAndroidArgs,\n MutationField,\n QueryField,\n VerifyPurchaseResultAndroid,\n} from '../types';\n\ntype NativeAndroidModule = {\n deepLinkToSubscriptionsAndroid?: (params: {\n skuAndroid?: string;\n packageNameAndroid?: string;\n }) => Promise<void> | void;\n getStorefront?: () => Promise<string> | string;\n};\n\nconst nativeAndroidModule = ExpoIapModule as NativeAndroidModule;\n\n/**\n * Enforce the documented Android-only contract. Vega OS is treated as an\n * Android store runtime (matching `isAndroidStoreRuntime` in src/index.ts),\n * so it passes through. Without this guard, calling a suffixed wrapper on\n * another platform falls through to the native proxy and surfaces as an\n * opaque `TypeError: ExpoIapModule.<name> is not a function` instead of the\n * promised platform error.\n */\nconst requireAndroidPlatform = (methodName: string): void => {\n if (Platform.OS !== 'android' && !isVegaOS()) {\n throw new Error(`${methodName} is only available on Android and Vega OS`);\n }\n};\n\n// Type guards\nexport function isProductAndroid<T extends {platform?: string}>(\n item: unknown,\n): item is T & {platform: 'android'} {\n return (\n item != null &&\n typeof item === 'object' &&\n 'platform' in item &&\n typeof (item as any).platform === 'string' &&\n (item as any).platform.toLowerCase() === 'android'\n );\n}\n\n/**\n * Deep link to subscriptions screen on Android.\n * @param {Object} params - The parameters object\n * @param {string} params.skuAndroid - The product's SKU (on Android)\n * @param {string} params.packageNameAndroid - The package name of your Android app (e.g., 'com.example.app')\n * @returns {Promise<void>}\n *\n * @example\n * ```typescript\n * await deepLinkToSubscriptionsAndroid({\n * skuAndroid: 'subscription_id',\n * packageNameAndroid: 'com.example.app'\n * });\n * ```\n */\nexport const deepLinkToSubscriptionsAndroid = async (\n options?: DeepLinkOptions | null,\n): Promise<void> => {\n const sku = options?.skuAndroid ?? undefined;\n const packageName = options?.packageNameAndroid ?? undefined;\n\n // Prefer native deep link implementation via OpenIAP module\n if (nativeAndroidModule?.deepLinkToSubscriptionsAndroid) {\n return nativeAndroidModule.deepLinkToSubscriptionsAndroid({\n skuAndroid: sku,\n packageNameAndroid: packageName,\n });\n }\n\n // Fallback to Linking if native method unavailable\n if (!packageName) {\n throw new Error(\n 'packageName is required for deepLinkToSubscriptionsAndroid',\n );\n }\n const base = `https://play.google.com/store/account/subscriptions?package=${encodeURIComponent(\n packageName,\n )}`;\n const url = sku ? `${base}&sku=${encodeURIComponent(sku)}` : base;\n return Linking.openURL(url);\n};\n\n/**\n * Validate receipt for Android. NOTE: This method is here for debugging purposes only. Including\n * your access token in the binary you ship to users is potentially dangerous.\n * Use server side validation instead for your production builds\n *\n * @deprecated Use verifyPurchase instead\n * @param {Object} params - The parameters object\n * @param {string} params.packageName - package name of your app.\n * @param {string} params.productId - product id for your in app product.\n * @param {string} params.productToken - token for your purchase (called 'token' in the API documentation).\n * @param {string} params.accessToken - OAuth access token with androidpublisher scope. Required for authentication.\n * @param {boolean} params.isSub - whether this is subscription or in-app. `true` for subscription.\n * @returns {Promise<ReceiptAndroid>}\n */\nexport const validateReceiptAndroid = async ({\n packageName,\n productId,\n productToken,\n accessToken,\n isSub,\n}: {\n packageName: string;\n productId: string;\n productToken: string;\n accessToken: string;\n isSub?: boolean;\n}): Promise<VerifyPurchaseResultAndroid> => {\n const type = isSub ? 'subscriptions' : 'products';\n\n const url =\n 'https://androidpublisher.googleapis.com/androidpublisher/v3/applications' +\n `/${packageName}/purchases/${type}/${productId}` +\n `/tokens/${productToken}`;\n\n const response = await fetch(url, {\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json',\n Authorization: `Bearer ${accessToken}`,\n },\n });\n\n if (!response.ok) {\n throw Object.assign(new Error(response.statusText), {\n statusCode: response.status,\n });\n }\n\n return response.json();\n};\n\n/**\n * Consume a purchase token so the user can purchase the same product again\n * (Android consumable products). Prefer using `finishTransaction` with\n * `isConsumable: true`, which dispatches to this under the hood.\n *\n * @see {@link https://openiap.dev/docs/apis/android/consume-purchase-android}\n */\nexport const consumePurchaseAndroid: MutationField<\n 'consumePurchaseAndroid'\n> = async (purchaseToken) => {\n requireAndroidPlatform('consumePurchaseAndroid');\n const result = await ExpoIapModule.consumePurchaseAndroid(purchaseToken);\n\n if (typeof result === 'boolean') {\n return result;\n }\n\n if (result && typeof result === 'object') {\n const record = result as Record<string, unknown>;\n if (typeof record.success === 'boolean') {\n return record.success;\n }\n if (typeof record.responseCode === 'number') {\n return record.responseCode === 0;\n }\n }\n\n throw new Error(\n `consumePurchaseAndroid returned an unexpected response payload: ${JSON.stringify(\n result,\n )}`,\n );\n};\n\n/**\n * Acknowledge a non-consumable purchase or subscription (Android only).\n * @param {Object} params - The parameters object\n * @param {string} params.token - The product's token (on Android)\n * @returns {Promise<VoidResult | void>}\n * @throws Error if called on a non-Android platform\n *\n * @see {@link https://openiap.dev/docs/apis/android/acknowledge-purchase-android}\n */\nexport const acknowledgePurchaseAndroid: MutationField<\n 'acknowledgePurchaseAndroid'\n> = async (purchaseToken) => {\n requireAndroidPlatform('acknowledgePurchaseAndroid');\n const result = await ExpoIapModule.acknowledgePurchaseAndroid(purchaseToken);\n\n if (typeof result === 'boolean') {\n return result;\n }\n\n if (result && typeof result === 'object') {\n const record = result as Record<string, unknown>;\n if (typeof record.success === 'boolean') {\n return record.success;\n }\n if (typeof record.responseCode === 'number') {\n return record.responseCode === 0;\n }\n }\n\n return true;\n};\n\n/**\n * Open the Google Play Store to redeem offer codes (Android only).\n * Note: Google Play does not provide a direct API to redeem codes within the app.\n * This function opens the Play Store where users can manually enter their codes.\n *\n * @returns {Promise<void>}\n */\nexport const openRedeemOfferCodeAndroid = async (): Promise<void> => {\n return Linking.openURL(`https://play.google.com/redeem?code=`);\n};\n\n/**\n * Check if alternative billing is available for this user/device (Android only).\n * Step 1 of alternative billing flow.\n *\n * Returns true if available, false otherwise.\n * Throws OpenIapError.NotPrepared if billing client not ready.\n *\n * @returns {Promise<boolean>}\n *\n * @example\n * ```typescript\n * const isAvailable = await checkAlternativeBillingAvailabilityAndroid();\n * if (isAvailable) {\n * // Proceed with alternative billing flow\n * }\n * ```\n *\n * @see {@link https://openiap.dev/docs/apis/android/check-alternative-billing-availability-android}\n */\nexport const checkAlternativeBillingAvailabilityAndroid: MutationField<\n 'checkAlternativeBillingAvailabilityAndroid'\n> = async () => {\n requireAndroidPlatform('checkAlternativeBillingAvailabilityAndroid');\n return ExpoIapModule.checkAlternativeBillingAvailabilityAndroid();\n};\n\n/**\n * Show alternative billing information dialog to user (Android only).\n * Step 2 of alternative billing flow.\n * Must be called BEFORE processing payment in your payment system.\n *\n * Returns true if user accepted, false if user canceled.\n * Throws OpenIapError.NotPrepared if billing client not ready.\n *\n * @returns {Promise<boolean>}\n *\n * @example\n * ```typescript\n * const userAccepted = await showAlternativeBillingDialogAndroid();\n * if (userAccepted) {\n * // Process payment in your payment system\n * const success = await processCustomPayment();\n * if (success) {\n * // Create reporting token\n * const token = await createAlternativeBillingTokenAndroid();\n * // Send token to your backend for Google Play reporting\n * }\n * }\n * ```\n *\n * @see {@link https://openiap.dev/docs/apis/android/show-alternative-billing-dialog-android}\n */\nexport const showAlternativeBillingDialogAndroid: MutationField<\n 'showAlternativeBillingDialogAndroid'\n> = async () => {\n requireAndroidPlatform('showAlternativeBillingDialogAndroid');\n return ExpoIapModule.showAlternativeBillingDialogAndroid();\n};\n\n/**\n * Create external transaction token for Google Play reporting (Android only).\n * Step 3 of alternative billing flow.\n * Must be called AFTER successful payment in your payment system.\n * Token must be reported to Google Play backend within 24 hours.\n *\n * Returns token string, or null if creation failed.\n * Throws OpenIapError.NotPrepared if billing client not ready.\n *\n * @param {string} sku - The product SKU that was purchased\n * @returns {Promise<string | null>}\n *\n * @example\n * ```typescript\n * const token = await createAlternativeBillingTokenAndroid('premium_subscription');\n * if (token) {\n * // Send token to your backend\n * await fetch('/api/report-transaction', {\n * method: 'POST',\n * body: JSON.stringify({ token, sku: 'premium_subscription' })\n * });\n * }\n * ```\n *\n * @see {@link https://openiap.dev/docs/apis/android/create-alternative-billing-token-android}\n */\nexport const createAlternativeBillingTokenAndroid: MutationField<\n 'createAlternativeBillingTokenAndroid'\n> = async (sku?: string) => {\n requireAndroidPlatform('createAlternativeBillingTokenAndroid');\n return ExpoIapModule.createAlternativeBillingTokenAndroid(sku);\n};\n\n// ============================================================================\n// Billing Programs API (Google Play Billing Library 8.2.0+)\n// ============================================================================\n\n/**\n * Check if a specific billing program is available for this user/device (Android only).\n * Available in Google Play Billing Library 8.2.0+. Billing Choice availability\n * details, including the configured renderer and external-link support, require 9.1.0+.\n *\n * @param program - The billing program to check\n * @returns Promise resolving to availability result\n *\n * @example\n * ```typescript\n * const result = await isBillingProgramAvailableAndroid('external-offer');\n * if (result.isAvailable) {\n * // Proceed with billing program flow\n * }\n * ```\n *\n * @see {@link https://openiap.dev/docs/apis/android/is-billing-program-available-android}\n */\nexport const isBillingProgramAvailableAndroid: MutationField<\n 'isBillingProgramAvailableAndroid'\n> = async (program) => {\n requireAndroidPlatform('isBillingProgramAvailableAndroid');\n return ExpoIapModule.isBillingProgramAvailableAndroid(program);\n};\n\n/**\n * Fetch Play Billing assets and loyalty text for developer-rendered Billing Choice screens.\n * Available in Google Play Billing Library 9.1.0+.\n *\n * @param params - Billing Choice info request parameters\n * @returns Promise resolving to Play Billing Choice display information\n *\n * @see {@link https://openiap.dev/docs/apis/android/get-billing-choice-info-android}\n */\nexport const getBillingChoiceInfoAndroid: QueryField<\n 'getBillingChoiceInfoAndroid'\n> = async (\n params: GetBillingChoiceInfoParamsAndroid = {},\n): Promise<BillingChoiceInfoAndroid> => {\n requireAndroidPlatform('getBillingChoiceInfoAndroid');\n return ExpoIapModule.getBillingChoiceInfoAndroid({\n billingProgram: params.billingProgram ?? 'billing-choice',\n playBillingChoiceImageLayout:\n params.playBillingChoiceImageLayout ?? 'rectangular-four-by-one',\n userLocale: params.userLocale ?? null,\n });\n};\n\n/**\n * Launch an external link for the specified billing program (Android only).\n * Available in Google Play Billing Library 8.2.0+; developer-rendered Billing\n * Choice external-link flows require 9.1.0+ and `externalTransactionToken`.\n *\n * @param params - The external link parameters\n * @returns Promise resolving to true if the link was launched successfully\n *\n * @example\n * ```typescript\n * await launchExternalLinkAndroid({\n * billingProgram: 'billing-choice',\n * externalTransactionToken: 'pre-generated-token',\n * launchMode: 'launch-in-external-browser-or-app',\n * linkType: 'link-to-digital-content-offer',\n * linkUri: 'https://your-payment-site.com',\n * });\n * ```\n *\n * @see {@link https://openiap.dev/docs/apis/android/launch-external-link-android}\n */\nexport const launchExternalLinkAndroid: MutationField<\n 'launchExternalLinkAndroid'\n> = async (params) => {\n requireAndroidPlatform('launchExternalLinkAndroid');\n return ExpoIapModule.launchExternalLinkAndroid(params);\n};\n\n/**\n * Create billing program reporting details for Google Play reporting (Android only).\n * Available in Google Play Billing Library 8.2.0+.\n *\n * Must be called AFTER successful payment in your payment system.\n * Token must be reported to Google Play backend within 24 hours.\n *\n * @param program - The billing program type\n * @returns Promise resolving to reporting details including the external transaction token\n *\n * @example\n * ```typescript\n * const details = await createBillingProgramReportingDetailsAndroid('external-offer');\n * // Report details.externalTransactionToken to Google Play within 24 hours\n * await reportToGooglePlay(details.externalTransactionToken);\n * ```\n *\n * @see {@link https://openiap.dev/docs/apis/android/create-billing-program-reporting-details-android}\n */\nconst createBillingProgramReportingDetailsAndroidField: MutationField<\n 'createBillingProgramReportingDetailsAndroid'\n> = async (\n args: MutationCreateBillingProgramReportingDetailsAndroidArgs,\n): Promise<BillingProgramReportingDetailsAndroid> => {\n requireAndroidPlatform('createBillingProgramReportingDetailsAndroid');\n return ExpoIapModule.createBillingProgramReportingDetailsAndroid(\n args.program,\n args.developerBillingType ?? null,\n );\n};\n\nexport function createBillingProgramReportingDetailsAndroid(\n args: MutationCreateBillingProgramReportingDetailsAndroidArgs,\n): Promise<BillingProgramReportingDetailsAndroid>;\nexport function createBillingProgramReportingDetailsAndroid(\n program: BillingProgramAndroid,\n developerBillingType?: DeveloperBillingTypeAndroid | null,\n): Promise<BillingProgramReportingDetailsAndroid>;\nexport function createBillingProgramReportingDetailsAndroid(\n programOrArgs:\n | BillingProgramAndroid\n | MutationCreateBillingProgramReportingDetailsAndroidArgs,\n developerBillingType?: DeveloperBillingTypeAndroid | null,\n): Promise<BillingProgramReportingDetailsAndroid> {\n const args =\n typeof programOrArgs === 'string'\n ? {program: programOrArgs, developerBillingType}\n : programOrArgs;\n return createBillingProgramReportingDetailsAndroidField(args);\n}\n\n/**\n * Show Google's mandatory information dialog before a developer-rendered,\n * in-app Billing Choice screen.\n * Available in Google Play Billing Library 9.1.0+.\n *\n * @param params - Dialog parameters with the external transaction token\n * @returns Promise resolving to BillingResult\n *\n * @see {@link https://openiap.dev/docs/apis/android/show-billing-program-information-dialog-android}\n */\nexport const showBillingProgramInformationDialogAndroid: MutationField<\n 'showBillingProgramInformationDialogAndroid'\n> = async (\n params: BillingProgramInformationDialogParamsAndroid,\n): Promise<BillingResultAndroid> => {\n requireAndroidPlatform('showBillingProgramInformationDialogAndroid');\n return ExpoIapModule.showBillingProgramInformationDialogAndroid({\n billingProgram: params.billingProgram ?? 'billing-choice',\n externalTransactionToken: params.externalTransactionToken,\n });\n};\n\n/**\n * Show Play Billing in-app messages, such as transactional subscription updates.\n * Available in Google Play Billing Library 4.1.0+.\n *\n * @param params - Optional in-app message categories\n * @returns Promise resolving to in-app message result\n *\n * @see {@link https://openiap.dev/docs/apis/android/show-in-app-messages-android}\n */\nexport const showInAppMessagesAndroid: MutationField<\n 'showInAppMessagesAndroid'\n> = async (\n params?: InAppMessageParamsAndroid | null,\n): Promise<InAppMessageResultAndroid> => {\n requireAndroidPlatform('showInAppMessagesAndroid');\n return ExpoIapModule.showInAppMessagesAndroid(params ?? null);\n};\n"]}
@@ -116,6 +116,8 @@ export declare const getReceiptIOS: () => Promise<string | null>;
116
116
  * alias so consumers who previously imported `getStorefrontIOS` do not break.
117
117
  *
118
118
  * @returns {Promise<string>} ISO 3166-1 alpha-3 country code (e.g. "USA")
119
+ * @throws Error if called on non-iOS platform — Android callers must use the
120
+ * cross-platform `getStorefront` from the main index instead
119
121
  *
120
122
  * @platform iOS
121
123
  *
@@ -1 +1 @@
1
- {"version":3,"file":"ios.d.ts","sourceRoot":"","sources":["../../src/modules/ios.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAKV,aAAa,EAEb,QAAQ,EAER,UAAU,EAIX,MAAM,UAAU,CAAC;AAClB,OAAO,EAGL,KAAK,aAAa,EACnB,MAAM,uBAAuB,CAAC;AAG/B,MAAM,MAAM,gBAAgB,GAAG;IAC7B,WAAW,CAAC,EAAE,QAAQ,CAAC;IACvB,KAAK,CAAC,EAAE,aAAa,CAAC;CACvB,CAAC;AAKF,wBAAgB,YAAY,CAAC,CAAC,SAAS;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAC,EACxD,IAAI,EAAE,OAAO,GACZ,IAAI,IAAI,CAAC,GAAG;IAAC,QAAQ,EAAE,KAAK,CAAA;CAAC,CAQ/B;AAGD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,OAAO,EAAE,aAAa,CAAC,SAAS,CAE5C,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,0BAA0B,EAAE,UAAU,CACjD,4BAA4B,CAM7B,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,qBAAqB,EAA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qC,EAAE,UAAU,CAC5D,uCAAuC,CAYxC,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,uCAAuC,EAAE,aAAa,CACjE,yCAAyC,CAY1C,CAAC"}
@@ -4,7 +4,18 @@
4
4
  import ExpoIapModule from '../ExpoIapModule';
5
5
  import { ErrorCode } from '../types';
6
6
  import { createPurchaseError, createPurchaseErrorFromNativeException, } from '../utils/errorMapping';
7
- import { Linking } from 'react-native';
7
+ import { Linking, Platform } from 'react-native';
8
+ /**
9
+ * Enforce the documented iOS-only contract. Without this, calling a
10
+ * suffixed wrapper on another platform falls through to the native proxy
11
+ * and surfaces as an opaque `TypeError: ExpoIapModule.<name> is not a
12
+ * function` instead of the promised platform error.
13
+ */
14
+ const requireIosPlatform = (methodName) => {
15
+ if (Platform.OS !== 'ios') {
16
+ throw new Error(`${methodName} is only available on iOS`);
17
+ }
18
+ };
8
19
  // Listeners
9
20
  // Type guards
10
21
  export function isProductIOS(item) {
@@ -27,6 +38,7 @@ export function isProductIOS(item) {
27
38
  * @see {@link https://openiap.dev/docs/apis/ios/sync-ios}
28
39
  */
29
40
  export const syncIOS = async () => {
41
+ requireIosPlatform('syncIOS');
30
42
  return !!(await ExpoIapModule.syncIOS());
31
43
  };
32
44
  /**
@@ -41,6 +53,7 @@ export const syncIOS = async () => {
41
53
  * @see {@link https://openiap.dev/docs/apis/ios/is-eligible-for-intro-offer-ios}
42
54
  */
43
55
  export const isEligibleForIntroOfferIOS = async (groupId) => {
56
+ requireIosPlatform('isEligibleForIntroOfferIOS');
44
57
  if (!groupId) {
45
58
  throw new Error('isEligibleForIntroOfferIOS requires a groupId');
46
59
  }
@@ -58,6 +71,7 @@ export const isEligibleForIntroOfferIOS = async (groupId) => {
58
71
  * @see {@link https://openiap.dev/docs/apis/ios/subscription-status-ios}
59
72
  */
60
73
  export const subscriptionStatusIOS = async (sku) => {
74
+ requireIosPlatform('subscriptionStatusIOS');
61
75
  if (!sku) {
62
76
  throw new Error('subscriptionStatusIOS requires a SKU');
63
77
  }
@@ -76,6 +90,7 @@ export const subscriptionStatusIOS = async (sku) => {
76
90
  * @see {@link https://openiap.dev/docs/apis/ios/current-entitlement-ios}
77
91
  */
78
92
  export const currentEntitlementIOS = async (sku) => {
93
+ requireIosPlatform('currentEntitlementIOS');
79
94
  if (!sku) {
80
95
  throw new Error('currentEntitlementIOS requires a SKU');
81
96
  }
@@ -94,6 +109,7 @@ export const currentEntitlementIOS = async (sku) => {
94
109
  * @see {@link https://openiap.dev/docs/apis/ios/latest-transaction-ios}
95
110
  */
96
111
  export const latestTransactionIOS = async (sku) => {
112
+ requireIosPlatform('latestTransactionIOS');
97
113
  if (!sku) {
98
114
  throw new Error('latestTransactionIOS requires a SKU');
99
115
  }
@@ -112,6 +128,7 @@ export const latestTransactionIOS = async (sku) => {
112
128
  * @see {@link https://openiap.dev/docs/apis/ios/begin-refund-request-ios}
113
129
  */
114
130
  export const beginRefundRequestIOS = async (sku) => {
131
+ requireIosPlatform('beginRefundRequestIOS');
115
132
  if (!sku) {
116
133
  throw new Error('beginRefundRequestIOS requires a SKU');
117
134
  }
@@ -130,6 +147,7 @@ export const beginRefundRequestIOS = async (sku) => {
130
147
  * @see {@link https://openiap.dev/docs/apis/ios/show-manage-subscriptions-ios}
131
148
  */
132
149
  export const showManageSubscriptionsIOS = async () => {
150
+ requireIosPlatform('showManageSubscriptionsIOS');
133
151
  const purchases = await ExpoIapModule.showManageSubscriptionsIOS();
134
152
  return (purchases ?? []);
135
153
  };
@@ -146,6 +164,7 @@ export const showManageSubscriptionsIOS = async () => {
146
164
  * @see {@link https://openiap.dev/docs/apis/ios/get-receipt-data-ios}
147
165
  */
148
166
  export const getReceiptDataIOS = async () => {
167
+ requireIosPlatform('getReceiptDataIOS');
149
168
  return ExpoIapModule.getReceiptDataIOS();
150
169
  };
151
170
  export const getReceiptIOS = getReceiptDataIOS;
@@ -158,12 +177,15 @@ export const getReceiptIOS = getReceiptDataIOS;
158
177
  * alias so consumers who previously imported `getStorefrontIOS` do not break.
159
178
  *
160
179
  * @returns {Promise<string>} ISO 3166-1 alpha-3 country code (e.g. "USA")
180
+ * @throws Error if called on non-iOS platform — Android callers must use the
181
+ * cross-platform `getStorefront` from the main index instead
161
182
  *
162
183
  * @platform iOS
163
184
  *
164
185
  * @see {@link https://openiap.dev/docs/apis/ios/get-storefront-ios}
165
186
  */
166
187
  export const getStorefrontIOS = async () => {
188
+ requireIosPlatform('getStorefrontIOS');
167
189
  if (typeof ExpoIapModule.getStorefront !== 'function') {
168
190
  throw createPurchaseError({
169
191
  code: ErrorCode.FeatureNotSupported,
@@ -203,6 +225,7 @@ export const getStorefrontIOS = async () => {
203
225
  * @platform iOS
204
226
  */
205
227
  export const requestReceiptRefreshIOS = async () => {
228
+ requireIosPlatform('requestReceiptRefreshIOS');
206
229
  return ExpoIapModule.requestReceiptRefreshIOS();
207
230
  };
208
231
  /**
@@ -218,6 +241,7 @@ export const requestReceiptRefreshIOS = async () => {
218
241
  * @see {@link https://openiap.dev/docs/apis/ios/is-transaction-verified-ios}
219
242
  */
220
243
  export const isTransactionVerifiedIOS = async (sku) => {
244
+ requireIosPlatform('isTransactionVerifiedIOS');
221
245
  if (!sku) {
222
246
  throw new Error('isTransactionVerifiedIOS requires a SKU');
223
247
  }
@@ -236,6 +260,7 @@ export const isTransactionVerifiedIOS = async (sku) => {
236
260
  * @see {@link https://openiap.dev/docs/apis/ios/get-transaction-jws-ios}
237
261
  */
238
262
  export const getTransactionJwsIOS = async (sku) => {
263
+ requireIosPlatform('getTransactionJwsIOS');
239
264
  if (!sku) {
240
265
  throw new Error('getTransactionJwsIOS requires a SKU');
241
266
  }
@@ -261,6 +286,7 @@ export const getTransactionJwsIOS = async (sku) => {
261
286
  * @see {@link https://openiap.dev/docs/apis/ios/validate-receipt-ios}
262
287
  */
263
288
  const validateReceiptIOSImpl = async (props) => {
289
+ requireIosPlatform('validateReceiptIOS');
264
290
  const sku = typeof props === 'string'
265
291
  ? props
266
292
  : props?.apple?.sku;
@@ -284,6 +310,7 @@ export const validateReceiptIOS = validateReceiptIOSImpl;
284
310
  * @see {@link https://openiap.dev/docs/apis/ios/present-code-redemption-sheet-ios}
285
311
  */
286
312
  export const presentCodeRedemptionSheetIOS = async () => {
313
+ requireIosPlatform('presentCodeRedemptionSheetIOS');
287
314
  return !!(await ExpoIapModule.presentCodeRedemptionSheetIOS());
288
315
  };
289
316
  /**
@@ -303,6 +330,7 @@ export const presentCodeRedemptionSheetIOS = async () => {
303
330
  * @see {@link https://openiap.dev/docs/apis/ios/get-app-transaction-ios}
304
331
  */
305
332
  export const getAppTransactionIOS = async () => {
333
+ requireIosPlatform('getAppTransactionIOS');
306
334
  return (await ExpoIapModule.getAppTransactionIOS()) ?? null;
307
335
  };
308
336
  /**
@@ -318,6 +346,7 @@ export const getAppTransactionIOS = async () => {
318
346
  * @see {@link https://openiap.dev/docs/apis/ios/get-promoted-product-ios}
319
347
  */
320
348
  export const getPromotedProductIOS = async () => {
349
+ requireIosPlatform('getPromotedProductIOS');
321
350
  const product = await ExpoIapModule.getPromotedProductIOS();
322
351
  return (product ?? null);
323
352
  };
@@ -336,6 +365,7 @@ export const getPromotedProductIOS = async () => {
336
365
  * @see {@link https://openiap.dev/docs/apis/ios/request-purchase-on-promoted-product-ios}
337
366
  */
338
367
  export const requestPurchaseOnPromotedProductIOS = async () => {
368
+ requireIosPlatform('requestPurchaseOnPromotedProductIOS');
339
369
  const result = await ExpoIapModule.requestPurchaseOnPromotedProductIOS();
340
370
  return result ?? true;
341
371
  };
@@ -348,6 +378,7 @@ export const requestPurchaseOnPromotedProductIOS = async () => {
348
378
  * @see {@link https://openiap.dev/docs/apis/ios/get-pending-transactions-ios}
349
379
  */
350
380
  export const getPendingTransactionsIOS = async () => {
381
+ requireIosPlatform('getPendingTransactionsIOS');
351
382
  const transactions = await ExpoIapModule.getPendingTransactionsIOS();
352
383
  return (transactions ?? []);
353
384
  };
@@ -357,6 +388,7 @@ export const getPendingTransactionsIOS = async () => {
357
388
  * @see {@link https://openiap.dev/docs/apis/ios/get-all-transactions-ios}
358
389
  */
359
390
  export const getAllTransactionsIOS = async () => {
391
+ requireIosPlatform('getAllTransactionsIOS');
360
392
  const transactions = await ExpoIapModule.getAllTransactionsIOS();
361
393
  return (transactions ?? []);
362
394
  };
@@ -369,6 +401,7 @@ export const getAllTransactionsIOS = async () => {
369
401
  * @see {@link https://openiap.dev/docs/apis/ios/clear-transaction-ios}
370
402
  */
371
403
  export const clearTransactionIOS = async () => {
404
+ requireIosPlatform('clearTransactionIOS');
372
405
  return !!(await ExpoIapModule.clearTransactionIOS());
373
406
  };
374
407
  /**
@@ -391,6 +424,7 @@ export const deepLinkToSubscriptionsIOS = () => Linking.openURL('https://apps.ap
391
424
  * @see {@link https://openiap.dev/docs/apis/ios/can-present-external-purchase-notice-ios}
392
425
  */
393
426
  export const canPresentExternalPurchaseNoticeIOS = async () => {
427
+ requireIosPlatform('canPresentExternalPurchaseNoticeIOS');
394
428
  return !!(await ExpoIapModule.canPresentExternalPurchaseNoticeIOS());
395
429
  };
396
430
  /**
@@ -404,6 +438,7 @@ export const canPresentExternalPurchaseNoticeIOS = async () => {
404
438
  * @see {@link https://openiap.dev/docs/apis/ios/present-external-purchase-notice-sheet-ios}
405
439
  */
406
440
  export const presentExternalPurchaseNoticeSheetIOS = async () => {
441
+ requireIosPlatform('presentExternalPurchaseNoticeSheetIOS');
407
442
  const result = await ExpoIapModule.presentExternalPurchaseNoticeSheetIOS();
408
443
  return result;
409
444
  };
@@ -417,6 +452,7 @@ export const presentExternalPurchaseNoticeSheetIOS = async () => {
417
452
  * @see {@link https://openiap.dev/docs/apis/ios/present-external-purchase-link-ios}
418
453
  */
419
454
  export const presentExternalPurchaseLinkIOS = async (url) => {
455
+ requireIosPlatform('presentExternalPurchaseLinkIOS');
420
456
  const result = await ExpoIapModule.presentExternalPurchaseLinkIOS(url);
421
457
  return result;
422
458
  };
@@ -431,6 +467,7 @@ export const presentExternalPurchaseLinkIOS = async (url) => {
431
467
  * @see {@link https://openiap.dev/docs/apis/ios/is-eligible-for-external-purchase-custom-link-ios}
432
468
  */
433
469
  export const isEligibleForExternalPurchaseCustomLinkIOS = async () => {
470
+ requireIosPlatform('isEligibleForExternalPurchaseCustomLinkIOS');
434
471
  return !!(await ExpoIapModule.isEligibleForExternalPurchaseCustomLinkIOS());
435
472
  };
436
473
  /**
@@ -445,6 +482,7 @@ export const isEligibleForExternalPurchaseCustomLinkIOS = async () => {
445
482
  * @see {@link https://openiap.dev/docs/apis/ios/get-external-purchase-custom-link-token-ios}
446
483
  */
447
484
  export const getExternalPurchaseCustomLinkTokenIOS = async (tokenType) => {
485
+ requireIosPlatform('getExternalPurchaseCustomLinkTokenIOS');
448
486
  if (!tokenType) {
449
487
  throw new Error("getExternalPurchaseCustomLinkTokenIOS requires a tokenType ('acquisition' or 'services')");
450
488
  }
@@ -464,6 +502,7 @@ export const getExternalPurchaseCustomLinkTokenIOS = async (tokenType) => {
464
502
  * @see {@link https://openiap.dev/docs/apis/ios/show-external-purchase-custom-link-notice-ios}
465
503
  */
466
504
  export const showExternalPurchaseCustomLinkNoticeIOS = async (noticeType) => {
505
+ requireIosPlatform('showExternalPurchaseCustomLinkNoticeIOS');
467
506
  if (!noticeType) {
468
507
  throw new Error("showExternalPurchaseCustomLinkNoticeIOS requires a noticeType ('browser')");
469
508
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ios.js","sourceRoot":"","sources":["../../src/modules/ios.ts"],"names":[],"mappings":"AAAA,wBAAwB;AAExB,mBAAmB;AACnB,mEAAmE;AACnE,OAAO,aAAa,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAC,SAAS,EAAC,MAAM,UAAU,CAAC;AAiBnC,OAAO,EACL,mBAAmB,EACnB,sCAAsC,GAEvC,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAC,OAAO,EAAC,MAAM,cAAc,CAAC;AAOrC,YAAY;AAEZ,cAAc;AACd,MAAM,UAAU,YAAY,C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n// import removed: use purchaseUpdatedListener directly in app code\nimport ExpoIapModule from '../ExpoIapModule';\nimport {ErrorCode} from '../types';\n\n// Types\nimport type {\n ExternalPurchaseCustomLinkNoticeResultIOS,\n ExternalPurchaseCustomLinkTokenResultIOS,\n ExternalPurchaseLinkResultIOS,\n ExternalPurchaseNoticeResultIOS,\n MutationField,\n ProductIOS,\n Purchase,\n PurchaseIOS,\n QueryField,\n VerifyPurchaseProps,\n VerifyPurchaseResultIOS,\n SubscriptionStatusIOS,\n} from '../types';\nimport {\n createPurchaseError,\n createPurchaseErrorFromNativeException,\n type PurchaseError,\n} from '../utils/errorMapping';\nimport {Linking} from 'react-native';\n\nexport type TransactionEvent = {\n transaction?: Purchase;\n error?: PurchaseError;\n};\n\n// Listeners\n\n// Type guards\nexport function isProductIOS<T extends {platform?: string}>(\n item: unknown,\n): item is T & {platform: 'ios'} {\n return (\n item != null &&\n typeof item === 'object' &&\n 'platform' in item &&\n typeof (item as any).platform === 'string' &&\n (item as any).platform.toLowerCase() === 'ios'\n );\n}\n\n// Functions\n/**\n * Sync state with Appstore (iOS only)\n * https://developer.apple.com/documentation/storekit/appstore/3791906-sync\n *\n * @returns Promise resolving to null on success\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n *\n * @see {@link https://openiap.dev/docs/apis/ios/sync-ios}\n */\nexport const syncIOS: MutationField<'syncIOS'> = async () => {\n return !!(await ExpoIapModule.syncIOS());\n};\n\n/**\n * Check if user is eligible for introductory offer\n *\n * @param groupId - The subscription group ID\n * @returns Promise resolving to true if eligible\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n *\n * @see {@link https://openiap.dev/docs/apis/ios/is-eligible-for-intro-offer-ios}\n */\nexport const isEligibleForIntroOfferIOS: QueryField<\n 'isEligibleForIntroOfferIOS'\n> = async (groupId) => {\n if (!groupId) {\n throw new Error('isEligibleForIntroOfferIOS requires a groupId');\n }\n return ExpoIapModule.isEligibleForIntroOfferIOS(groupId);\n};\n\n/**\n * Get subscription status for a specific SKU\n *\n * @param sku The product SKU\n * @returns Promise resolving to array of subscription status\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n *\n * @see {@link https://openiap.dev/docs/apis/ios/subscription-status-ios}\n */\nexport const subscriptionStatusIOS: QueryField<\n 'subscriptionStatusIOS'\n> = async (sku) => {\n if (!sku) {\n throw new Error('subscriptionStatusIOS requires a SKU');\n }\n const status = await ExpoIapModule.subscriptionStatusIOS(sku);\n return (status ?? []) as SubscriptionStatusIOS[];\n};\n\n/**\n * Get current entitlement for a specific SKU\n *\n * @param sku The product SKU\n * @returns Promise resolving to current entitlement\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n *\n * @see {@link https://openiap.dev/docs/apis/ios/current-entitlement-ios}\n */\nexport const currentEntitlementIOS: QueryField<\n 'currentEntitlementIOS'\n> = async (sku) => {\n if (!sku) {\n throw new Error('currentEntitlementIOS requires a SKU');\n }\n const purchase = await ExpoIapModule.currentEntitlementIOS(sku);\n return (purchase ?? null) as PurchaseIOS | null;\n};\n\n/**\n * Get latest transaction for a specific SKU\n *\n * @param sku The product SKU\n * @returns Promise resolving to latest transaction\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n *\n * @see {@link https://openiap.dev/docs/apis/ios/latest-transaction-ios}\n */\nexport const latestTransactionIOS: QueryField<'latestTransactionIOS'> = async (\n sku,\n) => {\n if (!sku) {\n throw new Error('latestTransactionIOS requires a SKU');\n }\n const transaction = await ExpoIapModule.latestTransactionIOS(sku);\n return (transaction ?? null) as PurchaseIOS | null;\n};\n\n/**\n * Begin refund request for a specific SKU\n *\n * @param sku The product SKU\n * @returns Promise resolving to refund request status\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n *\n * @see {@link https://openiap.dev/docs/apis/ios/begin-refund-request-ios}\n */\nexport const beginRefundRequestIOS: MutationField<\n 'beginRefundRequestIOS'\n> = async (sku) => {\n if (!sku) {\n throw new Error('beginRefundRequestIOS requires a SKU');\n }\n const status = await ExpoIapModule.beginRefundRequestIOS(sku);\n return status ?? null;\n};\n\n/**\n * Shows the system UI for managing subscriptions.\n * Returns an array of subscriptions that had status changes after the UI is closed.\n *\n * @returns Promise<Purchase[]> - Array of subscriptions with status changes (e.g., auto-renewal toggled)\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n *\n * @see {@link https://openiap.dev/docs/apis/ios/show-manage-subscriptions-ios}\n */\nexport const showManageSubscriptionsIOS: MutationField<\n 'showManageSubscriptionsIOS'\n> = async () => {\n const purchases = await ExpoIapModule.showManageSubscriptionsIOS();\n return (purchases ?? []) as PurchaseIOS[];\n};\n\n/**\n * Get the receipt data from the iOS device.\n * This returns the base64 encoded receipt data which can be sent to your server\n * for verification with Apple's server.\n *\n * NOTE: For proper security, always verify receipts on your server using\n * Apple's verifyReceipt endpoint, not directly from the app.\n *\n * @returns {Promise<string>} Base64 encoded receipt data\n *\n * @see {@link https://openiap.dev/docs/apis/ios/get-receipt-data-ios}\n */\nexport const getReceiptDataIOS: QueryField<'getReceiptDataIOS'> = async () => {\n return ExpoIapModule.getReceiptDataIOS();\n};\n\nexport const getReceiptIOS = getReceiptDataIOS;\n\n/**\n * Get the current App Store storefront country code on iOS.\n *\n * @deprecated Use cross-platform `getStorefront` from the main index instead.\n * The native module exposes a single `getStorefront` AsyncFunction that already\n * resolves to the iOS storefront on iOS. This helper is kept as an iOS-only\n * alias so consumers who previously imported `getStorefrontIOS` do not break.\n *\n * @returns {Promise<string>} ISO 3166-1 alpha-3 country code (e.g. \"USA\")\n *\n * @platform iOS\n *\n * @see {@link https://openiap.dev/docs/apis/ios/get-storefront-ios}\n */\nexport const getStorefrontIOS: QueryField<'getStorefrontIOS'> = async () => {\n if (typeof ExpoIapModule.getStorefront !== 'function') {\n throw createPurchaseError({\n code: ErrorCode.FeatureNotSupported,\n message: 'Native getStorefront is not available on this build.',\n platform: 'ios',\n });\n }\n\n let storefront: unknown;\n try {\n storefront = await ExpoIapModule.getStorefront();\n } catch (error) {\n throw createPurchaseErrorFromNativeException(error, 'ios', {\n code: ErrorCode.ServiceError,\n message: 'Failed to get storefront.',\n debugMessage: error instanceof Error ? error.message : String(error),\n });\n }\n\n if (typeof storefront !== 'string' || storefront.trim().length === 0) {\n throw createPurchaseError({\n code: ErrorCode.ServiceError,\n message: 'Storefront lookup returned no country code.',\n platform: 'ios',\n });\n }\n return storefront;\n};\n\n/**\n * Refresh the receipt data from Apple's servers and return the updated receipt.\n * This calls AppStore.sync() before reading the receipt, ensuring the latest\n * receipt data is available. Use this after a first purchase when\n * getReceiptDataIOS() may return an empty string because the receipt file\n * has not yet been written to disk.\n *\n * @returns {Promise<string>} Base64 encoded receipt data\n *\n * @platform iOS\n */\nexport const requestReceiptRefreshIOS = async (): Promise<string> => {\n return ExpoIapModule.requestReceiptRefreshIOS();\n};\n\n/**\n * Check if a transaction is verified through StoreKit 2.\n * StoreKit 2 performs local verification of transaction JWS signatures.\n *\n * @param sku The product's SKU (on iOS)\n * @returns Promise resolving to true if the transaction is verified\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n *\n * @see {@link https://openiap.dev/docs/apis/ios/is-transaction-verified-ios}\n */\nexport const isTransactionVerifiedIOS: QueryField<\n 'isTransactionVerifiedIOS'\n> = async (sku) => {\n if (!sku) {\n throw new Error('isTransactionVerifiedIOS requires a SKU');\n }\n return ExpoIapModule.isTransactionVerifiedIOS(sku);\n};\n\n/**\n * Get the JWS representation of a purchase for server-side verification.\n * The JWS (JSON Web Signature) can be verified on your server using Apple's public keys.\n *\n * @param sku The product's SKU (on iOS)\n * @returns Promise resolving to JWS representation of the transaction\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n *\n * @see {@link https://openiap.dev/docs/apis/ios/get-transaction-jws-ios}\n */\nexport const getTransactionJwsIOS: QueryField<'getTransactionJwsIOS'> = async (\n sku,\n) => {\n if (!sku) {\n throw new Error('getTransactionJwsIOS requires a SKU');\n }\n const jws = await ExpoIapModule.getTransactionJwsIOS(sku);\n return jws ?? '';\n};\n\n/**\n * Validate receipt for iOS using StoreKit 2's built-in verification.\n * Returns receipt data and verification information to help with server-side validation.\n *\n * NOTE: For proper security, Apple recommends verifying receipts on your server using\n * the verifyReceipt endpoint rather than relying solely on client-side verification.\n *\n * @deprecated Use verifyPurchase instead\n * @param props The product's SKU or verification props\n * @returns {Promise<{\n * isValid: boolean;\n * receiptData: string;\n * jwsRepresentation: string;\n * latestTransaction?: Purchase;\n * }>}\n *\n * @see {@link https://openiap.dev/docs/apis/ios/validate-receipt-ios}\n */\nconst validateReceiptIOSImpl = async (props: VerifyPurchaseProps | string) => {\n const sku =\n typeof props === 'string'\n ? props\n : (props as VerifyPurchaseProps)?.apple?.sku;\n\n if (!sku) {\n throw new Error('validateReceiptIOS requires a SKU (via apple.sku)');\n }\n\n return (await ExpoIapModule.validateReceiptIOS(\n sku,\n )) as VerifyPurchaseResultIOS;\n};\n\nexport const validateReceiptIOS =\n validateReceiptIOSImpl as QueryField<'validateReceiptIOS'>;\n\n/**\n * Present the code redemption sheet for offer codes (iOS only).\n * This allows users to redeem promotional codes for in-app purchases and subscriptions.\n *\n * Note: This only works on real devices, not simulators.\n *\n * @returns Promise resolving to true if the sheet was presented successfully\n * @throws Error if called on non-iOS platform or tvOS\n *\n * @platform iOS\n *\n * @see {@link https://openiap.dev/docs/apis/ios/present-code-redemption-sheet-ios}\n */\nexport const presentCodeRedemptionSheetIOS: MutationField<\n 'presentCodeRedemptionSheetIOS'\n> = async () => {\n return !!(await ExpoIapModule.presentCodeRedemptionSheetIOS());\n};\n\n/**\n * Get app transaction information (iOS 16.0+).\n * AppTransaction represents the initial purchase that unlocked the app.\n *\n * NOTE: This function requires:\n * - iOS 16.0 or later at runtime\n * - Xcode 15.0+ with iOS 16.0 SDK for compilation\n *\n * @returns Promise resolving to the app transaction information or null if not available\n * @throws Error if called on non-iOS platform, iOS version < 16.0, or compiled with older SDK\n *\n * @platform iOS\n * @since iOS 16.0\n *\n * @see {@link https://openiap.dev/docs/apis/ios/get-app-transaction-ios}\n */\nexport const getAppTransactionIOS: QueryField<\n 'getAppTransactionIOS'\n> = async () => {\n return (await ExpoIapModule.getAppTransactionIOS()) ?? null;\n};\n\n/**\n * Get information about a promoted product if one is available (iOS only).\n * Promoted products are products that the App Store promotes on your behalf.\n * This is called after a promoted product event is received from the App Store.\n *\n * @returns Promise resolving to the promoted product information or null if none available\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n *\n * @see {@link https://openiap.dev/docs/apis/ios/get-promoted-product-ios}\n */\nexport const getPromotedProductIOS: QueryField<\n 'getPromotedProductIOS'\n> = async () => {\n const product = await ExpoIapModule.getPromotedProductIOS();\n return (product ?? null) as ProductIOS | null;\n};\n\n/**\n * Complete the purchase of a promoted product (iOS only).\n * This should be called after showing your purchase UI for a promoted product.\n *\n * @deprecated Use promotedProductListenerIOS to receive the productId,\n * then call requestPurchase with that SKU instead.\n *\n * @returns Promise resolving when the purchase is initiated\n * @throws Error if called on non-iOS platform or no promoted product is available\n *\n * @platform iOS\n *\n * @see {@link https://openiap.dev/docs/apis/ios/request-purchase-on-promoted-product-ios}\n */\nexport const requestPurchaseOnPromotedProductIOS: MutationField<\n 'requestPurchaseOnPromotedProductIOS'\n> = async () => {\n const result = await ExpoIapModule.requestPurchaseOnPromotedProductIOS();\n return result ?? true;\n};\n\n/**\n * Get pending transactions that haven't been finished yet (iOS only).\n *\n * @returns Promise resolving to array of pending transactions\n * @platform iOS\n *\n * @see {@link https://openiap.dev/docs/apis/ios/get-pending-transactions-ios}\n */\nexport const getPendingTransactionsIOS: QueryField<\n 'getPendingTransactionsIOS'\n> = async () => {\n const transactions = await ExpoIapModule.getPendingTransactionsIOS();\n return (transactions ?? []) as PurchaseIOS[];\n};\n\n/**\n * List every StoreKit transaction (finished + unfinished) for the current user.\n *\n * @see {@link https://openiap.dev/docs/apis/ios/get-all-transactions-ios}\n */\nexport const getAllTransactionsIOS: QueryField<\n 'getAllTransactionsIOS'\n> = async () => {\n const transactions = await ExpoIapModule.getAllTransactionsIOS();\n return (transactions ?? []) as PurchaseIOS[];\n};\n\n/**\n * Clear a specific transaction (iOS only).\n *\n * @returns Promise resolving when transaction is cleared\n * @platform iOS\n *\n * @see {@link https://openiap.dev/docs/apis/ios/clear-transaction-ios}\n */\nexport const clearTransactionIOS: MutationField<\n 'clearTransactionIOS'\n> = async () => {\n return !!(await ExpoIapModule.clearTransactionIOS());\n};\n\n/**\n * Deep link to subscriptions screen on iOS.\n * @returns {Promise<void>}\n *\n * @platform iOS\n */\nexport const deepLinkToSubscriptionsIOS = (): Promise<void> =>\n Linking.openURL('https://apps.apple.com/account/subscriptions');\n\n/**\n * Check if the device can present an external purchase notice sheet (iOS 17.4+).\n *\n * Wraps `ExternalPurchase.canPresent`, which Apple introduced in iOS 17.4.\n * Note: the notice sheet itself (`presentExternalPurchaseNoticeSheetIOS`)\n * still requires iOS 18.2+; only the eligibility check is available earlier.\n *\n * @returns Promise resolving to true if the notice sheet can be presented\n * @platform iOS\n *\n * @see {@link https://openiap.dev/docs/apis/ios/can-present-external-purchase-notice-ios}\n */\nexport const canPresentExternalPurchaseNoticeIOS: QueryField<\n 'canPresentExternalPurchaseNoticeIOS'\n> = async () => {\n return !!(await ExpoIapModule.canPresentExternalPurchaseNoticeIOS());\n};\n\n/**\n * Present an external purchase notice sheet to inform users about external purchases (iOS 15.4+).\n * This must be called before opening an external purchase link.\n * Returns the external purchase token when user continues.\n *\n * @returns Promise resolving to the result with action, token, and error if any\n * @platform iOS\n *\n * @see {@link https://openiap.dev/docs/apis/ios/present-external-purchase-notice-sheet-ios}\n */\nexport const presentExternalPurchaseNoticeSheetIOS: MutationField<\n 'presentExternalPurchaseNoticeSheetIOS'\n> = async () => {\n const result = await ExpoIapModule.presentExternalPurchaseNoticeSheetIOS();\n return result as ExternalPurchaseNoticeResultIOS;\n};\n\n/**\n * Present an external purchase link to redirect users to your website (iOS 16.0+).\n *\n * @param url - The external purchase URL to open\n * @returns Promise resolving to the result with success status and error if any\n * @platform iOS\n *\n * @see {@link https://openiap.dev/docs/apis/ios/present-external-purchase-link-ios}\n */\nexport const presentExternalPurchaseLinkIOS: MutationField<\n 'presentExternalPurchaseLinkIOS'\n> = async (url: string) => {\n const result = await ExpoIapModule.presentExternalPurchaseLinkIOS(url);\n return result as ExternalPurchaseLinkResultIOS;\n};\n\n/**\n * Check if app is eligible for ExternalPurchaseCustomLink API (iOS 18.1+).\n * Returns true if the app can use custom external purchase links.\n *\n * @returns Promise resolving to true if eligible\n * @platform iOS\n * @see https://developer.apple.com/documentation/storekit/externalpurchasecustomlink/iseligible\n *\n * @see {@link https://openiap.dev/docs/apis/ios/is-eligible-for-external-purchase-custom-link-ios}\n */\nexport const isEligibleForExternalPurchaseCustomLinkIOS: QueryField<\n 'isEligibleForExternalPurchaseCustomLinkIOS'\n> = async () => {\n return !!(await ExpoIapModule.isEligibleForExternalPurchaseCustomLinkIOS());\n};\n\n/**\n * Get external purchase token for reporting to Apple (iOS 18.1+).\n * Use this token with Apple's External Purchase Server API to report transactions.\n *\n * @param tokenType - Token type: 'acquisition' (new customers) or 'services' (existing customers)\n * @returns Promise resolving to the token result with token string or error\n * @platform iOS\n * @see https://developer.apple.com/documentation/storekit/externalpurchasecustomlink/token(for:)\n *\n * @see {@link https://openiap.dev/docs/apis/ios/get-external-purchase-custom-link-token-ios}\n */\nexport const getExternalPurchaseCustomLinkTokenIOS: QueryField<\n 'getExternalPurchaseCustomLinkTokenIOS'\n> = async (tokenType) => {\n if (!tokenType) {\n throw new Error(\n \"getExternalPurchaseCustomLinkTokenIOS requires a tokenType ('acquisition' or 'services')\",\n );\n }\n const result = await ExpoIapModule.getExternalPurchaseCustomLinkTokenIOS(\n tokenType,\n );\n return result as ExternalPurchaseCustomLinkTokenResultIOS;\n};\n\n/**\n * Show ExternalPurchaseCustomLink notice sheet (iOS 18.1+).\n * Displays the system disclosure notice sheet for custom external purchase links.\n * Call this after a deliberate customer interaction before linking out to external purchases.\n *\n * @param noticeType - Notice type: 'browser' (external purchases displayed in browser)\n * @returns Promise resolving to the result with continued status and error if any\n * @platform iOS\n * @see https://developer.apple.com/documentation/storekit/externalpurchasecustomlink/shownotice(type:)\n *\n * @see {@link https://openiap.dev/docs/apis/ios/show-external-purchase-custom-link-notice-ios}\n */\nexport const showExternalPurchaseCustomLinkNoticeIOS: MutationField<\n 'showExternalPurchaseCustomLinkNoticeIOS'\n> = async (noticeType) => {\n if (!noticeType) {\n throw new Error(\n \"showExternalPurchaseCustomLinkNoticeIOS requires a noticeType ('browser')\",\n );\n }\n const result = await ExpoIapModule.showExternalPurchaseCustomLinkNoticeIOS(\n noticeType,\n );\n return result as ExternalPurchaseCustomLinkNoticeResultIOS;\n};\n\n// iOS-specific APIs only; cross-platform wrappers live in src/index.ts\n"]}
1
+ {"version":3,"file":"ios.js","sourceRoot":"","sources":["../../src/modules/ios.ts"],"names":[],"mappings":"AAAA,wBAAwB;AAExB,mBAAmB;AACnB,mEAAmE;AACnE,OAAO,aAAa,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAC,SAAS,EAAC,MAAM,UAAU,CAAC;AAiBnC,OAAO,EACL,mBAAmB,EACnB,sCAAsC,GAEvC,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAC,OAAO,EAAE,QAAQ,EAAC,MAAM,cAAc,CAAC;AAE/C;;;;;GAKG;AACH,MAAM,kBAAkB,GAAG,CAAC,UAAkB,EAAQ,EAAE;IACtD,IAAI,QAAQ,CAAC,EAAE,KAAK,KAAK,EAAE,CAAC;QAC1B,MAAM,IAAI,KAAK,CAAC,GAAG,UAAU,2BAA2B,CAAC,CAAC;IAC5D,CAAC;AACH,CAAC,CAAC;AAOF,YAAY;AAEZ,cAAc;AACd,MAAM,UAAU,YAAY,CAC1B,IAAa;IAEb,OAAO,CACL,IAAI,IAAI,IAAI;QACZ,OAAO,IAAI,KAAK,QAAQ;QACxB,UAAU,IAAI,IAAI;QAClB,OAAQ,IAAY,CAAC,QAAQ,KAAK,QAAQ;QACzC,IAAY,CAA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,CAAC,MAAM,0CAA0C,GAEnD,KAAK,IAAI,EAAE;IACb,kBAAkB,CAAC,4CAA4C,CAAC,CAAC;IACjE,OAAO,CAAC,CAAC,CAAC,MAAM,aAAa,CAAC,0CAA0C,EAAE,CAAC,CAAC;AAC9E,CAAC,CAAC;AAEF;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,qCAAqC,GAE9C,KAAK,EAAE,SAAS,EAAE,EAAE;IACtB,kBAAkB,CAAC,uCAAuC,CAAC,CAAC;IAC5D,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CACb,0FAA0F,CAC3F,CAAC;IACJ,CAAC;IACD,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC,qCAAqC,CACtE,SAAS,CACV,CAAC;IACF,OAAO,MAAkD,CAAC;AAC5D,CAAC,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,uCAAuC,GAEhD,KAAK,EAAE,UAAU,EAAE,EAAE;IACvB,kBAAkB,CAAC,yCAAyC,CAAC,CAAC;IAC9D,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,MAAM,IAAI,KAAK,CACb,2EAA2E,CAC5E,CAAC;IACJ,CAAC;IACD,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC,uCAAuC,CACxE,UAAU,CACX,CAAC;IACF,OAAO,MAAmD,CAAC;AAC7D,CAAC,CAAC;AAEF,uEAAuE","sourcesContent":["// External dependencies\n\n// Internal modules\n// import removed: use purchaseUpdatedListener directly in app code\nimport ExpoIapModule from '../ExpoIapModule';\nimport {ErrorCode} from '../types';\n\n// Types\nimport type {\n ExternalPurchaseCustomLinkNoticeResultIOS,\n ExternalPurchaseCustomLinkTokenResultIOS,\n ExternalPurchaseLinkResultIOS,\n ExternalPurchaseNoticeResultIOS,\n MutationField,\n ProductIOS,\n Purchase,\n PurchaseIOS,\n QueryField,\n VerifyPurchaseProps,\n VerifyPurchaseResultIOS,\n SubscriptionStatusIOS,\n} from '../types';\nimport {\n createPurchaseError,\n createPurchaseErrorFromNativeException,\n type PurchaseError,\n} from '../utils/errorMapping';\nimport {Linking, Platform} from 'react-native';\n\n/**\n * Enforce the documented iOS-only contract. Without this, calling a\n * suffixed wrapper on another platform falls through to the native proxy\n * and surfaces as an opaque `TypeError: ExpoIapModule.<name> is not a\n * function` instead of the promised platform error.\n */\nconst requireIosPlatform = (methodName: string): void => {\n if (Platform.OS !== 'ios') {\n throw new Error(`${methodName} is only available on iOS`);\n }\n};\n\nexport type TransactionEvent = {\n transaction?: Purchase;\n error?: PurchaseError;\n};\n\n// Listeners\n\n// Type guards\nexport function isProductIOS<T extends {platform?: string}>(\n item: unknown,\n): item is T & {platform: 'ios'} {\n return (\n item != null &&\n typeof item === 'object' &&\n 'platform' in item &&\n typeof (item as any).platform === 'string' &&\n (item as any).platform.toLowerCase() === 'ios'\n );\n}\n\n// Functions\n/**\n * Sync state with Appstore (iOS only)\n * https://developer.apple.com/documentation/storekit/appstore/3791906-sync\n *\n * @returns Promise resolving to null on success\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n *\n * @see {@link https://openiap.dev/docs/apis/ios/sync-ios}\n */\nexport const syncIOS: MutationField<'syncIOS'> = async () => {\n requireIosPlatform('syncIOS');\n return !!(await ExpoIapModule.syncIOS());\n};\n\n/**\n * Check if user is eligible for introductory offer\n *\n * @param groupId - The subscription group ID\n * @returns Promise resolving to true if eligible\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n *\n * @see {@link https://openiap.dev/docs/apis/ios/is-eligible-for-intro-offer-ios}\n */\nexport const isEligibleForIntroOfferIOS: QueryField<\n 'isEligibleForIntroOfferIOS'\n> = async (groupId) => {\n requireIosPlatform('isEligibleForIntroOfferIOS');\n if (!groupId) {\n throw new Error('isEligibleForIntroOfferIOS requires a groupId');\n }\n return ExpoIapModule.isEligibleForIntroOfferIOS(groupId);\n};\n\n/**\n * Get subscription status for a specific SKU\n *\n * @param sku The product SKU\n * @returns Promise resolving to array of subscription status\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n *\n * @see {@link https://openiap.dev/docs/apis/ios/subscription-status-ios}\n */\nexport const subscriptionStatusIOS: QueryField<\n 'subscriptionStatusIOS'\n> = async (sku) => {\n requireIosPlatform('subscriptionStatusIOS');\n if (!sku) {\n throw new Error('subscriptionStatusIOS requires a SKU');\n }\n const status = await ExpoIapModule.subscriptionStatusIOS(sku);\n return (status ?? []) as SubscriptionStatusIOS[];\n};\n\n/**\n * Get current entitlement for a specific SKU\n *\n * @param sku The product SKU\n * @returns Promise resolving to current entitlement\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n *\n * @see {@link https://openiap.dev/docs/apis/ios/current-entitlement-ios}\n */\nexport const currentEntitlementIOS: QueryField<\n 'currentEntitlementIOS'\n> = async (sku) => {\n requireIosPlatform('currentEntitlementIOS');\n if (!sku) {\n throw new Error('currentEntitlementIOS requires a SKU');\n }\n const purchase = await ExpoIapModule.currentEntitlementIOS(sku);\n return (purchase ?? null) as PurchaseIOS | null;\n};\n\n/**\n * Get latest transaction for a specific SKU\n *\n * @param sku The product SKU\n * @returns Promise resolving to latest transaction\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n *\n * @see {@link https://openiap.dev/docs/apis/ios/latest-transaction-ios}\n */\nexport const latestTransactionIOS: QueryField<'latestTransactionIOS'> = async (\n sku,\n) => {\n requireIosPlatform('latestTransactionIOS');\n if (!sku) {\n throw new Error('latestTransactionIOS requires a SKU');\n }\n const transaction = await ExpoIapModule.latestTransactionIOS(sku);\n return (transaction ?? null) as PurchaseIOS | null;\n};\n\n/**\n * Begin refund request for a specific SKU\n *\n * @param sku The product SKU\n * @returns Promise resolving to refund request status\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n *\n * @see {@link https://openiap.dev/docs/apis/ios/begin-refund-request-ios}\n */\nexport const beginRefundRequestIOS: MutationField<\n 'beginRefundRequestIOS'\n> = async (sku) => {\n requireIosPlatform('beginRefundRequestIOS');\n if (!sku) {\n throw new Error('beginRefundRequestIOS requires a SKU');\n }\n const status = await ExpoIapModule.beginRefundRequestIOS(sku);\n return status ?? null;\n};\n\n/**\n * Shows the system UI for managing subscriptions.\n * Returns an array of subscriptions that had status changes after the UI is closed.\n *\n * @returns Promise<Purchase[]> - Array of subscriptions with status changes (e.g., auto-renewal toggled)\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n *\n * @see {@link https://openiap.dev/docs/apis/ios/show-manage-subscriptions-ios}\n */\nexport const showManageSubscriptionsIOS: MutationField<\n 'showManageSubscriptionsIOS'\n> = async () => {\n requireIosPlatform('showManageSubscriptionsIOS');\n const purchases = await ExpoIapModule.showManageSubscriptionsIOS();\n return (purchases ?? []) as PurchaseIOS[];\n};\n\n/**\n * Get the receipt data from the iOS device.\n * This returns the base64 encoded receipt data which can be sent to your server\n * for verification with Apple's server.\n *\n * NOTE: For proper security, always verify receipts on your server using\n * Apple's verifyReceipt endpoint, not directly from the app.\n *\n * @returns {Promise<string>} Base64 encoded receipt data\n *\n * @see {@link https://openiap.dev/docs/apis/ios/get-receipt-data-ios}\n */\nexport const getReceiptDataIOS: QueryField<'getReceiptDataIOS'> = async () => {\n requireIosPlatform('getReceiptDataIOS');\n return ExpoIapModule.getReceiptDataIOS();\n};\n\nexport const getReceiptIOS = getReceiptDataIOS;\n\n/**\n * Get the current App Store storefront country code on iOS.\n *\n * @deprecated Use cross-platform `getStorefront` from the main index instead.\n * The native module exposes a single `getStorefront` AsyncFunction that already\n * resolves to the iOS storefront on iOS. This helper is kept as an iOS-only\n * alias so consumers who previously imported `getStorefrontIOS` do not break.\n *\n * @returns {Promise<string>} ISO 3166-1 alpha-3 country code (e.g. \"USA\")\n * @throws Error if called on non-iOS platform — Android callers must use the\n * cross-platform `getStorefront` from the main index instead\n *\n * @platform iOS\n *\n * @see {@link https://openiap.dev/docs/apis/ios/get-storefront-ios}\n */\nexport const getStorefrontIOS: QueryField<'getStorefrontIOS'> = async () => {\n requireIosPlatform('getStorefrontIOS');\n if (typeof ExpoIapModule.getStorefront !== 'function') {\n throw createPurchaseError({\n code: ErrorCode.FeatureNotSupported,\n message: 'Native getStorefront is not available on this build.',\n platform: 'ios',\n });\n }\n\n let storefront: unknown;\n try {\n storefront = await ExpoIapModule.getStorefront();\n } catch (error) {\n throw createPurchaseErrorFromNativeException(error, 'ios', {\n code: ErrorCode.ServiceError,\n message: 'Failed to get storefront.',\n debugMessage: error instanceof Error ? error.message : String(error),\n });\n }\n\n if (typeof storefront !== 'string' || storefront.trim().length === 0) {\n throw createPurchaseError({\n code: ErrorCode.ServiceError,\n message: 'Storefront lookup returned no country code.',\n platform: 'ios',\n });\n }\n return storefront;\n};\n\n/**\n * Refresh the receipt data from Apple's servers and return the updated receipt.\n * This calls AppStore.sync() before reading the receipt, ensuring the latest\n * receipt data is available. Use this after a first purchase when\n * getReceiptDataIOS() may return an empty string because the receipt file\n * has not yet been written to disk.\n *\n * @returns {Promise<string>} Base64 encoded receipt data\n *\n * @platform iOS\n */\nexport const requestReceiptRefreshIOS = async (): Promise<string> => {\n requireIosPlatform('requestReceiptRefreshIOS');\n return ExpoIapModule.requestReceiptRefreshIOS();\n};\n\n/**\n * Check if a transaction is verified through StoreKit 2.\n * StoreKit 2 performs local verification of transaction JWS signatures.\n *\n * @param sku The product's SKU (on iOS)\n * @returns Promise resolving to true if the transaction is verified\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n *\n * @see {@link https://openiap.dev/docs/apis/ios/is-transaction-verified-ios}\n */\nexport const isTransactionVerifiedIOS: QueryField<\n 'isTransactionVerifiedIOS'\n> = async (sku) => {\n requireIosPlatform('isTransactionVerifiedIOS');\n if (!sku) {\n throw new Error('isTransactionVerifiedIOS requires a SKU');\n }\n return ExpoIapModule.isTransactionVerifiedIOS(sku);\n};\n\n/**\n * Get the JWS representation of a purchase for server-side verification.\n * The JWS (JSON Web Signature) can be verified on your server using Apple's public keys.\n *\n * @param sku The product's SKU (on iOS)\n * @returns Promise resolving to JWS representation of the transaction\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n *\n * @see {@link https://openiap.dev/docs/apis/ios/get-transaction-jws-ios}\n */\nexport const getTransactionJwsIOS: QueryField<'getTransactionJwsIOS'> = async (\n sku,\n) => {\n requireIosPlatform('getTransactionJwsIOS');\n if (!sku) {\n throw new Error('getTransactionJwsIOS requires a SKU');\n }\n const jws = await ExpoIapModule.getTransactionJwsIOS(sku);\n return jws ?? '';\n};\n\n/**\n * Validate receipt for iOS using StoreKit 2's built-in verification.\n * Returns receipt data and verification information to help with server-side validation.\n *\n * NOTE: For proper security, Apple recommends verifying receipts on your server using\n * the verifyReceipt endpoint rather than relying solely on client-side verification.\n *\n * @deprecated Use verifyPurchase instead\n * @param props The product's SKU or verification props\n * @returns {Promise<{\n * isValid: boolean;\n * receiptData: string;\n * jwsRepresentation: string;\n * latestTransaction?: Purchase;\n * }>}\n *\n * @see {@link https://openiap.dev/docs/apis/ios/validate-receipt-ios}\n */\nconst validateReceiptIOSImpl = async (props: VerifyPurchaseProps | string) => {\n requireIosPlatform('validateReceiptIOS');\n const sku =\n typeof props === 'string'\n ? props\n : (props as VerifyPurchaseProps)?.apple?.sku;\n\n if (!sku) {\n throw new Error('validateReceiptIOS requires a SKU (via apple.sku)');\n }\n\n return (await ExpoIapModule.validateReceiptIOS(\n sku,\n )) as VerifyPurchaseResultIOS;\n};\n\nexport const validateReceiptIOS =\n validateReceiptIOSImpl as QueryField<'validateReceiptIOS'>;\n\n/**\n * Present the code redemption sheet for offer codes (iOS only).\n * This allows users to redeem promotional codes for in-app purchases and subscriptions.\n *\n * Note: This only works on real devices, not simulators.\n *\n * @returns Promise resolving to true if the sheet was presented successfully\n * @throws Error if called on non-iOS platform or tvOS\n *\n * @platform iOS\n *\n * @see {@link https://openiap.dev/docs/apis/ios/present-code-redemption-sheet-ios}\n */\nexport const presentCodeRedemptionSheetIOS: MutationField<\n 'presentCodeRedemptionSheetIOS'\n> = async () => {\n requireIosPlatform('presentCodeRedemptionSheetIOS');\n return !!(await ExpoIapModule.presentCodeRedemptionSheetIOS());\n};\n\n/**\n * Get app transaction information (iOS 16.0+).\n * AppTransaction represents the initial purchase that unlocked the app.\n *\n * NOTE: This function requires:\n * - iOS 16.0 or later at runtime\n * - Xcode 15.0+ with iOS 16.0 SDK for compilation\n *\n * @returns Promise resolving to the app transaction information or null if not available\n * @throws Error if called on non-iOS platform, iOS version < 16.0, or compiled with older SDK\n *\n * @platform iOS\n * @since iOS 16.0\n *\n * @see {@link https://openiap.dev/docs/apis/ios/get-app-transaction-ios}\n */\nexport const getAppTransactionIOS: QueryField<\n 'getAppTransactionIOS'\n> = async () => {\n requireIosPlatform('getAppTransactionIOS');\n return (await ExpoIapModule.getAppTransactionIOS()) ?? null;\n};\n\n/**\n * Get information about a promoted product if one is available (iOS only).\n * Promoted products are products that the App Store promotes on your behalf.\n * This is called after a promoted product event is received from the App Store.\n *\n * @returns Promise resolving to the promoted product information or null if none available\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n *\n * @see {@link https://openiap.dev/docs/apis/ios/get-promoted-product-ios}\n */\nexport const getPromotedProductIOS: QueryField<\n 'getPromotedProductIOS'\n> = async () => {\n requireIosPlatform('getPromotedProductIOS');\n const product = await ExpoIapModule.getPromotedProductIOS();\n return (product ?? null) as ProductIOS | null;\n};\n\n/**\n * Complete the purchase of a promoted product (iOS only).\n * This should be called after showing your purchase UI for a promoted product.\n *\n * @deprecated Use promotedProductListenerIOS to receive the productId,\n * then call requestPurchase with that SKU instead.\n *\n * @returns Promise resolving when the purchase is initiated\n * @throws Error if called on non-iOS platform or no promoted product is available\n *\n * @platform iOS\n *\n * @see {@link https://openiap.dev/docs/apis/ios/request-purchase-on-promoted-product-ios}\n */\nexport const requestPurchaseOnPromotedProductIOS: MutationField<\n 'requestPurchaseOnPromotedProductIOS'\n> = async () => {\n requireIosPlatform('requestPurchaseOnPromotedProductIOS');\n const result = await ExpoIapModule.requestPurchaseOnPromotedProductIOS();\n return result ?? true;\n};\n\n/**\n * Get pending transactions that haven't been finished yet (iOS only).\n *\n * @returns Promise resolving to array of pending transactions\n * @platform iOS\n *\n * @see {@link https://openiap.dev/docs/apis/ios/get-pending-transactions-ios}\n */\nexport const getPendingTransactionsIOS: QueryField<\n 'getPendingTransactionsIOS'\n> = async () => {\n requireIosPlatform('getPendingTransactionsIOS');\n const transactions = await ExpoIapModule.getPendingTransactionsIOS();\n return (transactions ?? []) as PurchaseIOS[];\n};\n\n/**\n * List every StoreKit transaction (finished + unfinished) for the current user.\n *\n * @see {@link https://openiap.dev/docs/apis/ios/get-all-transactions-ios}\n */\nexport const getAllTransactionsIOS: QueryField<\n 'getAllTransactionsIOS'\n> = async () => {\n requireIosPlatform('getAllTransactionsIOS');\n const transactions = await ExpoIapModule.getAllTransactionsIOS();\n return (transactions ?? []) as PurchaseIOS[];\n};\n\n/**\n * Clear a specific transaction (iOS only).\n *\n * @returns Promise resolving when transaction is cleared\n * @platform iOS\n *\n * @see {@link https://openiap.dev/docs/apis/ios/clear-transaction-ios}\n */\nexport const clearTransactionIOS: MutationField<\n 'clearTransactionIOS'\n> = async () => {\n requireIosPlatform('clearTransactionIOS');\n return !!(await ExpoIapModule.clearTransactionIOS());\n};\n\n/**\n * Deep link to subscriptions screen on iOS.\n * @returns {Promise<void>}\n *\n * @platform iOS\n */\nexport const deepLinkToSubscriptionsIOS = (): Promise<void> =>\n Linking.openURL('https://apps.apple.com/account/subscriptions');\n\n/**\n * Check if the device can present an external purchase notice sheet (iOS 17.4+).\n *\n * Wraps `ExternalPurchase.canPresent`, which Apple introduced in iOS 17.4.\n * Note: the notice sheet itself (`presentExternalPurchaseNoticeSheetIOS`)\n * still requires iOS 18.2+; only the eligibility check is available earlier.\n *\n * @returns Promise resolving to true if the notice sheet can be presented\n * @platform iOS\n *\n * @see {@link https://openiap.dev/docs/apis/ios/can-present-external-purchase-notice-ios}\n */\nexport const canPresentExternalPurchaseNoticeIOS: QueryField<\n 'canPresentExternalPurchaseNoticeIOS'\n> = async () => {\n requireIosPlatform('canPresentExternalPurchaseNoticeIOS');\n return !!(await ExpoIapModule.canPresentExternalPurchaseNoticeIOS());\n};\n\n/**\n * Present an external purchase notice sheet to inform users about external purchases (iOS 15.4+).\n * This must be called before opening an external purchase link.\n * Returns the external purchase token when user continues.\n *\n * @returns Promise resolving to the result with action, token, and error if any\n * @platform iOS\n *\n * @see {@link https://openiap.dev/docs/apis/ios/present-external-purchase-notice-sheet-ios}\n */\nexport const presentExternalPurchaseNoticeSheetIOS: MutationField<\n 'presentExternalPurchaseNoticeSheetIOS'\n> = async () => {\n requireIosPlatform('presentExternalPurchaseNoticeSheetIOS');\n const result = await ExpoIapModule.presentExternalPurchaseNoticeSheetIOS();\n return result as ExternalPurchaseNoticeResultIOS;\n};\n\n/**\n * Present an external purchase link to redirect users to your website (iOS 16.0+).\n *\n * @param url - The external purchase URL to open\n * @returns Promise resolving to the result with success status and error if any\n * @platform iOS\n *\n * @see {@link https://openiap.dev/docs/apis/ios/present-external-purchase-link-ios}\n */\nexport const presentExternalPurchaseLinkIOS: MutationField<\n 'presentExternalPurchaseLinkIOS'\n> = async (url: string) => {\n requireIosPlatform('presentExternalPurchaseLinkIOS');\n const result = await ExpoIapModule.presentExternalPurchaseLinkIOS(url);\n return result as ExternalPurchaseLinkResultIOS;\n};\n\n/**\n * Check if app is eligible for ExternalPurchaseCustomLink API (iOS 18.1+).\n * Returns true if the app can use custom external purchase links.\n *\n * @returns Promise resolving to true if eligible\n * @platform iOS\n * @see https://developer.apple.com/documentation/storekit/externalpurchasecustomlink/iseligible\n *\n * @see {@link https://openiap.dev/docs/apis/ios/is-eligible-for-external-purchase-custom-link-ios}\n */\nexport const isEligibleForExternalPurchaseCustomLinkIOS: QueryField<\n 'isEligibleForExternalPurchaseCustomLinkIOS'\n> = async () => {\n requireIosPlatform('isEligibleForExternalPurchaseCustomLinkIOS');\n return !!(await ExpoIapModule.isEligibleForExternalPurchaseCustomLinkIOS());\n};\n\n/**\n * Get external purchase token for reporting to Apple (iOS 18.1+).\n * Use this token with Apple's External Purchase Server API to report transactions.\n *\n * @param tokenType - Token type: 'acquisition' (new customers) or 'services' (existing customers)\n * @returns Promise resolving to the token result with token string or error\n * @platform iOS\n * @see https://developer.apple.com/documentation/storekit/externalpurchasecustomlink/token(for:)\n *\n * @see {@link https://openiap.dev/docs/apis/ios/get-external-purchase-custom-link-token-ios}\n */\nexport const getExternalPurchaseCustomLinkTokenIOS: QueryField<\n 'getExternalPurchaseCustomLinkTokenIOS'\n> = async (tokenType) => {\n requireIosPlatform('getExternalPurchaseCustomLinkTokenIOS');\n if (!tokenType) {\n throw new Error(\n \"getExternalPurchaseCustomLinkTokenIOS requires a tokenType ('acquisition' or 'services')\",\n );\n }\n const result = await ExpoIapModule.getExternalPurchaseCustomLinkTokenIOS(\n tokenType,\n );\n return result as ExternalPurchaseCustomLinkTokenResultIOS;\n};\n\n/**\n * Show ExternalPurchaseCustomLink notice sheet (iOS 18.1+).\n * Displays the system disclosure notice sheet for custom external purchase links.\n * Call this after a deliberate customer interaction before linking out to external purchases.\n *\n * @param noticeType - Notice type: 'browser' (external purchases displayed in browser)\n * @returns Promise resolving to the result with continued status and error if any\n * @platform iOS\n * @see https://developer.apple.com/documentation/storekit/externalpurchasecustomlink/shownotice(type:)\n *\n * @see {@link https://openiap.dev/docs/apis/ios/show-external-purchase-custom-link-notice-ios}\n */\nexport const showExternalPurchaseCustomLinkNoticeIOS: MutationField<\n 'showExternalPurchaseCustomLinkNoticeIOS'\n> = async (noticeType) => {\n requireIosPlatform('showExternalPurchaseCustomLinkNoticeIOS');\n if (!noticeType) {\n throw new Error(\n \"showExternalPurchaseCustomLinkNoticeIOS requires a noticeType ('browser')\",\n );\n }\n const result = await ExpoIapModule.showExternalPurchaseCustomLinkNoticeIOS(\n noticeType,\n );\n return result as ExternalPurchaseCustomLinkNoticeResultIOS;\n};\n\n// iOS-specific APIs only; cross-platform wrappers live in src/index.ts\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-iap",
3
- "version": "4.5.2",
3
+ "version": "4.6.0",
4
4
  "description": "In App Purchase module in Expo",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -1,8 +1,9 @@
1
1
  // External dependencies
2
- import {Linking} from 'react-native';
2
+ import {Linking, Platform} from 'react-native';
3
3
 
4
4
  // Internal modules
5
5
  import ExpoIapModule from '../ExpoIapModule';
6
+ import {isVegaOS} from '../vega';
6
7
 
7
8
  // Types
8
9
  import type {
@@ -32,6 +33,20 @@ type NativeAndroidModule = {
32
33
 
33
34
  const nativeAndroidModule = ExpoIapModule as NativeAndroidModule;
34
35
 
36
+ /**
37
+ * Enforce the documented Android-only contract. Vega OS is treated as an
38
+ * Android store runtime (matching `isAndroidStoreRuntime` in src/index.ts),
39
+ * so it passes through. Without this guard, calling a suffixed wrapper on
40
+ * another platform falls through to the native proxy and surfaces as an
41
+ * opaque `TypeError: ExpoIapModule.<name> is not a function` instead of the
42
+ * promised platform error.
43
+ */
44
+ const requireAndroidPlatform = (methodName: string): void => {
45
+ if (Platform.OS !== 'android' && !isVegaOS()) {
46
+ throw new Error(`${methodName} is only available on Android and Vega OS`);
47
+ }
48
+ };
49
+
35
50
  // Type guards
36
51
  export function isProductAndroid<T extends {platform?: string}>(
37
52
  item: unknown,
@@ -148,6 +163,7 @@ export const validateReceiptAndroid = async ({
148
163
  export const consumePurchaseAndroid: MutationField<
149
164
  'consumePurchaseAndroid'
150
165
  > = async (purchaseToken) => {
166
+ requireAndroidPlatform('consumePurchaseAndroid');
151
167
  const result = await ExpoIapModule.consumePurchaseAndroid(purchaseToken);
152
168
 
153
169
  if (typeof result === 'boolean') {
@@ -172,16 +188,18 @@ export const consumePurchaseAndroid: MutationField<
172
188
  };
173
189
 
174
190
  /**
175
- * Acknowledge a product (on Android.) No-op on iOS.
191
+ * Acknowledge a non-consumable purchase or subscription (Android only).
176
192
  * @param {Object} params - The parameters object
177
193
  * @param {string} params.token - The product's token (on Android)
178
194
  * @returns {Promise<VoidResult | void>}
195
+ * @throws Error if called on a non-Android platform
179
196
  *
180
197
  * @see {@link https://openiap.dev/docs/apis/android/acknowledge-purchase-android}
181
198
  */
182
199
  export const acknowledgePurchaseAndroid: MutationField<
183
200
  'acknowledgePurchaseAndroid'
184
201
  > = async (purchaseToken) => {
202
+ requireAndroidPlatform('acknowledgePurchaseAndroid');
185
203
  const result = await ExpoIapModule.acknowledgePurchaseAndroid(purchaseToken);
186
204
 
187
205
  if (typeof result === 'boolean') {
@@ -234,6 +252,7 @@ export const openRedeemOfferCodeAndroid = async (): Promise<void> => {
234
252
  export const checkAlternativeBillingAvailabilityAndroid: MutationField<
235
253
  'checkAlternativeBillingAvailabilityAndroid'
236
254
  > = async () => {
255
+ requireAndroidPlatform('checkAlternativeBillingAvailabilityAndroid');
237
256
  return ExpoIapModule.checkAlternativeBillingAvailabilityAndroid();
238
257
  };
239
258
 
@@ -266,6 +285,7 @@ export const checkAlternativeBillingAvailabilityAndroid: MutationField<
266
285
  export const showAlternativeBillingDialogAndroid: MutationField<
267
286
  'showAlternativeBillingDialogAndroid'
268
287
  > = async () => {
288
+ requireAndroidPlatform('showAlternativeBillingDialogAndroid');
269
289
  return ExpoIapModule.showAlternativeBillingDialogAndroid();
270
290
  };
271
291
 
@@ -298,6 +318,7 @@ export const showAlternativeBillingDialogAndroid: MutationField<
298
318
  export const createAlternativeBillingTokenAndroid: MutationField<
299
319
  'createAlternativeBillingTokenAndroid'
300
320
  > = async (sku?: string) => {
321
+ requireAndroidPlatform('createAlternativeBillingTokenAndroid');
301
322
  return ExpoIapModule.createAlternativeBillingTokenAndroid(sku);
302
323
  };
303
324
 
@@ -326,6 +347,7 @@ export const createAlternativeBillingTokenAndroid: MutationField<
326
347
  export const isBillingProgramAvailableAndroid: MutationField<
327
348
  'isBillingProgramAvailableAndroid'
328
349
  > = async (program) => {
350
+ requireAndroidPlatform('isBillingProgramAvailableAndroid');
329
351
  return ExpoIapModule.isBillingProgramAvailableAndroid(program);
330
352
  };
331
353
 
@@ -343,6 +365,7 @@ export const getBillingChoiceInfoAndroid: QueryField<
343
365
  > = async (
344
366
  params: GetBillingChoiceInfoParamsAndroid = {},
345
367
  ): Promise<BillingChoiceInfoAndroid> => {
368
+ requireAndroidPlatform('getBillingChoiceInfoAndroid');
346
369
  return ExpoIapModule.getBillingChoiceInfoAndroid({
347
370
  billingProgram: params.billingProgram ?? 'billing-choice',
348
371
  playBillingChoiceImageLayout:
@@ -375,6 +398,7 @@ export const getBillingChoiceInfoAndroid: QueryField<
375
398
  export const launchExternalLinkAndroid: MutationField<
376
399
  'launchExternalLinkAndroid'
377
400
  > = async (params) => {
401
+ requireAndroidPlatform('launchExternalLinkAndroid');
378
402
  return ExpoIapModule.launchExternalLinkAndroid(params);
379
403
  };
380
404
 
@@ -401,11 +425,13 @@ const createBillingProgramReportingDetailsAndroidField: MutationField<
401
425
  'createBillingProgramReportingDetailsAndroid'
402
426
  > = async (
403
427
  args: MutationCreateBillingProgramReportingDetailsAndroidArgs,
404
- ): Promise<BillingProgramReportingDetailsAndroid> =>
405
- ExpoIapModule.createBillingProgramReportingDetailsAndroid(
428
+ ): Promise<BillingProgramReportingDetailsAndroid> => {
429
+ requireAndroidPlatform('createBillingProgramReportingDetailsAndroid');
430
+ return ExpoIapModule.createBillingProgramReportingDetailsAndroid(
406
431
  args.program,
407
432
  args.developerBillingType ?? null,
408
433
  );
434
+ };
409
435
 
410
436
  export function createBillingProgramReportingDetailsAndroid(
411
437
  args: MutationCreateBillingProgramReportingDetailsAndroidArgs,
@@ -442,6 +468,7 @@ export const showBillingProgramInformationDialogAndroid: MutationField<
442
468
  > = async (
443
469
  params: BillingProgramInformationDialogParamsAndroid,
444
470
  ): Promise<BillingResultAndroid> => {
471
+ requireAndroidPlatform('showBillingProgramInformationDialogAndroid');
445
472
  return ExpoIapModule.showBillingProgramInformationDialogAndroid({
446
473
  billingProgram: params.billingProgram ?? 'billing-choice',
447
474
  externalTransactionToken: params.externalTransactionToken,
@@ -462,5 +489,6 @@ export const showInAppMessagesAndroid: MutationField<
462
489
  > = async (
463
490
  params?: InAppMessageParamsAndroid | null,
464
491
  ): Promise<InAppMessageResultAndroid> => {
492
+ requireAndroidPlatform('showInAppMessagesAndroid');
465
493
  return ExpoIapModule.showInAppMessagesAndroid(params ?? null);
466
494
  };
@@ -25,7 +25,19 @@ import {
25
25
  createPurchaseErrorFromNativeException,
26
26
  type PurchaseError,
27
27
  } from '../utils/errorMapping';
28
- import {Linking} from 'react-native';
28
+ import {Linking, Platform} from 'react-native';
29
+
30
+ /**
31
+ * Enforce the documented iOS-only contract. Without this, calling a
32
+ * suffixed wrapper on another platform falls through to the native proxy
33
+ * and surfaces as an opaque `TypeError: ExpoIapModule.<name> is not a
34
+ * function` instead of the promised platform error.
35
+ */
36
+ const requireIosPlatform = (methodName: string): void => {
37
+ if (Platform.OS !== 'ios') {
38
+ throw new Error(`${methodName} is only available on iOS`);
39
+ }
40
+ };
29
41
 
30
42
  export type TransactionEvent = {
31
43
  transaction?: Purchase;
@@ -60,6 +72,7 @@ export function isProductIOS<T extends {platform?: string}>(
60
72
  * @see {@link https://openiap.dev/docs/apis/ios/sync-ios}
61
73
  */
62
74
  export const syncIOS: MutationField<'syncIOS'> = async () => {
75
+ requireIosPlatform('syncIOS');
63
76
  return !!(await ExpoIapModule.syncIOS());
64
77
  };
65
78
 
@@ -77,6 +90,7 @@ export const syncIOS: MutationField<'syncIOS'> = async () => {
77
90
  export const isEligibleForIntroOfferIOS: QueryField<
78
91
  'isEligibleForIntroOfferIOS'
79
92
  > = async (groupId) => {
93
+ requireIosPlatform('isEligibleForIntroOfferIOS');
80
94
  if (!groupId) {
81
95
  throw new Error('isEligibleForIntroOfferIOS requires a groupId');
82
96
  }
@@ -97,6 +111,7 @@ export const isEligibleForIntroOfferIOS: QueryField<
97
111
  export const subscriptionStatusIOS: QueryField<
98
112
  'subscriptionStatusIOS'
99
113
  > = async (sku) => {
114
+ requireIosPlatform('subscriptionStatusIOS');
100
115
  if (!sku) {
101
116
  throw new Error('subscriptionStatusIOS requires a SKU');
102
117
  }
@@ -118,6 +133,7 @@ export const subscriptionStatusIOS: QueryField<
118
133
  export const currentEntitlementIOS: QueryField<
119
134
  'currentEntitlementIOS'
120
135
  > = async (sku) => {
136
+ requireIosPlatform('currentEntitlementIOS');
121
137
  if (!sku) {
122
138
  throw new Error('currentEntitlementIOS requires a SKU');
123
139
  }
@@ -139,6 +155,7 @@ export const currentEntitlementIOS: QueryField<
139
155
  export const latestTransactionIOS: QueryField<'latestTransactionIOS'> = async (
140
156
  sku,
141
157
  ) => {
158
+ requireIosPlatform('latestTransactionIOS');
142
159
  if (!sku) {
143
160
  throw new Error('latestTransactionIOS requires a SKU');
144
161
  }
@@ -160,6 +177,7 @@ export const latestTransactionIOS: QueryField<'latestTransactionIOS'> = async (
160
177
  export const beginRefundRequestIOS: MutationField<
161
178
  'beginRefundRequestIOS'
162
179
  > = async (sku) => {
180
+ requireIosPlatform('beginRefundRequestIOS');
163
181
  if (!sku) {
164
182
  throw new Error('beginRefundRequestIOS requires a SKU');
165
183
  }
@@ -181,6 +199,7 @@ export const beginRefundRequestIOS: MutationField<
181
199
  export const showManageSubscriptionsIOS: MutationField<
182
200
  'showManageSubscriptionsIOS'
183
201
  > = async () => {
202
+ requireIosPlatform('showManageSubscriptionsIOS');
184
203
  const purchases = await ExpoIapModule.showManageSubscriptionsIOS();
185
204
  return (purchases ?? []) as PurchaseIOS[];
186
205
  };
@@ -198,6 +217,7 @@ export const showManageSubscriptionsIOS: MutationField<
198
217
  * @see {@link https://openiap.dev/docs/apis/ios/get-receipt-data-ios}
199
218
  */
200
219
  export const getReceiptDataIOS: QueryField<'getReceiptDataIOS'> = async () => {
220
+ requireIosPlatform('getReceiptDataIOS');
201
221
  return ExpoIapModule.getReceiptDataIOS();
202
222
  };
203
223
 
@@ -212,12 +232,15 @@ export const getReceiptIOS = getReceiptDataIOS;
212
232
  * alias so consumers who previously imported `getStorefrontIOS` do not break.
213
233
  *
214
234
  * @returns {Promise<string>} ISO 3166-1 alpha-3 country code (e.g. "USA")
235
+ * @throws Error if called on non-iOS platform — Android callers must use the
236
+ * cross-platform `getStorefront` from the main index instead
215
237
  *
216
238
  * @platform iOS
217
239
  *
218
240
  * @see {@link https://openiap.dev/docs/apis/ios/get-storefront-ios}
219
241
  */
220
242
  export const getStorefrontIOS: QueryField<'getStorefrontIOS'> = async () => {
243
+ requireIosPlatform('getStorefrontIOS');
221
244
  if (typeof ExpoIapModule.getStorefront !== 'function') {
222
245
  throw createPurchaseError({
223
246
  code: ErrorCode.FeatureNotSupported,
@@ -259,6 +282,7 @@ export const getStorefrontIOS: QueryField<'getStorefrontIOS'> = async () => {
259
282
  * @platform iOS
260
283
  */
261
284
  export const requestReceiptRefreshIOS = async (): Promise<string> => {
285
+ requireIosPlatform('requestReceiptRefreshIOS');
262
286
  return ExpoIapModule.requestReceiptRefreshIOS();
263
287
  };
264
288
 
@@ -277,6 +301,7 @@ export const requestReceiptRefreshIOS = async (): Promise<string> => {
277
301
  export const isTransactionVerifiedIOS: QueryField<
278
302
  'isTransactionVerifiedIOS'
279
303
  > = async (sku) => {
304
+ requireIosPlatform('isTransactionVerifiedIOS');
280
305
  if (!sku) {
281
306
  throw new Error('isTransactionVerifiedIOS requires a SKU');
282
307
  }
@@ -298,6 +323,7 @@ export const isTransactionVerifiedIOS: QueryField<
298
323
  export const getTransactionJwsIOS: QueryField<'getTransactionJwsIOS'> = async (
299
324
  sku,
300
325
  ) => {
326
+ requireIosPlatform('getTransactionJwsIOS');
301
327
  if (!sku) {
302
328
  throw new Error('getTransactionJwsIOS requires a SKU');
303
329
  }
@@ -324,6 +350,7 @@ export const getTransactionJwsIOS: QueryField<'getTransactionJwsIOS'> = async (
324
350
  * @see {@link https://openiap.dev/docs/apis/ios/validate-receipt-ios}
325
351
  */
326
352
  const validateReceiptIOSImpl = async (props: VerifyPurchaseProps | string) => {
353
+ requireIosPlatform('validateReceiptIOS');
327
354
  const sku =
328
355
  typeof props === 'string'
329
356
  ? props
@@ -357,6 +384,7 @@ export const validateReceiptIOS =
357
384
  export const presentCodeRedemptionSheetIOS: MutationField<
358
385
  'presentCodeRedemptionSheetIOS'
359
386
  > = async () => {
387
+ requireIosPlatform('presentCodeRedemptionSheetIOS');
360
388
  return !!(await ExpoIapModule.presentCodeRedemptionSheetIOS());
361
389
  };
362
390
 
@@ -379,6 +407,7 @@ export const presentCodeRedemptionSheetIOS: MutationField<
379
407
  export const getAppTransactionIOS: QueryField<
380
408
  'getAppTransactionIOS'
381
409
  > = async () => {
410
+ requireIosPlatform('getAppTransactionIOS');
382
411
  return (await ExpoIapModule.getAppTransactionIOS()) ?? null;
383
412
  };
384
413
 
@@ -397,6 +426,7 @@ export const getAppTransactionIOS: QueryField<
397
426
  export const getPromotedProductIOS: QueryField<
398
427
  'getPromotedProductIOS'
399
428
  > = async () => {
429
+ requireIosPlatform('getPromotedProductIOS');
400
430
  const product = await ExpoIapModule.getPromotedProductIOS();
401
431
  return (product ?? null) as ProductIOS | null;
402
432
  };
@@ -418,6 +448,7 @@ export const getPromotedProductIOS: QueryField<
418
448
  export const requestPurchaseOnPromotedProductIOS: MutationField<
419
449
  'requestPurchaseOnPromotedProductIOS'
420
450
  > = async () => {
451
+ requireIosPlatform('requestPurchaseOnPromotedProductIOS');
421
452
  const result = await ExpoIapModule.requestPurchaseOnPromotedProductIOS();
422
453
  return result ?? true;
423
454
  };
@@ -433,6 +464,7 @@ export const requestPurchaseOnPromotedProductIOS: MutationField<
433
464
  export const getPendingTransactionsIOS: QueryField<
434
465
  'getPendingTransactionsIOS'
435
466
  > = async () => {
467
+ requireIosPlatform('getPendingTransactionsIOS');
436
468
  const transactions = await ExpoIapModule.getPendingTransactionsIOS();
437
469
  return (transactions ?? []) as PurchaseIOS[];
438
470
  };
@@ -445,6 +477,7 @@ export const getPendingTransactionsIOS: QueryField<
445
477
  export const getAllTransactionsIOS: QueryField<
446
478
  'getAllTransactionsIOS'
447
479
  > = async () => {
480
+ requireIosPlatform('getAllTransactionsIOS');
448
481
  const transactions = await ExpoIapModule.getAllTransactionsIOS();
449
482
  return (transactions ?? []) as PurchaseIOS[];
450
483
  };
@@ -460,6 +493,7 @@ export const getAllTransactionsIOS: QueryField<
460
493
  export const clearTransactionIOS: MutationField<
461
494
  'clearTransactionIOS'
462
495
  > = async () => {
496
+ requireIosPlatform('clearTransactionIOS');
463
497
  return !!(await ExpoIapModule.clearTransactionIOS());
464
498
  };
465
499
 
@@ -487,6 +521,7 @@ export const deepLinkToSubscriptionsIOS = (): Promise<void> =>
487
521
  export const canPresentExternalPurchaseNoticeIOS: QueryField<
488
522
  'canPresentExternalPurchaseNoticeIOS'
489
523
  > = async () => {
524
+ requireIosPlatform('canPresentExternalPurchaseNoticeIOS');
490
525
  return !!(await ExpoIapModule.canPresentExternalPurchaseNoticeIOS());
491
526
  };
492
527
 
@@ -503,6 +538,7 @@ export const canPresentExternalPurchaseNoticeIOS: QueryField<
503
538
  export const presentExternalPurchaseNoticeSheetIOS: MutationField<
504
539
  'presentExternalPurchaseNoticeSheetIOS'
505
540
  > = async () => {
541
+ requireIosPlatform('presentExternalPurchaseNoticeSheetIOS');
506
542
  const result = await ExpoIapModule.presentExternalPurchaseNoticeSheetIOS();
507
543
  return result as ExternalPurchaseNoticeResultIOS;
508
544
  };
@@ -519,6 +555,7 @@ export const presentExternalPurchaseNoticeSheetIOS: MutationField<
519
555
  export const presentExternalPurchaseLinkIOS: MutationField<
520
556
  'presentExternalPurchaseLinkIOS'
521
557
  > = async (url: string) => {
558
+ requireIosPlatform('presentExternalPurchaseLinkIOS');
522
559
  const result = await ExpoIapModule.presentExternalPurchaseLinkIOS(url);
523
560
  return result as ExternalPurchaseLinkResultIOS;
524
561
  };
@@ -536,6 +573,7 @@ export const presentExternalPurchaseLinkIOS: MutationField<
536
573
  export const isEligibleForExternalPurchaseCustomLinkIOS: QueryField<
537
574
  'isEligibleForExternalPurchaseCustomLinkIOS'
538
575
  > = async () => {
576
+ requireIosPlatform('isEligibleForExternalPurchaseCustomLinkIOS');
539
577
  return !!(await ExpoIapModule.isEligibleForExternalPurchaseCustomLinkIOS());
540
578
  };
541
579
 
@@ -553,6 +591,7 @@ export const isEligibleForExternalPurchaseCustomLinkIOS: QueryField<
553
591
  export const getExternalPurchaseCustomLinkTokenIOS: QueryField<
554
592
  'getExternalPurchaseCustomLinkTokenIOS'
555
593
  > = async (tokenType) => {
594
+ requireIosPlatform('getExternalPurchaseCustomLinkTokenIOS');
556
595
  if (!tokenType) {
557
596
  throw new Error(
558
597
  "getExternalPurchaseCustomLinkTokenIOS requires a tokenType ('acquisition' or 'services')",
@@ -579,6 +618,7 @@ export const getExternalPurchaseCustomLinkTokenIOS: QueryField<
579
618
  export const showExternalPurchaseCustomLinkNoticeIOS: MutationField<
580
619
  'showExternalPurchaseCustomLinkNoticeIOS'
581
620
  > = async (noticeType) => {
621
+ requireIosPlatform('showExternalPurchaseCustomLinkNoticeIOS');
582
622
  if (!noticeType) {
583
623
  throw new Error(
584
624
  "showExternalPurchaseCustomLinkNoticeIOS requires a noticeType ('browser')",