expo-iap 4.2.2 → 4.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/index.d.ts +126 -33
- package/build/index.d.ts.map +1 -1
- package/build/index.js +123 -33
- package/build/index.js.map +1 -1
- package/build/kit-api.d.ts +54 -0
- package/build/kit-api.d.ts.map +1 -0
- package/build/kit-api.js +156 -0
- package/build/kit-api.js.map +1 -0
- package/build/modules/android.d.ts +22 -0
- package/build/modules/android.d.ts.map +1 -1
- package/build/modules/android.js +37 -0
- package/build/modules/android.js.map +1 -1
- package/build/modules/ios.d.ts +69 -1
- package/build/modules/ios.d.ts.map +1 -1
- package/build/modules/ios.js +73 -1
- package/build/modules/ios.js.map +1 -1
- package/build/types.d.ts +241 -75
- package/build/types.d.ts.map +1 -1
- package/build/types.js.map +1 -1
- package/build/useIAP.d.ts.map +1 -1
- package/build/useIAP.js +125 -3
- package/build/useIAP.js.map +1 -1
- package/build/useWebhookEvents.d.ts +26 -0
- package/build/useWebhookEvents.d.ts.map +1 -0
- package/build/useWebhookEvents.js +105 -0
- package/build/useWebhookEvents.js.map +1 -0
- package/build/webhook-client.d.ts +82 -0
- package/build/webhook-client.d.ts.map +1 -0
- package/build/webhook-client.js +176 -0
- package/build/webhook-client.js.map +1 -0
- package/openiap-versions.json +2 -2
- package/package.json +1 -1
- package/src/index.ts +141 -33
- package/src/kit-api.ts +229 -0
- package/src/modules/android.ts +47 -0
- package/src/modules/ios.ts +74 -1
- package/src/types.ts +247 -75
- package/src/useIAP.ts +125 -3
- package/src/useWebhookEvents.ts +155 -0
- package/src/webhook-client.ts +314 -0
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,wBAAwB;AACxB,OAAO,EAAC,QAAQ,EAAC,MAAM,cAAc,CAAC;AAEtC,mBAAmB;AACnB,OAAO,aAAa,EA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AY;yBACrB;qBACF,CAAC;gBACJ,CAAC;YACH,CAAC;YAAC,MAAM,CAAC;gBACP,MAAM,IAAI,KAAK,CACb,wEAAwE;oBACtE,sDAAsD;oBACtD,mEAAmE,CACtE,CAAC;YACJ,CAAC;QACH,CAAC;QACD,OAAO,aAAa,CAAC,0BAA0B,CAAC,OAAO,CAAC,CAAC;IAC3D,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,yBAAyB,QAAQ,CAAC,EAAE,EAAE,CAAC,CAAC;AAC1D,CAAC,CAAC;AAEF,cAAc,UAAU,CAAC;AACzB,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,mBAAmB,EACnB,+BAA+B,GAChC,MAAM,sBAAsB,CAAC;AAK9B,OAAO,EAAC,cAAc,EAAC,MAAM,eAAe,CAAC","sourcesContent":["// External dependencies\nimport {Platform} from 'react-native';\n\n// Internal modules\nimport ExpoIapModule, {getNativeModule} from './ExpoIapModule';\nimport {\n isProductIOS,\n validateReceiptIOS,\n deepLinkToSubscriptionsIOS,\n syncIOS,\n} from './modules/ios';\nimport {\n isProductAndroid,\n validateReceiptAndroid,\n deepLinkToSubscriptionsAndroid,\n} from './modules/android';\nimport {ExpoIapConsole} from './utils/debug';\n\n// Types\nimport type {\n ActiveSubscription,\n AndroidSubscriptionOfferInput,\n DeepLinkOptions,\n DeveloperProvidedBillingDetailsAndroid,\n MutationField,\n MutationRequestPurchaseArgs,\n MutationValidateReceiptArgs,\n Product,\n ProductQueryType,\n ProductSubscription,\n Purchase,\n PurchaseOptions,\n QueryField,\n RequestPurchasePropsByPlatforms,\n RequestPurchaseAndroidProps,\n RequestPurchaseIosProps,\n RequestSubscriptionPropsByPlatforms,\n RequestSubscriptionAndroidProps,\n RequestSubscriptionIosProps,\n UserChoiceBillingDetails,\n} from './types';\nimport {ErrorCode} from './types';\nimport {createPurchaseError, type PurchaseError} from './utils/errorMapping';\n\n// Export all types\nexport * from './types';\nexport * from './modules/android';\nexport * from './modules/ios';\nexport * from './onside';\n\n// Get the native constant value\nexport enum OpenIapEvent {\n PurchaseUpdated = 'purchase-updated',\n PurchaseError = 'purchase-error',\n PromotedProductIOS = 'promoted-product-ios',\n UserChoiceBillingAndroid = 'user-choice-billing-android',\n /**\n * Fired when user selects developer billing in External Payments flow (Android 8.3.0+)\n * Only available in Japan. Contains externalTransactionToken for reporting.\n */\n DeveloperProvidedBillingAndroid = 'developer-provided-billing-android',\n /**\n * Fired when an active subscription enters a billing-issue state (cross-platform).\n * Unifies StoreKit 2 `Message.Reason.billingIssue` (iOS 18+) and Play Billing 8.1+\n * `Purchase.isSuspended`. NOT fired on the Meta Horizon flavor.\n */\n SubscriptionBillingIssue = 'subscription-billing-issue',\n}\n\ntype ExpoIapEventPayloads = {\n [OpenIapEvent.PurchaseUpdated]: Purchase;\n [OpenIapEvent.PurchaseError]: PurchaseError;\n [OpenIapEvent.PromotedProductIOS]: Product;\n [OpenIapEvent.UserChoiceBillingAndroid]: UserChoiceBillingDetails;\n [OpenIapEvent.DeveloperProvidedBillingAndroid]: DeveloperProvidedBillingDetailsAndroid;\n [OpenIapEvent.SubscriptionBillingIssue]: Purchase;\n};\n\ntype ExpoIapEventListener<E extends OpenIapEvent> = (\n payload: ExpoIapEventPayloads[E],\n) => void;\n\ntype ExpoIapEmitter = {\n addListener<E extends OpenIapEvent>(\n eventName: E,\n listener: ExpoIapEventListener<E>,\n ): {remove: () => void};\n removeListener<E extends OpenIapEvent>(\n eventName: E,\n listener: ExpoIapEventListener<E>,\n ): void;\n};\n\n// Use the raw native module for listener calls — JSI HostObjects require the\n// real native module as `this` when calling addListener. Using a Proxy as\n// `this` triggers \"native state unsupported on Proxy\" on New Architecture / Hermes.\n// Resolved lazily so importing this module doesn't throw on unsupported platforms.\nexport const emitter: ExpoIapEmitter = {\n addListener(eventName, listener) {\n return getNativeModule().addListener(eventName, listener);\n },\n removeListener(eventName, listener) {\n return getNativeModule().removeListener(eventName, listener);\n },\n};\n\n/**\n * TODO(v3.1.0): Remove legacy 'inapp' alias once downstream apps migrate to 'in-app'.\n */\nexport type ProductTypeInput = ProductQueryType | 'inapp';\n\nconst normalizeProductType = (type?: ProductTypeInput) => {\n if (type === 'inapp') {\n ExpoIapConsole.warn(\n \"'inapp' product type is deprecated and will be removed in v3.1.0. Use 'in-app' instead.\",\n );\n }\n\n if (!type || type === 'inapp' || type === 'in-app') {\n return {\n canonical: 'in-app' as ProductQueryType,\n native: 'in-app' as const,\n };\n }\n if (type === 'subs') {\n return {\n canonical: 'subs' as ProductQueryType,\n native: 'subs' as const,\n };\n }\n if (type === 'all') {\n return {\n canonical: 'all' as ProductQueryType,\n native: 'all' as const,\n };\n }\n throw new Error(`Unsupported product type: ${type}`);\n};\n\nconst normalizePurchasePlatform = (purchase: Purchase): Purchase => {\n const platform = purchase.platform;\n if (typeof platform !== 'string') {\n return purchase;\n }\n\n const lowered = platform.toLowerCase();\n if (lowered === platform || (lowered !== 'ios' && lowered !== 'android')) {\n return purchase;\n }\n\n return {...purchase, platform: lowered};\n};\n\nconst normalizePurchaseArray = (purchases: Purchase[]): Purchase[] =>\n purchases.map((purchase) => normalizePurchasePlatform(purchase));\n\nexport const purchaseUpdatedListener = (\n listener: (event: Purchase) => void,\n) => {\n const wrappedListener = (event: Purchase) => {\n const normalized = normalizePurchasePlatform(event);\n listener(normalized);\n };\n const emitterSubscription = emitter.addListener(\n OpenIapEvent.PurchaseUpdated,\n wrappedListener,\n );\n return emitterSubscription;\n};\n\nexport const purchaseErrorListener = (\n listener: (error: PurchaseError) => void,\n) => {\n const wrappedListener = (error: PurchaseError) => {\n listener(error);\n };\n const emitterSubscription = emitter.addListener(\n OpenIapEvent.PurchaseError,\n wrappedListener,\n );\n return emitterSubscription;\n};\n\n/**\n * iOS-only listener for App Store promoted product events.\n * This fires when a user taps on a promoted product in the App Store.\n *\n * @param listener - Callback function that receives the promoted product details\n * @returns EventSubscription that can be used to unsubscribe\n *\n * @example\n * ```typescript\n * const subscription = promotedProductListenerIOS((product) => {\n * console.log('Promoted product:', product);\n * // Handle the promoted product\n * });\n *\n * // Later, clean up\n * subscription.remove();\n * ```\n *\n * @platform iOS\n */\nexport const promotedProductListenerIOS = (\n listener: (product: Product) => void,\n) => {\n if (Platform.OS !== 'ios') {\n ExpoIapConsole.warn(\n 'promotedProductListenerIOS: This listener is only available on iOS',\n );\n return {remove: () => {}};\n }\n return emitter.addListener(OpenIapEvent.PromotedProductIOS, listener);\n};\n\n/**\n * Android-only listener for User Choice Billing events.\n * This fires when a user selects alternative billing instead of Google Play billing\n * in the User Choice Billing dialog (only in 'user-choice' mode).\n *\n * @param listener - Callback function that receives the external transaction token and product IDs\n * @returns EventSubscription that can be used to unsubscribe\n *\n * @example\n * ```typescript\n * const subscription = userChoiceBillingListenerAndroid((details) => {\n * console.log('User selected alternative billing');\n * console.log('Token:', details.externalTransactionToken);\n * console.log('Products:', details.products);\n *\n * // Process payment in your system, then report token to Google\n * await processPaymentAndReportToken(details);\n * });\n *\n * // Later, clean up\n * subscription.remove();\n * ```\n *\n * @platform Android\n */\nexport const userChoiceBillingListenerAndroid = (\n listener: (details: UserChoiceBillingDetails) => void,\n) => {\n if (Platform.OS !== 'android') {\n ExpoIapConsole.warn(\n 'userChoiceBillingListenerAndroid: This listener is only available on Android',\n );\n return {remove: () => {}};\n }\n return emitter.addListener(OpenIapEvent.UserChoiceBillingAndroid, listener);\n};\n\n/**\n * Android-only listener for Developer Provided Billing events (External Payments).\n * This fires when a user selects the developer's payment option in the External Payments\n * side-by-side choice dialog during purchase flow.\n *\n * Requires Google Play Billing Library 8.3.0+ and is currently only available in Japan.\n *\n * @param listener - Callback function that receives the external transaction token\n * @returns EventSubscription that can be used to unsubscribe\n *\n * @example\n * ```typescript\n * const subscription = developerProvidedBillingListenerAndroid(async (details) => {\n * console.log('User selected developer billing');\n * console.log('Token:', details.externalTransactionToken);\n *\n * // Process payment with your payment gateway\n * await processPaymentWithYourGateway(details.externalTransactionToken);\n *\n * // IMPORTANT: Report the token to Google Play within 24 hours\n * await reportExternalTransactionToGoogle(details.externalTransactionToken);\n * });\n *\n * // Later, clean up\n * subscription.remove();\n * ```\n *\n * @platform Android (8.3.0+, Japan only)\n */\nexport const developerProvidedBillingListenerAndroid = (\n listener: (details: DeveloperProvidedBillingDetailsAndroid) => void,\n) => {\n if (Platform.OS !== 'android') {\n ExpoIapConsole.warn(\n 'developerProvidedBillingListenerAndroid: This listener is only available on Android',\n );\n return {remove: () => {}};\n }\n return emitter.addListener(\n OpenIapEvent.DeveloperProvidedBillingAndroid,\n listener,\n );\n};\n\n/**\n * Listen for subscription billing-issue events (cross-platform).\n *\n * Fires when a user's active subscription enters a state that needs attention\n * for a payment problem. Unifies:\n * - iOS 18+ / Mac Catalyst 18+: StoreKit 2 `Message.Reason.billingIssue`.\n * - Android (Play Billing 8.1+): when `Purchase.isSuspendedAndroid === true`.\n * - Meta Horizon / iOS 17 / older platforms: never fires.\n *\n * Recommended UX: call `deepLinkToSubscriptions()` when this fires so the user\n * can update their payment method in the platform subscription center.\n *\n * @example\n * ```typescript\n * const subscription = subscriptionBillingIssueListener((purchase) => {\n * console.warn('Needs attention:', purchase.productId);\n * deepLinkToSubscriptions({\n * skuAndroid: purchase.productId,\n * packageNameAndroid: 'com.example.app',\n * });\n * });\n * ```\n */\nexport const subscriptionBillingIssueListener = (\n listener: (purchase: Purchase) => void,\n) => {\n // Mirror purchaseUpdatedListener's platform normalization so consumers get\n // a consistent payload regardless of native casing.\n const wrappedListener = (event: Purchase) => {\n listener(normalizePurchasePlatform(event));\n };\n return emitter.addListener(\n OpenIapEvent.SubscriptionBillingIssue,\n wrappedListener,\n );\n};\n\nexport const initConnection: MutationField<'initConnection'> = async (config) =>\n ExpoIapModule.initConnection(config ?? null);\n\nexport const endConnection: MutationField<'endConnection'> = async () =>\n ExpoIapModule.endConnection();\n\n/**\n * Fetch products with unified API (v2.7.0+)\n *\n * @param request - Product fetch configuration\n * @param request.skus - Array of product SKUs to fetch\n * @param request.type - Product query type: 'in-app', 'subs', or 'all'\n */\nexport const fetchProducts: QueryField<'fetchProducts'> = async (request) => {\n ExpoIapConsole.debug('fetchProducts called with:', request);\n const {skus, type} = request ?? {};\n\n if (!Array.isArray(skus) || skus.length === 0) {\n throw createPurchaseError({\n message: 'No SKUs provided',\n code: ErrorCode.EmptySkuList,\n });\n }\n\n const {canonical, native} = normalizeProductType(\n type as ProductTypeInput | undefined,\n );\n const skuSet = new Set(skus);\n\n const filterIosItems = (\n items: unknown[],\n ): (Product | ProductSubscription)[] =>\n items.filter((item): item is Product | ProductSubscription => {\n if (!isProductIOS(item)) {\n return false;\n }\n const candidate = item as Product | ProductSubscription;\n return typeof candidate.id === 'string' && skuSet.has(candidate.id);\n });\n\n const filterAndroidItems = (\n items: unknown[],\n ): (Product | ProductSubscription)[] =>\n items.filter((item): item is Product | ProductSubscription => {\n if (!isProductAndroid(item)) {\n return false;\n }\n const candidate = item as Product | ProductSubscription;\n return typeof candidate.id === 'string' && skuSet.has(candidate.id);\n });\n\n const castResult = (\n items: (Product | ProductSubscription)[],\n ):\n | (Product | ProductSubscription)[]\n | Product[]\n | ProductSubscription[]\n | null => {\n if (canonical === 'in-app') {\n return items as Product[];\n }\n if (canonical === 'subs') {\n return items as ProductSubscription[];\n }\n // For 'all' type, items contain both Product and ProductSubscription\n // Return as ProductOrSubscription[] to preserve discriminated union\n return items;\n };\n\n if (Platform.OS === 'ios') {\n const rawItems = await ExpoIapModule.fetchProducts({skus, type: native});\n return castResult(filterIosItems(rawItems));\n }\n\n if (Platform.OS === 'android') {\n const rawItems = await ExpoIapModule.fetchProducts(native, skus);\n return castResult(filterAndroidItems(rawItems));\n }\n\n throw new Error('Unsupported platform');\n};\n\nexport const getAvailablePurchases: QueryField<\n 'getAvailablePurchases'\n> = async (options) => {\n const normalizedOptions: PurchaseOptions = {\n alsoPublishToEventListenerIOS:\n options?.alsoPublishToEventListenerIOS ?? false,\n onlyIncludeActiveItemsIOS: options?.onlyIncludeActiveItemsIOS ?? true,\n includeSuspendedAndroid: options?.includeSuspendedAndroid ?? false,\n };\n\n const resolvePurchases: () => Promise<Purchase[]> =\n Platform.select({\n ios: () =>\n ExpoIapModule.getAvailableItems(\n normalizedOptions.alsoPublishToEventListenerIOS,\n normalizedOptions.onlyIncludeActiveItemsIOS,\n ) as Promise<Purchase[]>,\n android: () =>\n ExpoIapModule.getAvailableItems(normalizedOptions) as Promise<\n Purchase[]\n >,\n }) ?? (() => Promise.resolve([] as Purchase[]));\n\n const purchases = await resolvePurchases();\n return normalizePurchaseArray(purchases as Purchase[]);\n};\n\n/**\n * Get all active subscriptions with detailed information.\n * Uses native OpenIAP module for accurate subscription status and renewal info.\n *\n * On iOS: Returns subscriptions with renewalInfoIOS containing pendingUpgradeProductId,\n * willAutoRenew, autoRenewPreference, and other renewal details.\n *\n * On Android: Filters available purchases to find active subscriptions (fallback implementation).\n *\n * @param subscriptionIds - Optional array of subscription product IDs to filter. If not provided, returns all active subscriptions.\n * @returns Promise resolving to array of active subscriptions with details\n *\n * @example\n * ```typescript\n * // Get all active subscriptions\n * const subs = await getActiveSubscriptions();\n *\n * // Get specific subscriptions\n * const premiumSubs = await getActiveSubscriptions(['premium', 'premium_year']);\n *\n * // Check for pending upgrades (iOS)\n * subs.forEach(sub => {\n * if (sub.renewalInfoIOS?.pendingUpgradeProductId) {\n * console.log(`Upgrade pending to: ${sub.renewalInfoIOS.pendingUpgradeProductId}`);\n * }\n * });\n * ```\n */\nexport const getActiveSubscriptions: QueryField<\n 'getActiveSubscriptions'\n> = async (subscriptionIds) => {\n const result = await ExpoIapModule.getActiveSubscriptions(\n subscriptionIds ?? null,\n );\n return (result ?? []) as ActiveSubscription[];\n};\n\n/**\n * Check if user has any active subscriptions.\n *\n * @param subscriptionIds - Optional array of subscription product IDs to check. If not provided, checks all subscriptions.\n * @returns Promise resolving to true if user has at least one active subscription\n *\n * @example\n * ```typescript\n * // Check any active subscription\n * const hasAny = await hasActiveSubscriptions();\n *\n * // Check specific subscriptions\n * const hasPremium = await hasActiveSubscriptions(['premium', 'premium_year']);\n * ```\n */\nexport const hasActiveSubscriptions: QueryField<\n 'hasActiveSubscriptions'\n> = async (subscriptionIds) => {\n return !!(await ExpoIapModule.hasActiveSubscriptions(\n subscriptionIds ?? null,\n ));\n};\n\nexport const getStorefront: QueryField<'getStorefront'> = async () => {\n if (Platform.OS !== 'ios' && Platform.OS !== 'android') {\n return '';\n }\n return ExpoIapModule.getStorefront();\n};\n\n/**\n * Helper to normalize request props to platform-specific format\n */\nfunction normalizeRequestProps(\n request: RequestPurchasePropsByPlatforms,\n platform: 'ios',\n): RequestPurchaseIosProps | null | undefined;\nfunction normalizeRequestProps(\n request: RequestPurchasePropsByPlatforms,\n platform: 'android',\n): RequestPurchaseAndroidProps | null | undefined;\nfunction normalizeRequestProps(\n request: RequestSubscriptionPropsByPlatforms,\n platform: 'ios',\n): RequestSubscriptionIosProps | null | undefined;\nfunction normalizeRequestProps(\n request: RequestSubscriptionPropsByPlatforms,\n platform: 'android',\n): RequestSubscriptionAndroidProps | null | undefined;\nfunction normalizeRequestProps(\n request:\n | RequestPurchasePropsByPlatforms\n | RequestSubscriptionPropsByPlatforms,\n platform: 'ios' | 'android',\n) {\n // Support both new (apple/google) and legacy (ios/android) field names\n // New fields take precedence over deprecated ones\n if (platform === 'ios') {\n return request.apple ?? request.ios;\n }\n return request.google ?? request.android;\n}\n\n/**\n * Request a purchase for products or subscriptions.\n *\n * @param requestObj - Purchase request configuration\n * @param requestObj.request - Store-specific purchase parameters\n * @param requestObj.type - Type of purchase: 'in-app' for products (default) or 'subs' for subscriptions\n *\n * @example\n * ```typescript\n * // Product purchase (recommended: use apple/google)\n * await requestPurchase({\n * request: {\n * apple: { sku: productId },\n * google: { skus: [productId] }\n * },\n * type: 'in-app'\n * });\n *\n * // Subscription purchase\n * await requestPurchase({\n * request: {\n * apple: { sku: subscriptionId },\n * google: {\n * skus: [subscriptionId],\n * subscriptionOffers: [{ sku: subscriptionId, offerToken: 'token' }]\n * }\n * },\n * type: 'subs'\n * });\n *\n * // Legacy format (deprecated, but still supported)\n * await requestPurchase({\n * request: {\n * ios: { sku: productId },\n * android: { skus: [productId] }\n * },\n * type: 'in-app'\n * });\n * ```\n */\nexport const requestPurchase: MutationField<'requestPurchase'> = async (\n args,\n) => {\n const {request, type} = args;\n const {canonical, native} = normalizeProductType(type as ProductTypeInput);\n const isInAppPurchase = canonical === 'in-app';\n\n if (Platform.OS === 'ios') {\n const normalizedRequest = normalizeRequestProps(request, 'ios');\n\n if (!normalizedRequest?.sku) {\n throw new Error(\n 'Invalid request for Apple. The `sku` property is required and must be a string.\\n\\n' +\n 'Expected format:\\n' +\n ' requestPurchase({\\n' +\n ' request: {\\n' +\n ' apple: { sku: \"product_id\" },\\n' +\n ' google: { skus: [\"product_id\"] }\\n' +\n ' },\\n' +\n ' type: \"in-app\"\\n' +\n ' })\\n\\n' +\n 'See: https://hyochan.github.io/expo-iap/docs/api/methods/core-methods#requestpurchase',\n );\n }\n\n if (canonical !== 'in-app' && canonical !== 'subs') {\n throw new Error(`Unsupported product type: ${canonical}`);\n }\n\n const payload: MutationRequestPurchaseArgs = {\n type: canonical === 'in-app' ? 'in-app' : 'subs',\n request: {ios: normalizedRequest},\n useAlternativeBilling: args.useAlternativeBilling,\n };\n\n const purchase = (await ExpoIapModule.requestPurchase(payload)) as\n | Purchase\n | Purchase[]\n | null;\n\n if (Array.isArray(purchase)) {\n return normalizePurchaseArray(purchase);\n }\n\n if (purchase) {\n return normalizePurchasePlatform(purchase);\n }\n\n return canonical === 'subs' ? [] : null;\n }\n\n if (Platform.OS === 'android') {\n if (isInAppPurchase) {\n const normalizedRequest = normalizeRequestProps(\n request as RequestPurchasePropsByPlatforms,\n 'android',\n ) as RequestPurchaseAndroidProps | null | undefined;\n\n if (!normalizedRequest?.skus?.length) {\n throw new Error(\n 'Invalid request for Google. The `skus` property is required and must be a non-empty array.\\n\\n' +\n 'Expected format:\\n' +\n ' requestPurchase({\\n' +\n ' request: {\\n' +\n ' apple: { sku: \"product_id\" },\\n' +\n ' google: { skus: [\"product_id\"] }\\n' +\n ' },\\n' +\n ' type: \"in-app\"\\n' +\n ' })\\n\\n' +\n 'See: https://hyochan.github.io/expo-iap/docs/api/methods/core-methods#requestpurchase',\n );\n }\n\n const {\n skus,\n obfuscatedAccountId,\n obfuscatedProfileId,\n isOfferPersonalized,\n offerToken,\n } = normalizedRequest;\n\n const result = (await ExpoIapModule.requestPurchase({\n type: native,\n skuArr: skus,\n purchaseToken: undefined,\n replacementMode: -1,\n obfuscatedAccountId: obfuscatedAccountId,\n obfuscatedProfileId: obfuscatedProfileId,\n offerToken: offerToken,\n offerTokenArr: [],\n isOfferPersonalized: isOfferPersonalized ?? false,\n })) as Purchase[];\n\n return normalizePurchaseArray(result);\n }\n\n if (canonical === 'subs') {\n const normalizedRequest = normalizeRequestProps(\n request as RequestSubscriptionPropsByPlatforms,\n 'android',\n ) as RequestSubscriptionAndroidProps | null | undefined;\n\n if (!normalizedRequest?.skus?.length) {\n throw new Error(\n 'Invalid request for Google. The `skus` property is required and must be a non-empty array.\\n\\n' +\n 'Expected format:\\n' +\n ' requestPurchase({\\n' +\n ' request: {\\n' +\n ' apple: { sku: \"subscription_id\" },\\n' +\n ' google: { skus: [\"subscription_id\"] }\\n' +\n ' },\\n' +\n ' type: \"subs\"\\n' +\n ' })\\n\\n' +\n 'See: https://hyochan.github.io/expo-iap/docs/api/methods/core-methods#requestpurchase',\n );\n }\n\n const {\n skus,\n obfuscatedAccountId,\n obfuscatedProfileId,\n isOfferPersonalized,\n subscriptionOffers,\n replacementMode: replacementModeInput,\n purchaseToken: purchaseTokenInput,\n subscriptionProductReplacementParams,\n } = normalizedRequest;\n\n const normalizedOffers = subscriptionOffers ?? [];\n const replacementMode = replacementModeInput ?? -1;\n const purchaseToken = purchaseTokenInput ?? undefined;\n\n const result = (await ExpoIapModule.requestPurchase({\n type: native,\n skuArr: skus,\n purchaseToken,\n replacementMode,\n obfuscatedAccountId: obfuscatedAccountId,\n obfuscatedProfileId: obfuscatedProfileId,\n offerTokenArr: normalizedOffers.map(\n (offer: AndroidSubscriptionOfferInput) => offer.offerToken,\n ),\n subscriptionOffers: normalizedOffers,\n isOfferPersonalized: isOfferPersonalized ?? false,\n subscriptionProductReplacementParams:\n subscriptionProductReplacementParams ?? undefined,\n })) as Purchase[];\n\n return normalizePurchaseArray(result);\n }\n\n throw new Error(\n \"Invalid request for Android: Expected a valid request object with 'skus' array.\",\n );\n }\n\n throw new Error('Platform not supported');\n};\n\nexport const finishTransaction: MutationField<'finishTransaction'> = async ({\n purchase,\n isConsumable = false,\n}) => {\n if (Platform.OS === 'ios') {\n await ExpoIapModule.finishTransaction(purchase, isConsumable);\n return;\n }\n\n if (Platform.OS === 'android') {\n const token = purchase.purchaseToken ?? undefined;\n\n if (!token) {\n throw createPurchaseError({\n message: 'Purchase token is required to finish transaction',\n code: ErrorCode.DeveloperError,\n productId: purchase.productId,\n platform: 'android',\n });\n }\n\n if (isConsumable) {\n await ExpoIapModule.consumePurchaseAndroid(token);\n return;\n }\n\n await ExpoIapModule.acknowledgePurchaseAndroid(token);\n return;\n }\n\n throw new Error('Unsupported Platform');\n};\n\n/**\n * Restore completed transactions (cross-platform behavior)\n *\n * - iOS: perform a lightweight sync to refresh transactions and ignore sync errors,\n * then fetch available purchases to surface restored items to the app.\n * - Android: simply fetch available purchases (restoration happens via query).\n *\n * This helper triggers the refresh flows but does not return the purchases; consumers should\n * call `getAvailablePurchases` or rely on hook state to inspect the latest items.\n */\nexport const restorePurchases: MutationField<'restorePurchases'> = async () => {\n if (Platform.OS === 'ios') {\n await syncIOS().catch(() => undefined);\n }\n\n await getAvailablePurchases({\n alsoPublishToEventListenerIOS: false,\n onlyIncludeActiveItemsIOS: true,\n });\n};\n\n/**\n * Deeplinks to native interface that allows users to manage their subscriptions\n * @param options.skuAndroid - Required for Android to locate specific subscription (ignored on iOS)\n * @param options.packageNameAndroid - Required for Android to identify your app (ignored on iOS)\n *\n * @returns Promise that resolves when the deep link is successfully opened\n *\n * @throws {Error} When called on unsupported platform or when required Android parameters are missing\n *\n * @example\n * import { deepLinkToSubscriptions } from 'expo-iap';\n *\n * // Works on both iOS and Android\n * await deepLinkToSubscriptions({\n * skuAndroid: 'your_subscription_sku',\n * packageNameAndroid: 'com.example.app'\n * });\n */\nexport const deepLinkToSubscriptions: MutationField<\n 'deepLinkToSubscriptions'\n> = async (options) => {\n if (Platform.OS === 'ios') {\n await deepLinkToSubscriptionsIOS();\n return;\n }\n\n if (Platform.OS === 'android') {\n await deepLinkToSubscriptionsAndroid((options as DeepLinkOptions) ?? null);\n return;\n }\n\n throw new Error(`Unsupported platform: ${Platform.OS}`);\n};\n\n/**\n * Internal receipt validation function (NOT RECOMMENDED for production use)\n *\n * WARNING: This function performs client-side validation which is NOT secure.\n * For production apps, always validate receipts on your secure server:\n * - iOS: Send receipt data to Apple's verification endpoint from your server\n * - Android: Use Google Play Developer API with service account credentials\n *\n * @deprecated Use verifyPurchase instead\n */\nexport const validateReceipt: MutationField<'validateReceipt'> = async (\n options,\n) => {\n const {apple, google} = options as MutationValidateReceiptArgs;\n\n if (Platform.OS === 'ios') {\n if (!apple?.sku) {\n throw new Error('iOS validation requires apple.sku');\n }\n return validateReceiptIOS({apple: {sku: apple.sku}});\n }\n\n if (Platform.OS === 'android') {\n if (\n !google ||\n !google.sku ||\n !google.packageName ||\n !google.purchaseToken ||\n !google.accessToken\n ) {\n throw new Error(\n 'Android validation requires google.sku, google.packageName, google.purchaseToken, and google.accessToken',\n );\n }\n return validateReceiptAndroid({\n packageName: google.packageName,\n productId: google.sku,\n productToken: google.purchaseToken,\n accessToken: google.accessToken,\n isSub: google.isSub ?? undefined,\n });\n }\n\n throw new Error('Platform not supported');\n};\n\n/**\n * Verify purchase with the configured providers\n *\n * This function uses the native OpenIAP verifyPurchase implementation\n * which validates purchases using platform-specific methods.\n *\n * @param options - Receipt validation options containing the SKU\n * @returns Promise resolving to receipt validation result\n */\nexport const verifyPurchase: MutationField<'verifyPurchase'> = async (\n options,\n) => {\n if (Platform.OS === 'ios' || Platform.OS === 'android') {\n return ExpoIapModule.verifyPurchase(options);\n }\n\n throw new Error(`Unsupported platform: ${Platform.OS}`);\n};\n\n/**\n * Verify purchase with a specific provider (e.g., IAPKit)\n *\n * This function allows you to verify purchases using external verification\n * services like IAPKit, which provide additional validation and security.\n *\n * @param options - Verification options including provider and credentials\n * @returns Promise resolving to provider-specific verification result\n *\n * @example\n * ```typescript\n * const result = await verifyPurchaseWithProvider({\n * provider: 'iapkit',\n * iapkit: {\n * apiKey: 'your-api-key',\n * apple: {\n * jws: purchase.purchaseToken // JWS from purchase\n * },\n * google: {\n * purchaseToken: purchase.purchaseToken\n * }\n * }\n * });\n * ```\n */\nexport const verifyPurchaseWithProvider: MutationField<\n 'verifyPurchaseWithProvider'\n> = async (options) => {\n if (Platform.OS === 'ios' || Platform.OS === 'android') {\n // Auto-fill apiKey from config if not provided and provider is iapkit\n if (\n options.provider === 'iapkit' &&\n options.iapkit &&\n !options.iapkit.apiKey\n ) {\n try {\n // Dynamically import expo-constants to avoid hard dependency\n const {default: Constants} = await import('expo-constants');\n const configApiKey = Constants.expoConfig?.extra?.iapkitApiKey;\n if (configApiKey) {\n options = {\n ...options,\n iapkit: {\n ...options.iapkit,\n apiKey: configApiKey,\n },\n };\n }\n } catch {\n throw new Error(\n 'expo-constants is required for auto-filling iapkitApiKey from config. ' +\n 'Please install it: npx expo install expo-constants\\n' +\n 'Or provide apiKey directly in verifyPurchaseWithProvider options.',\n );\n }\n }\n return ExpoIapModule.verifyPurchaseWithProvider(options);\n }\n\n throw new Error(`Unsupported platform: ${Platform.OS}`);\n};\n\nexport * from './useIAP';\nexport {\n ErrorCodeUtils,\n ErrorCodeMapping,\n createPurchaseError,\n createPurchaseErrorFromPlatform,\n} from './utils/errorMapping';\nexport type {\n PurchaseError as ExpoPurchaseError,\n PurchaseErrorProps,\n} from './utils/errorMapping';\nexport {ExpoIapConsole} from './utils/debug';\n"]}
|
|
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;gBACH,6DAA6D;gBAC7D,MAAM,EAAC,OAAO,EAAE,SAAS,EAAC,GAAG,MAAM,MAAM,CAAC,gBAAgB,CAAC,CAAC;gBAC5D,MAAM,YAAY,GAAG,SAAS,CAAC,UAAU,EAAE,KAAK,EAAE,YAAY,CAAC;gBAC/D,IAAI,YAAY,EAAE,CAAC;oBACjB,OAAO,GAAG;wBACR,GAAG,OAAO;wBACV,MAAM,EAAE;4BACN,GAAG,OAAO,CAAC,MAAM;4BACjB,MAAM,EAAE,YAAY;yBACrB;qBACF,CAAC;gBACJ,CAAC;YACH,CAAC;YAAC,MAAM,CAAC;gBACP,MAAM,IAAI,KAAK,CACb,wEAAwE;oBACtE,sDAAsD;oBACtD,mEAAmE,CACtE,CAAC;YACJ,CAAC;QACH,CAAC;QACD,OAAO,aAAa,CAAC,0BAA0B,CAAC,OAAO,CAAC,CAAC;IAC3D,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,yBAAyB,QAAQ,CAAC,EAAE,EAAE,CAAC,CAAC;AAC1D,CAAC,CAAC;AAEF,cAAc,UAAU,CAAC;AACzB,OAAO,EAAC,gBAAgB,EAAC,MAAM,oBAAoB,CAAC;AAKpD,OAAO,EAAC,oBAAoB,EAAE,qBAAqB,EAAC,MAAM,kBAAkB,CAAC;AAS7E,OAAO,EAAC,MAAM,EAAE,WAAW,EAAC,MAAM,WAAW,CAAC;AAO9C,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,mBAAmB,EACnB,+BAA+B,GAChC,MAAM,sBAAsB,CAAC;AAK9B,OAAO,EAAC,cAAc,EAAC,MAAM,eAAe,CAAC","sourcesContent":["// External dependencies\nimport {Platform} from 'react-native';\n\n// Internal modules\nimport ExpoIapModule, {getNativeModule} from './ExpoIapModule';\nimport {\n isProductIOS,\n validateReceiptIOS,\n deepLinkToSubscriptionsIOS,\n syncIOS,\n} from './modules/ios';\nimport {\n isProductAndroid,\n validateReceiptAndroid,\n deepLinkToSubscriptionsAndroid,\n} from './modules/android';\nimport {ExpoIapConsole} from './utils/debug';\n\n// Types\nimport type {\n ActiveSubscription,\n AndroidSubscriptionOfferInput,\n DeepLinkOptions,\n DeveloperProvidedBillingDetailsAndroid,\n MutationField,\n MutationRequestPurchaseArgs,\n MutationValidateReceiptArgs,\n Product,\n ProductQueryType,\n ProductSubscription,\n Purchase,\n PurchaseOptions,\n QueryField,\n RequestPurchasePropsByPlatforms,\n RequestPurchaseAndroidProps,\n RequestPurchaseIosProps,\n RequestSubscriptionPropsByPlatforms,\n RequestSubscriptionAndroidProps,\n RequestSubscriptionIosProps,\n UserChoiceBillingDetails,\n} from './types';\nimport {ErrorCode} from './types';\nimport {createPurchaseError, type PurchaseError} from './utils/errorMapping';\n\n// Export all types\nexport * from './types';\nexport * from './modules/android';\nexport * from './modules/ios';\nexport * from './onside';\n\n// Get the native constant value\nexport enum OpenIapEvent {\n PurchaseUpdated = 'purchase-updated',\n PurchaseError = 'purchase-error',\n PromotedProductIOS = 'promoted-product-ios',\n UserChoiceBillingAndroid = 'user-choice-billing-android',\n /**\n * Fired when user selects developer billing in External Payments flow (Android 8.3.0+)\n * Only available in Japan. Contains externalTransactionToken for reporting.\n */\n DeveloperProvidedBillingAndroid = 'developer-provided-billing-android',\n /**\n * Fired when an active subscription enters a billing-issue state (cross-platform).\n * Unifies StoreKit 2 `Message.Reason.billingIssue` (iOS 18+) and Play Billing 8.1+\n * `Purchase.isSuspended`. NOT fired on the Meta Horizon flavor.\n */\n SubscriptionBillingIssue = 'subscription-billing-issue',\n}\n\ntype ExpoIapEventPayloads = {\n [OpenIapEvent.PurchaseUpdated]: Purchase;\n [OpenIapEvent.PurchaseError]: PurchaseError;\n [OpenIapEvent.PromotedProductIOS]: Product;\n [OpenIapEvent.UserChoiceBillingAndroid]: UserChoiceBillingDetails;\n [OpenIapEvent.DeveloperProvidedBillingAndroid]: DeveloperProvidedBillingDetailsAndroid;\n [OpenIapEvent.SubscriptionBillingIssue]: Purchase;\n};\n\ntype ExpoIapEventListener<E extends OpenIapEvent> = (\n payload: ExpoIapEventPayloads[E],\n) => void;\n\ntype ExpoIapEmitter = {\n addListener<E extends OpenIapEvent>(\n eventName: E,\n listener: ExpoIapEventListener<E>,\n ): {remove: () => void};\n removeListener<E extends OpenIapEvent>(\n eventName: E,\n listener: ExpoIapEventListener<E>,\n ): void;\n};\n\n// Use the raw native module for listener calls — JSI HostObjects require the\n// real native module as `this` when calling addListener. Using a Proxy as\n// `this` triggers \"native state unsupported on Proxy\" on New Architecture / Hermes.\n// Resolved lazily so importing this module doesn't throw on unsupported platforms.\nexport const emitter: ExpoIapEmitter = {\n addListener(eventName, listener) {\n return getNativeModule().addListener(eventName, listener);\n },\n removeListener(eventName, listener) {\n return getNativeModule().removeListener(eventName, listener);\n },\n};\n\n/**\n * TODO(v3.1.0): Remove legacy 'inapp' alias once downstream apps migrate to 'in-app'.\n */\nexport type ProductTypeInput = ProductQueryType | 'inapp';\n\nconst normalizeProductType = (type?: ProductTypeInput) => {\n if (type === 'inapp') {\n ExpoIapConsole.warn(\n \"'inapp' product type is deprecated and will be removed in v3.1.0. Use 'in-app' instead.\",\n );\n }\n\n if (!type || type === 'inapp' || type === 'in-app') {\n return {\n canonical: 'in-app' as ProductQueryType,\n native: 'in-app' as const,\n };\n }\n if (type === 'subs') {\n return {\n canonical: 'subs' as ProductQueryType,\n native: 'subs' as const,\n };\n }\n if (type === 'all') {\n return {\n canonical: 'all' as ProductQueryType,\n native: 'all' as const,\n };\n }\n throw new Error(`Unsupported product type: ${type}`);\n};\n\nconst normalizePurchasePlatform = (purchase: Purchase): Purchase => {\n const platform = purchase.platform;\n if (typeof platform !== 'string') {\n return purchase;\n }\n\n const lowered = platform.toLowerCase();\n if (lowered === platform || (lowered !== 'ios' && lowered !== 'android')) {\n return purchase;\n }\n\n return {...purchase, platform: lowered};\n};\n\nconst normalizePurchaseArray = (purchases: Purchase[]): Purchase[] =>\n purchases.map((purchase) => normalizePurchasePlatform(purchase));\n\nexport const purchaseUpdatedListener = (\n listener: (event: Purchase) => void,\n) => {\n const wrappedListener = (event: Purchase) => {\n const normalized = normalizePurchasePlatform(event);\n listener(normalized);\n };\n const emitterSubscription = emitter.addListener(\n OpenIapEvent.PurchaseUpdated,\n wrappedListener,\n );\n return emitterSubscription;\n};\n\nexport const purchaseErrorListener = (\n listener: (error: PurchaseError) => void,\n) => {\n const wrappedListener = (error: PurchaseError) => {\n listener(error);\n };\n const emitterSubscription = emitter.addListener(\n OpenIapEvent.PurchaseError,\n wrappedListener,\n );\n return emitterSubscription;\n};\n\n/**\n * iOS-only listener for App Store promoted product events.\n * This fires when a user taps on a promoted product in the App Store.\n *\n * @param listener - Callback function that receives the promoted product details\n * @returns EventSubscription that can be used to unsubscribe\n *\n * @example\n * ```typescript\n * const subscription = promotedProductListenerIOS((product) => {\n * console.log('Promoted product:', product);\n * // Handle the promoted product\n * });\n *\n * // Later, clean up\n * subscription.remove();\n * ```\n *\n * @platform iOS\n */\nexport const promotedProductListenerIOS = (\n listener: (product: Product) => void,\n) => {\n if (Platform.OS !== 'ios') {\n ExpoIapConsole.warn(\n 'promotedProductListenerIOS: This listener is only available on iOS',\n );\n return {remove: () => {}};\n }\n return emitter.addListener(OpenIapEvent.PromotedProductIOS, listener);\n};\n\n/**\n * Android-only listener for User Choice Billing events.\n * This fires when a user selects alternative billing instead of Google Play billing\n * in the User Choice Billing dialog (only in 'user-choice' mode).\n *\n * @param listener - Callback function that receives the external transaction token and product IDs\n * @returns EventSubscription that can be used to unsubscribe\n *\n * @example\n * ```typescript\n * const subscription = userChoiceBillingListenerAndroid((details) => {\n * console.log('User selected alternative billing');\n * console.log('Token:', details.externalTransactionToken);\n * console.log('Products:', details.products);\n *\n * // Process payment in your system, then report token to Google\n * await processPaymentAndReportToken(details);\n * });\n *\n * // Later, clean up\n * subscription.remove();\n * ```\n *\n * @platform Android\n */\nexport const userChoiceBillingListenerAndroid = (\n listener: (details: UserChoiceBillingDetails) => void,\n) => {\n if (Platform.OS !== 'android') {\n ExpoIapConsole.warn(\n 'userChoiceBillingListenerAndroid: This listener is only available on Android',\n );\n return {remove: () => {}};\n }\n return emitter.addListener(OpenIapEvent.UserChoiceBillingAndroid, listener);\n};\n\n/**\n * Android-only listener for Developer Provided Billing events (External Payments).\n * This fires when a user selects the developer's payment option in the External Payments\n * side-by-side choice dialog during purchase flow.\n *\n * Requires Google Play Billing Library 8.3.0+ and is currently only available in Japan.\n *\n * @param listener - Callback function that receives the external transaction token\n * @returns EventSubscription that can be used to unsubscribe\n *\n * @example\n * ```typescript\n * const subscription = developerProvidedBillingListenerAndroid(async (details) => {\n * console.log('User selected developer billing');\n * console.log('Token:', details.externalTransactionToken);\n *\n * // Process payment with your payment gateway\n * await processPaymentWithYourGateway(details.externalTransactionToken);\n *\n * // IMPORTANT: Report the token to Google Play within 24 hours\n * await reportExternalTransactionToGoogle(details.externalTransactionToken);\n * });\n *\n * // Later, clean up\n * subscription.remove();\n * ```\n *\n * @platform Android (8.3.0+, Japan only)\n */\nexport const developerProvidedBillingListenerAndroid = (\n listener: (details: DeveloperProvidedBillingDetailsAndroid) => void,\n) => {\n if (Platform.OS !== 'android') {\n ExpoIapConsole.warn(\n 'developerProvidedBillingListenerAndroid: This listener is only available on Android',\n );\n return {remove: () => {}};\n }\n return emitter.addListener(\n OpenIapEvent.DeveloperProvidedBillingAndroid,\n listener,\n );\n};\n\n/**\n * Listen for subscription billing-issue events (cross-platform).\n *\n * Fires when a user's active subscription enters a state that needs attention\n * for a payment problem. Unifies:\n * - iOS 18+ / Mac Catalyst 18+: StoreKit 2 `Message.Reason.billingIssue`.\n * - Android (Play Billing 8.1+): when `Purchase.isSuspendedAndroid === true`.\n * - Meta Horizon / iOS 17 / older platforms: never fires.\n *\n * Recommended UX: call `deepLinkToSubscriptions()` when this fires so the user\n * can update their payment method in the platform subscription center.\n *\n * @example\n * ```typescript\n * const subscription = subscriptionBillingIssueListener((purchase) => {\n * console.warn('Needs attention:', purchase.productId);\n * deepLinkToSubscriptions({\n * skuAndroid: purchase.productId,\n * packageNameAndroid: 'com.example.app',\n * });\n * });\n * ```\n */\nexport const subscriptionBillingIssueListener = (\n listener: (purchase: Purchase) => void,\n) => {\n // Mirror purchaseUpdatedListener's platform normalization so consumers get\n // a consistent payload regardless of native casing.\n const wrappedListener = (event: Purchase) => {\n listener(normalizePurchasePlatform(event));\n };\n return emitter.addListener(\n OpenIapEvent.SubscriptionBillingIssue,\n wrappedListener,\n );\n};\n\n/**\n * Initialize the store connection. Must be called before any other IAP API.\n *\n * @param config Optional connection config. Use `enableBillingProgramAndroid` (Android,\n * Play Billing 8.2.0+) to opt into External Payments etc. iOS ignores Android-specific fields.\n * @returns Promise resolving to `true` when the platform billing client is connected.\n * @throws When the platform billing client fails to initialize.\n *\n * @example\n * ```ts\n * await initConnection();\n * await initConnection({ enableBillingProgramAndroid: 'external-offer' });\n * ```\n *\n * @remarks When using `useIAP()`, connection is auto-managed on mount/unmount —\n * pass options to the hook instead of calling this directly.\n *\n * @see {@link https://www.openiap.dev/docs/apis/init-connection}\n */\nexport const initConnection: MutationField<'initConnection'> = async (config) =>\n ExpoIapModule.initConnection(config ?? null);\n\n/**\n * Close the store connection and release resources.\n *\n * @see {@link https://www.openiap.dev/docs/apis/end-connection}\n */\nexport const endConnection: MutationField<'endConnection'> = async () =>\n ExpoIapModule.endConnection();\n\n/**\n * Retrieve products or subscriptions from the store by SKU.\n *\n * @param request `ProductRequest` — `skus` (string[]) and optional `type`\n * (`'in-app' | 'subs' | 'all'`, defaults to `'in-app'`).\n * @returns Promise resolving to a `FetchProductsResult` union — `Product[]` for `'in-app'`,\n * `ProductSubscription[]` for `'subs'`, or a mixed array for `'all'`.\n * @throws When the store rejects the request (empty `skus`, not connected,\n * network/store error). Unknown SKUs are simply omitted from the result, not thrown.\n *\n * @example\n * ```ts\n * const products = await fetchProducts({\n * skus: ['com.app.coins_100', 'com.app.premium'],\n * type: 'in-app',\n * });\n * ```\n *\n * @remarks This is a regular promise-based call. Don't confuse with `request*` APIs\n * (`requestPurchase`), which are event-based.\n *\n * @see {@link https://www.openiap.dev/docs/apis/fetch-products}\n */\nexport const fetchProducts: QueryField<'fetchProducts'> = async (request) => {\n ExpoIapConsole.debug('fetchProducts called with:', request);\n const {skus, type} = request ?? {};\n\n if (!Array.isArray(skus) || skus.length === 0) {\n throw createPurchaseError({\n message: 'No SKUs provided',\n code: ErrorCode.EmptySkuList,\n });\n }\n\n const {canonical, native} = normalizeProductType(\n type as ProductTypeInput | undefined,\n );\n const skuSet = new Set(skus);\n\n const filterIosItems = (\n items: unknown[],\n ): (Product | ProductSubscription)[] =>\n items.filter((item): item is Product | ProductSubscription => {\n if (!isProductIOS(item)) {\n return false;\n }\n const candidate = item as Product | ProductSubscription;\n return typeof candidate.id === 'string' && skuSet.has(candidate.id);\n });\n\n const filterAndroidItems = (\n items: unknown[],\n ): (Product | ProductSubscription)[] =>\n items.filter((item): item is Product | ProductSubscription => {\n if (!isProductAndroid(item)) {\n return false;\n }\n const candidate = item as Product | ProductSubscription;\n return typeof candidate.id === 'string' && skuSet.has(candidate.id);\n });\n\n const castResult = (\n items: (Product | ProductSubscription)[],\n ):\n | (Product | ProductSubscription)[]\n | Product[]\n | ProductSubscription[]\n | null => {\n if (canonical === 'in-app') {\n return items as Product[];\n }\n if (canonical === 'subs') {\n return items as ProductSubscription[];\n }\n // For 'all' type, items contain both Product and ProductSubscription\n // Return as ProductOrSubscription[] to preserve discriminated union\n return items;\n };\n\n if (Platform.OS === 'ios') {\n const rawItems = await ExpoIapModule.fetchProducts({skus, type: native});\n return castResult(filterIosItems(rawItems));\n }\n\n if (Platform.OS === 'android') {\n const rawItems = await ExpoIapModule.fetchProducts(native, skus);\n return castResult(filterAndroidItems(rawItems));\n }\n\n throw new Error('Unsupported platform');\n};\n\n/**\n * List the user's unfinished purchases — non-consumables, active subscriptions, and any\n * pending transactions not yet finished.\n *\n * @param options Optional `PurchaseOptions`. iOS-only flags:\n * `alsoPublishToEventListenerIOS`, `onlyIncludeActiveItemsIOS`.\n * @returns Promise resolving to an array of `Purchase` currently held by the store.\n * @throws When the platform query fails.\n *\n * @example\n * ```ts\n * const purchases = await getAvailablePurchases();\n * for (const p of purchases) {\n * if (await verifyOnServer(p)) await finishTransaction({ purchase: p, isConsumable: false });\n * }\n * ```\n *\n * @see {@link https://www.openiap.dev/docs/apis/get-available-purchases}\n */\nexport const getAvailablePurchases: QueryField<\n 'getAvailablePurchases'\n> = async (options) => {\n const normalizedOptions: PurchaseOptions = {\n alsoPublishToEventListenerIOS:\n options?.alsoPublishToEventListenerIOS ?? false,\n onlyIncludeActiveItemsIOS: options?.onlyIncludeActiveItemsIOS ?? true,\n includeSuspendedAndroid: options?.includeSuspendedAndroid ?? false,\n };\n\n const resolvePurchases: () => Promise<Purchase[]> =\n Platform.select({\n ios: () =>\n ExpoIapModule.getAvailableItems(\n normalizedOptions.alsoPublishToEventListenerIOS,\n normalizedOptions.onlyIncludeActiveItemsIOS,\n ) as Promise<Purchase[]>,\n android: () =>\n ExpoIapModule.getAvailableItems(normalizedOptions) as Promise<\n Purchase[]\n >,\n }) ?? (() => Promise.resolve([] as Purchase[]));\n\n const purchases = await resolvePurchases();\n return normalizePurchaseArray(purchases as Purchase[]);\n};\n\n/**\n * Get all active subscriptions with detailed information.\n * Uses native OpenIAP module for accurate subscription status and renewal info.\n *\n * On iOS: Returns subscriptions with renewalInfoIOS containing pendingUpgradeProductId,\n * willAutoRenew, autoRenewPreference, and other renewal details.\n *\n * On Android: Filters available purchases to find active subscriptions (fallback implementation).\n *\n * @param subscriptionIds - Optional array of subscription product IDs to filter. If not provided, returns all active subscriptions.\n * @returns Promise resolving to array of active subscriptions with details\n *\n * @example\n * ```typescript\n * // Get all active subscriptions\n * const subs = await getActiveSubscriptions();\n *\n * // Get specific subscriptions\n * const premiumSubs = await getActiveSubscriptions(['premium', 'premium_year']);\n *\n * // Check for pending upgrades (iOS)\n * subs.forEach(sub => {\n * if (sub.renewalInfoIOS?.pendingUpgradeProductId) {\n * console.log(`Upgrade pending to: ${sub.renewalInfoIOS.pendingUpgradeProductId}`);\n * }\n * });\n * ```\n *\n * @see {@link https://www.openiap.dev/docs/apis/get-active-subscriptions}\n */\nexport const getActiveSubscriptions: QueryField<\n 'getActiveSubscriptions'\n> = async (subscriptionIds) => {\n const result = await ExpoIapModule.getActiveSubscriptions(\n subscriptionIds ?? null,\n );\n return (result ?? []) as ActiveSubscription[];\n};\n\n/**\n * Check if user has any active subscriptions.\n *\n * @param subscriptionIds - Optional array of subscription product IDs to check. If not provided, checks all subscriptions.\n * @returns Promise resolving to true if user has at least one active subscription\n *\n * @example\n * ```typescript\n * // Check any active subscription\n * const hasAny = await hasActiveSubscriptions();\n *\n * // Check specific subscriptions\n * const hasPremium = await hasActiveSubscriptions(['premium', 'premium_year']);\n * ```\n *\n * @see {@link https://www.openiap.dev/docs/apis/has-active-subscriptions}\n */\nexport const hasActiveSubscriptions: QueryField<\n 'hasActiveSubscriptions'\n> = async (subscriptionIds) => {\n return !!(await ExpoIapModule.hasActiveSubscriptions(\n subscriptionIds ?? null,\n ));\n};\n\n/**\n * Return the user's storefront country code.\n *\n * @see {@link https://www.openiap.dev/docs/apis/get-storefront}\n */\nexport const getStorefront: QueryField<'getStorefront'> = async () => {\n if (Platform.OS !== 'ios' && Platform.OS !== 'android') {\n return '';\n }\n return ExpoIapModule.getStorefront();\n};\n\n/**\n * Helper to normalize request props to platform-specific format\n */\nfunction normalizeRequestProps(\n request: RequestPurchasePropsByPlatforms,\n platform: 'ios',\n): RequestPurchaseIosProps | null | undefined;\nfunction normalizeRequestProps(\n request: RequestPurchasePropsByPlatforms,\n platform: 'android',\n): RequestPurchaseAndroidProps | null | undefined;\nfunction normalizeRequestProps(\n request: RequestSubscriptionPropsByPlatforms,\n platform: 'ios',\n): RequestSubscriptionIosProps | null | undefined;\nfunction normalizeRequestProps(\n request: RequestSubscriptionPropsByPlatforms,\n platform: 'android',\n): RequestSubscriptionAndroidProps | null | undefined;\nfunction normalizeRequestProps(\n request:\n | RequestPurchasePropsByPlatforms\n | RequestSubscriptionPropsByPlatforms,\n platform: 'ios' | 'android',\n) {\n // Support both new (apple/google) and legacy (ios/android) field names\n // New fields take precedence over deprecated ones\n if (platform === 'ios') {\n return request.apple ?? request.ios;\n }\n return request.google ?? request.android;\n}\n\n/**\n * Initiate a purchase or subscription flow. The result is delivered through\n * `purchaseUpdatedListener` — NOT the return value.\n *\n * @param args `RequestPurchaseProps`, discriminated by `type`:\n * - `type: 'in-app'` — pass `request.apple.sku` (iOS) and/or `request.google.skus` (Android).\n * - `type: 'subs'` — same shape, plus `request.google.subscriptionOffers: [{ sku, offerToken }]`.\n * @returns The dispatched purchase payload. **Do not rely on it** for the actual outcome.\n * @throws Synchronous rejection from the store (e.g. `E_NOT_PREPARED`, validation failure).\n *\n * @example\n * ```ts\n * await requestPurchase({\n * request: {\n * apple: { sku: 'com.app.premium' },\n * google: { skus: ['com.app.premium'] },\n * },\n * type: 'in-app',\n * });\n * ```\n *\n * @remarks Event-based. Listen for the result via {@link purchaseUpdatedListener} /\n * {@link purchaseErrorListener}, or use `useIAP({ onPurchaseSuccess, onPurchaseError })`.\n *\n * @see {@link https://www.openiap.dev/docs/apis/request-purchase}\n */\nexport const requestPurchase: MutationField<'requestPurchase'> = async (\n args,\n) => {\n const {request, type} = args;\n const {canonical, native} = normalizeProductType(type as ProductTypeInput);\n const isInAppPurchase = canonical === 'in-app';\n\n if (Platform.OS === 'ios') {\n const normalizedRequest = normalizeRequestProps(request, 'ios');\n\n if (!normalizedRequest?.sku) {\n throw new Error(\n 'Invalid request for Apple. The `sku` property is required and must be a string.\\n\\n' +\n 'Expected format:\\n' +\n ' requestPurchase({\\n' +\n ' request: {\\n' +\n ' apple: { sku: \"product_id\" },\\n' +\n ' google: { skus: [\"product_id\"] }\\n' +\n ' },\\n' +\n ' type: \"in-app\"\\n' +\n ' })\\n\\n' +\n 'See: https://hyochan.github.io/expo-iap/docs/api/methods/core-methods#requestpurchase',\n );\n }\n\n if (canonical !== 'in-app' && canonical !== 'subs') {\n throw new Error(`Unsupported product type: ${canonical}`);\n }\n\n const payload: MutationRequestPurchaseArgs = {\n type: canonical === 'in-app' ? 'in-app' : 'subs',\n request: {ios: normalizedRequest},\n useAlternativeBilling: args.useAlternativeBilling,\n };\n\n const purchase = (await ExpoIapModule.requestPurchase(payload)) as\n | Purchase\n | Purchase[]\n | null;\n\n if (Array.isArray(purchase)) {\n return normalizePurchaseArray(purchase);\n }\n\n if (purchase) {\n return normalizePurchasePlatform(purchase);\n }\n\n return canonical === 'subs' ? [] : null;\n }\n\n if (Platform.OS === 'android') {\n if (isInAppPurchase) {\n const normalizedRequest = normalizeRequestProps(\n request as RequestPurchasePropsByPlatforms,\n 'android',\n ) as RequestPurchaseAndroidProps | null | undefined;\n\n if (!normalizedRequest?.skus?.length) {\n throw new Error(\n 'Invalid request for Google. The `skus` property is required and must be a non-empty array.\\n\\n' +\n 'Expected format:\\n' +\n ' requestPurchase({\\n' +\n ' request: {\\n' +\n ' apple: { sku: \"product_id\" },\\n' +\n ' google: { skus: [\"product_id\"] }\\n' +\n ' },\\n' +\n ' type: \"in-app\"\\n' +\n ' })\\n\\n' +\n 'See: https://hyochan.github.io/expo-iap/docs/api/methods/core-methods#requestpurchase',\n );\n }\n\n const {\n skus,\n obfuscatedAccountId,\n obfuscatedProfileId,\n isOfferPersonalized,\n offerToken,\n } = normalizedRequest;\n\n const result = (await ExpoIapModule.requestPurchase({\n type: native,\n skuArr: skus,\n purchaseToken: undefined,\n replacementMode: -1,\n obfuscatedAccountId: obfuscatedAccountId,\n obfuscatedProfileId: obfuscatedProfileId,\n offerToken: offerToken,\n offerTokenArr: [],\n isOfferPersonalized: isOfferPersonalized ?? false,\n })) as Purchase[];\n\n return normalizePurchaseArray(result);\n }\n\n if (canonical === 'subs') {\n const normalizedRequest = normalizeRequestProps(\n request as RequestSubscriptionPropsByPlatforms,\n 'android',\n ) as RequestSubscriptionAndroidProps | null | undefined;\n\n if (!normalizedRequest?.skus?.length) {\n throw new Error(\n 'Invalid request for Google. The `skus` property is required and must be a non-empty array.\\n\\n' +\n 'Expected format:\\n' +\n ' requestPurchase({\\n' +\n ' request: {\\n' +\n ' apple: { sku: \"subscription_id\" },\\n' +\n ' google: { skus: [\"subscription_id\"] }\\n' +\n ' },\\n' +\n ' type: \"subs\"\\n' +\n ' })\\n\\n' +\n 'See: https://hyochan.github.io/expo-iap/docs/api/methods/core-methods#requestpurchase',\n );\n }\n\n const {\n skus,\n obfuscatedAccountId,\n obfuscatedProfileId,\n isOfferPersonalized,\n subscriptionOffers,\n replacementMode: replacementModeInput,\n purchaseToken: purchaseTokenInput,\n subscriptionProductReplacementParams,\n } = normalizedRequest;\n\n const normalizedOffers = subscriptionOffers ?? [];\n const replacementMode = replacementModeInput ?? -1;\n const purchaseToken = purchaseTokenInput ?? undefined;\n\n const result = (await ExpoIapModule.requestPurchase({\n type: native,\n skuArr: skus,\n purchaseToken,\n replacementMode,\n obfuscatedAccountId: obfuscatedAccountId,\n obfuscatedProfileId: obfuscatedProfileId,\n offerTokenArr: normalizedOffers.map(\n (offer: AndroidSubscriptionOfferInput) => offer.offerToken,\n ),\n subscriptionOffers: normalizedOffers,\n isOfferPersonalized: isOfferPersonalized ?? false,\n subscriptionProductReplacementParams:\n subscriptionProductReplacementParams ?? undefined,\n })) as Purchase[];\n\n return normalizePurchaseArray(result);\n }\n\n throw new Error(\n \"Invalid request for Android: Expected a valid request object with 'skus' array.\",\n );\n }\n\n throw new Error('Platform not supported');\n};\n\n/**\n * Complete a purchase transaction. Call after server-side verification to remove it\n * from the queue.\n *\n * @param args.purchase The `Purchase` to finalize.\n * @param args.isConsumable `true` for consumables (consumes the token so the SKU can be\n * re-bought, e.g. coins); `false` (default) for non-consumables and subscriptions.\n * @returns Promise that resolves once the platform finalizes the transaction.\n * @throws When the platform finalize call fails.\n *\n * @example\n * ```ts\n * // Inside purchaseUpdatedListener:\n * if (await verifyOnServer(purchase)) {\n * await finishTransaction({ purchase, isConsumable: false });\n * }\n * ```\n *\n * @remarks **Critical:** Android purchases must be finalized within 3 days or Google\n * auto-refunds. iOS unfinished transactions replay on every app launch.\n *\n * @see {@link https://www.openiap.dev/docs/apis/finish-transaction}\n */\nexport const finishTransaction: MutationField<'finishTransaction'> = async ({\n purchase,\n isConsumable = false,\n}) => {\n if (Platform.OS === 'ios') {\n await ExpoIapModule.finishTransaction(purchase, isConsumable);\n return;\n }\n\n if (Platform.OS === 'android') {\n const token = purchase.purchaseToken ?? undefined;\n\n if (!token) {\n throw createPurchaseError({\n message: 'Purchase token is required to finish transaction',\n code: ErrorCode.DeveloperError,\n productId: purchase.productId,\n platform: 'android',\n });\n }\n\n if (isConsumable) {\n await ExpoIapModule.consumePurchaseAndroid(token);\n return;\n }\n\n await ExpoIapModule.acknowledgePurchaseAndroid(token);\n return;\n }\n\n throw new Error('Unsupported Platform');\n};\n\n/**\n * Restore completed transactions (cross-platform behavior)\n *\n * - iOS: perform a lightweight sync to refresh transactions and ignore sync errors,\n * then fetch available purchases to surface restored items to the app.\n * - Android: simply fetch available purchases (restoration happens via query).\n *\n * This helper triggers the refresh flows but does not return the purchases; consumers should\n * call `getAvailablePurchases` or rely on hook state to inspect the latest items.\n *\n * @see {@link https://www.openiap.dev/docs/apis/restore-purchases}\n */\nexport const restorePurchases: MutationField<'restorePurchases'> = async () => {\n if (Platform.OS === 'ios') {\n await syncIOS().catch(() => undefined);\n }\n\n await getAvailablePurchases({\n alsoPublishToEventListenerIOS: false,\n onlyIncludeActiveItemsIOS: true,\n });\n};\n\n/**\n * Deeplinks to native interface that allows users to manage their subscriptions\n * @param options.skuAndroid - Required for Android to locate specific subscription (ignored on iOS)\n * @param options.packageNameAndroid - Required for Android to identify your app (ignored on iOS)\n *\n * @returns Promise that resolves when the deep link is successfully opened\n *\n * @throws {Error} When called on unsupported platform or when required Android parameters are missing\n *\n * @example\n * import { deepLinkToSubscriptions } from 'expo-iap';\n *\n * // Works on both iOS and Android\n * await deepLinkToSubscriptions({\n * skuAndroid: 'your_subscription_sku',\n * packageNameAndroid: 'com.example.app'\n * });\n *\n * @see {@link https://www.openiap.dev/docs/apis/deep-link-to-subscriptions}\n */\nexport const deepLinkToSubscriptions: MutationField<\n 'deepLinkToSubscriptions'\n> = async (options) => {\n if (Platform.OS === 'ios') {\n await deepLinkToSubscriptionsIOS();\n return;\n }\n\n if (Platform.OS === 'android') {\n await deepLinkToSubscriptionsAndroid((options as DeepLinkOptions) ?? null);\n return;\n }\n\n throw new Error(`Unsupported platform: ${Platform.OS}`);\n};\n\n/**\n * Internal receipt validation function (NOT RECOMMENDED for production use)\n *\n * WARNING: This function performs client-side validation which is NOT secure.\n * For production apps, always validate receipts on your secure server:\n * - iOS: Send receipt data to Apple's verification endpoint from your server\n * - Android: Use Google Play Developer API with service account credentials\n *\n * @deprecated Use verifyPurchase instead\n *\n * @see {@link https://www.openiap.dev/docs/apis/validate-receipt}\n */\nexport const validateReceipt: MutationField<'validateReceipt'> = async (\n options,\n) => {\n const {apple, google} = options as MutationValidateReceiptArgs;\n\n if (Platform.OS === 'ios') {\n if (!apple?.sku) {\n throw new Error('iOS validation requires apple.sku');\n }\n return validateReceiptIOS({apple: {sku: apple.sku}});\n }\n\n if (Platform.OS === 'android') {\n if (\n !google ||\n !google.sku ||\n !google.packageName ||\n !google.purchaseToken ||\n !google.accessToken\n ) {\n throw new Error(\n 'Android validation requires google.sku, google.packageName, google.purchaseToken, and google.accessToken',\n );\n }\n return validateReceiptAndroid({\n packageName: google.packageName,\n productId: google.sku,\n productToken: google.purchaseToken,\n accessToken: google.accessToken,\n isSub: google.isSub ?? undefined,\n });\n }\n\n throw new Error('Platform not supported');\n};\n\n/**\n * Verify purchase with the configured providers\n *\n * This function uses the native OpenIAP verifyPurchase implementation\n * which validates purchases using platform-specific methods.\n *\n * @param options - Receipt validation options containing the SKU\n * @returns Promise resolving to receipt validation result\n *\n * @see {@link https://www.openiap.dev/docs/features/validation#verify-purchase}\n */\nexport const verifyPurchase: MutationField<'verifyPurchase'> = async (\n options,\n) => {\n if (Platform.OS === 'ios' || Platform.OS === 'android') {\n return ExpoIapModule.verifyPurchase(options);\n }\n\n throw new Error(`Unsupported platform: ${Platform.OS}`);\n};\n\n/**\n * Verify purchase with a specific provider (e.g., IAPKit)\n *\n * This function allows you to verify purchases using external verification\n * services like IAPKit, which provide additional validation and security.\n *\n * @param options - Verification options including provider and credentials\n * @returns Promise resolving to provider-specific verification result\n *\n * @example\n * ```typescript\n * const result = await verifyPurchaseWithProvider({\n * provider: 'iapkit',\n * iapkit: {\n * apiKey: 'your-api-key',\n * apple: {\n * jws: purchase.purchaseToken // JWS from purchase\n * },\n * google: {\n * purchaseToken: purchase.purchaseToken\n * }\n * }\n * });\n * ```\n *\n * @see {@link https://www.openiap.dev/docs/features/validation#verify-purchase-with-provider}\n */\nexport const verifyPurchaseWithProvider: MutationField<\n 'verifyPurchaseWithProvider'\n> = async (options) => {\n if (Platform.OS === 'ios' || Platform.OS === 'android') {\n // Auto-fill apiKey from config if not provided and provider is iapkit\n if (\n options.provider === 'iapkit' &&\n options.iapkit &&\n !options.iapkit.apiKey\n ) {\n try {\n // Dynamically import expo-constants to avoid hard dependency\n const {default: Constants} = await import('expo-constants');\n const configApiKey = Constants.expoConfig?.extra?.iapkitApiKey;\n if (configApiKey) {\n options = {\n ...options,\n iapkit: {\n ...options.iapkit,\n apiKey: configApiKey,\n },\n };\n }\n } catch {\n throw new Error(\n 'expo-constants is required for auto-filling iapkitApiKey from config. ' +\n 'Please install it: npx expo install expo-constants\\n' +\n 'Or provide apiKey directly in verifyPurchaseWithProvider options.',\n );\n }\n }\n return ExpoIapModule.verifyPurchaseWithProvider(options);\n }\n\n throw new Error(`Unsupported platform: ${Platform.OS}`);\n};\n\nexport * from './useIAP';\nexport {useWebhookEvents} from './useWebhookEvents';\nexport type {\n UseWebhookEventsOptions,\n UseWebhookEventsResult,\n} from './useWebhookEvents';\nexport {connectWebhookStream, parseWebhookEventData} from './webhook-client';\nexport type {\n WebhookEventPayload,\n WebhookEventStream,\n WebhookEventType as WebhookEventTypeName,\n WebhookListener,\n WebhookListenerError,\n WebhookListenerOptions,\n} from './webhook-client';\nexport {kitApi, KitApiError} from './kit-api';\nexport type {\n KitApiOptions,\n KitSubscription,\n EntitlementsResponse,\n StatusResponse,\n} from './kit-api';\nexport {\n ErrorCodeUtils,\n ErrorCodeMapping,\n createPurchaseError,\n createPurchaseErrorFromPlatform,\n} from './utils/errorMapping';\nexport type {\n PurchaseError as ExpoPurchaseError,\n PurchaseErrorProps,\n} from './utils/errorMapping';\nexport {ExpoIapConsole} from './utils/debug';\n"]}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
export type KitApiOptions = {
|
|
2
|
+
apiKey: string;
|
|
3
|
+
baseUrl?: string;
|
|
4
|
+
fetchImpl?: (input: string, init?: RequestInit) => Promise<Response>;
|
|
5
|
+
};
|
|
6
|
+
export type KitSubscription = {
|
|
7
|
+
id: string;
|
|
8
|
+
productId: string;
|
|
9
|
+
platform: 'IOS' | 'Android';
|
|
10
|
+
state: string;
|
|
11
|
+
expiresAt?: number;
|
|
12
|
+
renewsAt?: number;
|
|
13
|
+
willRenew?: boolean;
|
|
14
|
+
cancellationReason?: string;
|
|
15
|
+
currency?: string;
|
|
16
|
+
priceAmountMicros?: number;
|
|
17
|
+
startedAt: number;
|
|
18
|
+
updatedAt: number;
|
|
19
|
+
purchaseToken: string;
|
|
20
|
+
userId?: string;
|
|
21
|
+
};
|
|
22
|
+
export type EntitlementsResponse = {
|
|
23
|
+
userId: string;
|
|
24
|
+
productIds: string[];
|
|
25
|
+
subscriptions: KitSubscription[];
|
|
26
|
+
};
|
|
27
|
+
export type StatusResponse = {
|
|
28
|
+
active: boolean;
|
|
29
|
+
subscription: KitSubscription | null;
|
|
30
|
+
};
|
|
31
|
+
export declare class KitApiError extends Error {
|
|
32
|
+
readonly status: number;
|
|
33
|
+
readonly body: unknown;
|
|
34
|
+
constructor(status: number, body: unknown, message: string);
|
|
35
|
+
}
|
|
36
|
+
export declare function kitApi(options: KitApiOptions): {
|
|
37
|
+
apiKey: string;
|
|
38
|
+
baseUrl: string;
|
|
39
|
+
/** GET /v1/subscriptions/status — the `active` boolean is the
|
|
40
|
+
* fastest gate for "is this user paying?". */
|
|
41
|
+
status: (userId: string) => Promise<StatusResponse>;
|
|
42
|
+
/** GET /v1/subscriptions/entitlements — every productId the user
|
|
43
|
+
* is entitled to. Use this when feature gating depends on which
|
|
44
|
+
* specific tier the user owns. */
|
|
45
|
+
entitlements: (userId: string) => Promise<EntitlementsResponse>;
|
|
46
|
+
/** POST /v1/subscriptions/bind-user — call after a successful
|
|
47
|
+
* verifyReceipt so kit knows which userId owns the verified
|
|
48
|
+
* `purchaseToken`. Idempotent. */
|
|
49
|
+
bindUser: (purchaseToken: string, userId: string) => Promise<{
|
|
50
|
+
ok: boolean;
|
|
51
|
+
bound: boolean;
|
|
52
|
+
}>;
|
|
53
|
+
};
|
|
54
|
+
//# sourceMappingURL=kit-api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kit-api.d.ts","sourceRoot":"","sources":["../src/kit-api.ts"],"names":[],"mappings":"AAMA,MAAM,MAAM,aAAa,GAAG;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IAGjB,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;CACtE,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,KAAK,GAAG,SAAS,CAAC;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,aAAa,EAAE,eAAe,EAAE,CAAC;CAClC,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,MAAM,EAAE,OAAO,CAAC;IAChB,YAAY,EAAE,eAAe,GAAG,IAAI,CAAC;CACtC,CAAC;AAqEF,qBAAa,WAAY,SAAQ,KAAK;IAElC,QAAQ,CAAC,MAAM,EAAE,MAAM;IACvB,QAAQ,CAAC,IAAI,EAAE,OAAO;gBADb,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,OAAO,EACtB,OAAO,EAAE,MAAM;CAKlB;AAED,wBAAgB,MAAM,CAAC,OAAO,EAAE,aAAa;;;IA6EzC;kDAC8C;qBAC7B,MAAM;IAOvB;;sCAEkC;2BACX,MAAM;IAO7B;;sCAEkC;8BACR,MAAM,UAAU,MAAM;YACpC,OAAO;eAAS,OAAO;;EAQtC"}
|
package/build/kit-api.js
ADDED
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
// Tiny fetch wrapper around kit's `/v1` HTTP surface for use by the JS
|
|
2
|
+
// SDK consumers (react-native-iap + expo-iap). Mirrors the shape of
|
|
3
|
+
// `packages/mcp-server/src/kit-client.ts` so the same operations are
|
|
4
|
+
// reachable from both LLM tools and end-user apps without each
|
|
5
|
+
// duplicating the URL layout.
|
|
6
|
+
const DEFAULT_BASE_URL = 'https://kit.openiap.dev';
|
|
7
|
+
// Merge caller-supplied headers with kit defaults (`accept`,
|
|
8
|
+
// optionally `content-type`). When the runtime exposes a global
|
|
9
|
+
// `Headers` constructor we use it directly so callers passing a
|
|
10
|
+
// `Headers` instance (a `HeadersInit`) keep that exact instance's
|
|
11
|
+
// values. When `Headers` is missing — older React Native builds where
|
|
12
|
+
// the operator wires up `fetchImpl` without a `Headers` polyfill —
|
|
13
|
+
// we fall back to a case-insensitive merge into a plain record so
|
|
14
|
+
// the request still goes through. Either way, caller-set values take
|
|
15
|
+
// precedence over kit defaults.
|
|
16
|
+
function mergeHeaders(callerHeaders, hasBody) {
|
|
17
|
+
if (typeof Headers === 'function') {
|
|
18
|
+
const merged = new Headers(callerHeaders);
|
|
19
|
+
if (!merged.has('accept'))
|
|
20
|
+
merged.set('accept', 'application/json');
|
|
21
|
+
if (hasBody && !merged.has('content-type')) {
|
|
22
|
+
merged.set('content-type', 'application/json');
|
|
23
|
+
}
|
|
24
|
+
return merged;
|
|
25
|
+
}
|
|
26
|
+
// Plain-object fallback path. Build a case-insensitive name map
|
|
27
|
+
// from whatever the caller passed (Headers-shaped, array-of-pairs,
|
|
28
|
+
// or plain record) and re-emit as a record `fetchImpl` accepts.
|
|
29
|
+
const lower = new Map();
|
|
30
|
+
const setIfAbsent = (name, value) => {
|
|
31
|
+
const key = name.toLowerCase();
|
|
32
|
+
if (!lower.has(key))
|
|
33
|
+
lower.set(key, { name, value });
|
|
34
|
+
};
|
|
35
|
+
const setForce = (name, value) => {
|
|
36
|
+
const key = name.toLowerCase();
|
|
37
|
+
lower.set(key, { name, value });
|
|
38
|
+
};
|
|
39
|
+
if (callerHeaders) {
|
|
40
|
+
if (Array.isArray(callerHeaders)) {
|
|
41
|
+
for (const [name, value] of callerHeaders)
|
|
42
|
+
setForce(name, value);
|
|
43
|
+
}
|
|
44
|
+
else if (typeof callerHeaders.forEach === 'function') {
|
|
45
|
+
// `Headers`-like (without being our `typeof Headers === "function"`
|
|
46
|
+
// global). RN polyfills sometimes attach `Headers` only to
|
|
47
|
+
// request/response instances rather than the global scope.
|
|
48
|
+
// Standard signature is `forEach((value, key, parent))`; we
|
|
49
|
+
// bind the first two positionally so a polyfill that omits
|
|
50
|
+
// the third argument still works. `key` is the header name.
|
|
51
|
+
callerHeaders.forEach((value, key) => setForce(key, value));
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
for (const [name, value] of Object.entries(callerHeaders)) {
|
|
55
|
+
setForce(name, value);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
setIfAbsent('accept', 'application/json');
|
|
60
|
+
if (hasBody)
|
|
61
|
+
setIfAbsent('content-type', 'application/json');
|
|
62
|
+
const out = {};
|
|
63
|
+
for (const { name, value } of lower.values())
|
|
64
|
+
out[name] = value;
|
|
65
|
+
return out;
|
|
66
|
+
}
|
|
67
|
+
export class KitApiError extends Error {
|
|
68
|
+
status;
|
|
69
|
+
body;
|
|
70
|
+
constructor(status, body, message) {
|
|
71
|
+
super(message);
|
|
72
|
+
this.status = status;
|
|
73
|
+
this.body = body;
|
|
74
|
+
this.name = 'KitApiError';
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
export function kitApi(options) {
|
|
78
|
+
const baseUrl = (options.baseUrl ?? DEFAULT_BASE_URL).replace(/\/$/, '');
|
|
79
|
+
const fetchImpl = (() => {
|
|
80
|
+
if (options.fetchImpl)
|
|
81
|
+
return options.fetchImpl;
|
|
82
|
+
if (typeof fetch === 'function') {
|
|
83
|
+
return (input, init) => fetch(input, init);
|
|
84
|
+
}
|
|
85
|
+
throw new Error('kitApi requires a fetch implementation. Pass `fetchImpl` for runtimes without a global fetch.');
|
|
86
|
+
})();
|
|
87
|
+
async function call(path, init) {
|
|
88
|
+
// Normalize headers without depending on a global `Headers`
|
|
89
|
+
// constructor: older React Native runtimes ship `fetch` (or a
|
|
90
|
+
// polyfill via `fetchImpl`) without exposing `Headers` globally.
|
|
91
|
+
// The prior implementation crashed before the first request on
|
|
92
|
+
// those runtimes. We use `new Headers()` when available (preserves
|
|
93
|
+
// caller-supplied `Headers` instances exactly), and otherwise fall
|
|
94
|
+
// back to a small case-insensitive merge into a plain record.
|
|
95
|
+
// Either way, kit defaults only apply when the caller hasn't set
|
|
96
|
+
// the same name.
|
|
97
|
+
const headers = mergeHeaders(init?.headers, init?.body != null);
|
|
98
|
+
// Prepend a leading slash if `path` is missing one. Today's
|
|
99
|
+
// call sites all hard-code the leading "/", but normalizing here
|
|
100
|
+
// makes the helper safe for future additions and matches the
|
|
101
|
+
// already-stripped `baseUrl` (PR #124
|
|
102
|
+
// (https://github.com/hyodotdev/openiap/pull/124) review).
|
|
103
|
+
const normalizedPath = path.startsWith('/') ? path : `/${path}`;
|
|
104
|
+
const response = await fetchImpl(`${baseUrl}${normalizedPath}`, {
|
|
105
|
+
...init,
|
|
106
|
+
headers,
|
|
107
|
+
});
|
|
108
|
+
const text = await response.text();
|
|
109
|
+
// Empty body normalizes to null so callers expecting JSON
|
|
110
|
+
// (status / entitlements / list*) don't get a truthy ""
|
|
111
|
+
// and crash on property access.
|
|
112
|
+
let parsed = null;
|
|
113
|
+
let parseError = null;
|
|
114
|
+
if (text) {
|
|
115
|
+
try {
|
|
116
|
+
parsed = JSON.parse(text);
|
|
117
|
+
}
|
|
118
|
+
catch (error) {
|
|
119
|
+
// Non-JSON body (a misconfigured proxy returning HTML, a
|
|
120
|
+
// CDN-injected error page, etc.) on a 2xx response would
|
|
121
|
+
// otherwise reach the caller as `parsed = text` and crash
|
|
122
|
+
// on property access via `parsed as T`. Throw a structured
|
|
123
|
+
// KitApiError instead so callers see a typed failure.
|
|
124
|
+
parseError = error;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
if (!response.ok) {
|
|
128
|
+
// Surface the raw body (text or parsed) on the error path so
|
|
129
|
+
// operators can read the upstream error message verbatim.
|
|
130
|
+
throw new KitApiError(response.status, parsed ?? text, `kit ${path} returned ${response.status}`);
|
|
131
|
+
}
|
|
132
|
+
if (parseError) {
|
|
133
|
+
throw new KitApiError(response.status, text, `kit ${path} returned a non-JSON ${response.status} body (${parseError instanceof Error ? parseError.message : String(parseError)})`);
|
|
134
|
+
}
|
|
135
|
+
return parsed;
|
|
136
|
+
}
|
|
137
|
+
return {
|
|
138
|
+
apiKey: options.apiKey,
|
|
139
|
+
baseUrl,
|
|
140
|
+
/** GET /v1/subscriptions/status — the `active` boolean is the
|
|
141
|
+
* fastest gate for "is this user paying?". */
|
|
142
|
+
status: (userId) => call(`/v1/subscriptions/status/${encodeURIComponent(options.apiKey)}?userId=${encodeURIComponent(userId)}`),
|
|
143
|
+
/** GET /v1/subscriptions/entitlements — every productId the user
|
|
144
|
+
* is entitled to. Use this when feature gating depends on which
|
|
145
|
+
* specific tier the user owns. */
|
|
146
|
+
entitlements: (userId) => call(`/v1/subscriptions/entitlements/${encodeURIComponent(options.apiKey)}?userId=${encodeURIComponent(userId)}`),
|
|
147
|
+
/** POST /v1/subscriptions/bind-user — call after a successful
|
|
148
|
+
* verifyReceipt so kit knows which userId owns the verified
|
|
149
|
+
* `purchaseToken`. Idempotent. */
|
|
150
|
+
bindUser: (purchaseToken, userId) => call(`/v1/subscriptions/bind-user/${encodeURIComponent(options.apiKey)}`, {
|
|
151
|
+
method: 'POST',
|
|
152
|
+
body: JSON.stringify({ purchaseToken, userId }),
|
|
153
|
+
}),
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
//# sourceMappingURL=kit-api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kit-api.js","sourceRoot":"","sources":["../src/kit-api.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,oEAAoE;AACpE,qEAAqE;AACrE,+DAA+D;AAC/D,8BAA8B;AAsC9B,MAAM,gBAAgB,GAAG,yBAAyB,CAAC;AAEnD,6DAA6D;AAC7D,gEAAgE;AAChE,gEAAgE;AAChE,kEAAkE;AAClE,sEAAsE;AACtE,mEAAmE;AACnE,kEAAkE;AAClE,qEAAqE;AACrE,gCAAgC;AAChC,SAAS,Y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EACnE;YACE,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAC,aAAa,EAAE,MAAM,EAAC,CAAC;SAC9C,CACF;KACJ,CAAC;AACJ,CAAC","sourcesContent":["// Tiny fetch wrapper around kit's `/v1` HTTP surface for use by the JS\n// SDK consumers (react-native-iap + expo-iap). Mirrors the shape of\n// `packages/mcp-server/src/kit-client.ts` so the same operations are\n// reachable from both LLM tools and end-user apps without each\n// duplicating the URL layout.\n\nexport type KitApiOptions = {\n apiKey: string;\n baseUrl?: string;\n // Optional fetch override for runtimes without a global (older RN\n // builds) or for injection in tests.\n fetchImpl?: (input: string, init?: RequestInit) => Promise<Response>;\n};\n\nexport type KitSubscription = {\n id: string;\n productId: string;\n platform: 'IOS' | 'Android';\n state: string;\n expiresAt?: number;\n renewsAt?: number;\n willRenew?: boolean;\n cancellationReason?: string;\n currency?: string;\n priceAmountMicros?: number;\n startedAt: number;\n updatedAt: number;\n purchaseToken: string;\n userId?: string;\n};\n\nexport type EntitlementsResponse = {\n userId: string;\n productIds: string[];\n subscriptions: KitSubscription[];\n};\n\nexport type StatusResponse = {\n active: boolean;\n subscription: KitSubscription | null;\n};\n\nconst DEFAULT_BASE_URL = 'https://kit.openiap.dev';\n\n// Merge caller-supplied headers with kit defaults (`accept`,\n// optionally `content-type`). When the runtime exposes a global\n// `Headers` constructor we use it directly so callers passing a\n// `Headers` instance (a `HeadersInit`) keep that exact instance's\n// values. When `Headers` is missing — older React Native builds where\n// the operator wires up `fetchImpl` without a `Headers` polyfill —\n// we fall back to a case-insensitive merge into a plain record so\n// the request still goes through. Either way, caller-set values take\n// precedence over kit defaults.\nfunction mergeHeaders(\n callerHeaders: HeadersInit | undefined,\n hasBody: boolean,\n): HeadersInit {\n if (typeof Headers === 'function') {\n const merged = new Headers(callerHeaders);\n if (!merged.has('accept')) merged.set('accept', 'application/json');\n if (hasBody && !merged.has('content-type')) {\n merged.set('content-type', 'application/json');\n }\n return merged;\n }\n // Plain-object fallback path. Build a case-insensitive name map\n // from whatever the caller passed (Headers-shaped, array-of-pairs,\n // or plain record) and re-emit as a record `fetchImpl` accepts.\n const lower = new Map<string, {name: string; value: string}>();\n const setIfAbsent = (name: string, value: string) => {\n const key = name.toLowerCase();\n if (!lower.has(key)) lower.set(key, {name, value});\n };\n const setForce = (name: string, value: string) => {\n const key = name.toLowerCase();\n lower.set(key, {name, value});\n };\n if (callerHeaders) {\n if (Array.isArray(callerHeaders)) {\n for (const [name, value] of callerHeaders) setForce(name, value);\n } else if (\n typeof (callerHeaders as {forEach?: unknown}).forEach === 'function'\n ) {\n // `Headers`-like (without being our `typeof Headers === \"function\"`\n // global). RN polyfills sometimes attach `Headers` only to\n // request/response instances rather than the global scope.\n // Standard signature is `forEach((value, key, parent))`; we\n // bind the first two positionally so a polyfill that omits\n // the third argument still works. `key` is the header name.\n (\n callerHeaders as {\n forEach: (cb: (value: string, key: string) => void) => void;\n }\n ).forEach((value, key) => setForce(key, value));\n } else {\n for (const [name, value] of Object.entries(\n callerHeaders as Record<string, string>,\n )) {\n setForce(name, value);\n }\n }\n }\n setIfAbsent('accept', 'application/json');\n if (hasBody) setIfAbsent('content-type', 'application/json');\n const out: Record<string, string> = {};\n for (const {name, value} of lower.values()) out[name] = value;\n return out;\n}\n\nexport class KitApiError extends Error {\n constructor(\n readonly status: number,\n readonly body: unknown,\n message: string,\n ) {\n super(message);\n this.name = 'KitApiError';\n }\n}\n\nexport function kitApi(options: KitApiOptions) {\n const baseUrl = (options.baseUrl ?? DEFAULT_BASE_URL).replace(/\\/$/, '');\n const fetchImpl: (input: string, init?: RequestInit) => Promise<Response> =\n (() => {\n if (options.fetchImpl) return options.fetchImpl;\n if (typeof fetch === 'function') {\n return (input: string, init?: RequestInit) => fetch(input, init);\n }\n throw new Error(\n 'kitApi requires a fetch implementation. Pass `fetchImpl` for runtimes without a global fetch.',\n );\n })();\n\n async function call<T>(path: string, init?: RequestInit): Promise<T> {\n // Normalize headers without depending on a global `Headers`\n // constructor: older React Native runtimes ship `fetch` (or a\n // polyfill via `fetchImpl`) without exposing `Headers` globally.\n // The prior implementation crashed before the first request on\n // those runtimes. We use `new Headers()` when available (preserves\n // caller-supplied `Headers` instances exactly), and otherwise fall\n // back to a small case-insensitive merge into a plain record.\n // Either way, kit defaults only apply when the caller hasn't set\n // the same name.\n const headers = mergeHeaders(init?.headers, init?.body != null);\n // Prepend a leading slash if `path` is missing one. Today's\n // call sites all hard-code the leading \"/\", but normalizing here\n // makes the helper safe for future additions and matches the\n // already-stripped `baseUrl` (PR #124\n // (https://github.com/hyodotdev/openiap/pull/124) review).\n const normalizedPath = path.startsWith('/') ? path : `/${path}`;\n const response = await fetchImpl(`${baseUrl}${normalizedPath}`, {\n ...init,\n headers,\n });\n const text = await response.text();\n // Empty body normalizes to null so callers expecting JSON\n // (status / entitlements / list*) don't get a truthy \"\"\n // and crash on property access.\n let parsed: unknown = null;\n let parseError: unknown = null;\n if (text) {\n try {\n parsed = JSON.parse(text);\n } catch (error) {\n // Non-JSON body (a misconfigured proxy returning HTML, a\n // CDN-injected error page, etc.) on a 2xx response would\n // otherwise reach the caller as `parsed = text` and crash\n // on property access via `parsed as T`. Throw a structured\n // KitApiError instead so callers see a typed failure.\n parseError = error;\n }\n }\n if (!response.ok) {\n // Surface the raw body (text or parsed) on the error path so\n // operators can read the upstream error message verbatim.\n throw new KitApiError(\n response.status,\n parsed ?? text,\n `kit ${path} returned ${response.status}`,\n );\n }\n if (parseError) {\n throw new KitApiError(\n response.status,\n text,\n `kit ${path} returned a non-JSON ${response.status} body (${\n parseError instanceof Error ? parseError.message : String(parseError)\n })`,\n );\n }\n return parsed as T;\n }\n\n return {\n apiKey: options.apiKey,\n baseUrl,\n\n /** GET /v1/subscriptions/status — the `active` boolean is the\n * fastest gate for \"is this user paying?\". */\n status: (userId: string) =>\n call<StatusResponse>(\n `/v1/subscriptions/status/${encodeURIComponent(\n options.apiKey,\n )}?userId=${encodeURIComponent(userId)}`,\n ),\n\n /** GET /v1/subscriptions/entitlements — every productId the user\n * is entitled to. Use this when feature gating depends on which\n * specific tier the user owns. */\n entitlements: (userId: string) =>\n call<EntitlementsResponse>(\n `/v1/subscriptions/entitlements/${encodeURIComponent(\n options.apiKey,\n )}?userId=${encodeURIComponent(userId)}`,\n ),\n\n /** POST /v1/subscriptions/bind-user — call after a successful\n * verifyReceipt so kit knows which userId owns the verified\n * `purchaseToken`. Idempotent. */\n bindUser: (purchaseToken: string, userId: string) =>\n call<{ok: boolean; bound: boolean}>(\n `/v1/subscriptions/bind-user/${encodeURIComponent(options.apiKey)}`,\n {\n method: 'POST',\n body: JSON.stringify({purchaseToken, userId}),\n },\n ),\n };\n}\n"]}
|
|
@@ -41,11 +41,21 @@ export declare const validateReceiptAndroid: ({ packageName, productId, productT
|
|
|
41
41
|
accessToken: string;
|
|
42
42
|
isSub?: boolean;
|
|
43
43
|
}) => Promise<VerifyPurchaseResultAndroid>;
|
|
44
|
+
/**
|
|
45
|
+
* Consume a purchase token so the user can purchase the same product again
|
|
46
|
+
* (Android consumable products). Prefer using `finishTransaction` with
|
|
47
|
+
* `isConsumable: true`, which dispatches to this under the hood.
|
|
48
|
+
*
|
|
49
|
+
* @see {@link https://www.openiap.dev/docs/apis/android/consume-purchase-android}
|
|
50
|
+
*/
|
|
51
|
+
export declare const consumePurchaseAndroid: MutationField<'consumePurchaseAndroid'>;
|
|
44
52
|
/**
|
|
45
53
|
* Acknowledge a product (on Android.) No-op on iOS.
|
|
46
54
|
* @param {Object} params - The parameters object
|
|
47
55
|
* @param {string} params.token - The product's token (on Android)
|
|
48
56
|
* @returns {Promise<VoidResult | void>}
|
|
57
|
+
*
|
|
58
|
+
* @see {@link https://www.openiap.dev/docs/apis/android/acknowledge-purchase-android}
|
|
49
59
|
*/
|
|
50
60
|
export declare const acknowledgePurchaseAndroid: MutationField<'acknowledgePurchaseAndroid'>;
|
|
51
61
|
/**
|
|
@@ -72,6 +82,8 @@ export declare const openRedeemOfferCodeAndroid: () => Promise<void>;
|
|
|
72
82
|
* // Proceed with alternative billing flow
|
|
73
83
|
* }
|
|
74
84
|
* ```
|
|
85
|
+
*
|
|
86
|
+
* @see {@link https://www.openiap.dev/docs/apis/android/check-alternative-billing-availability-android}
|
|
75
87
|
*/
|
|
76
88
|
export declare const checkAlternativeBillingAvailabilityAndroid: MutationField<'checkAlternativeBillingAvailabilityAndroid'>;
|
|
77
89
|
/**
|
|
@@ -97,6 +109,8 @@ export declare const checkAlternativeBillingAvailabilityAndroid: MutationField<'
|
|
|
97
109
|
* }
|
|
98
110
|
* }
|
|
99
111
|
* ```
|
|
112
|
+
*
|
|
113
|
+
* @see {@link https://www.openiap.dev/docs/apis/android/show-alternative-billing-dialog-android}
|
|
100
114
|
*/
|
|
101
115
|
export declare const showAlternativeBillingDialogAndroid: MutationField<'showAlternativeBillingDialogAndroid'>;
|
|
102
116
|
/**
|
|
@@ -122,6 +136,8 @@ export declare const showAlternativeBillingDialogAndroid: MutationField<'showAlt
|
|
|
122
136
|
* });
|
|
123
137
|
* }
|
|
124
138
|
* ```
|
|
139
|
+
*
|
|
140
|
+
* @see {@link https://www.openiap.dev/docs/apis/android/create-alternative-billing-token-android}
|
|
125
141
|
*/
|
|
126
142
|
export declare const createAlternativeBillingTokenAndroid: MutationField<'createAlternativeBillingTokenAndroid'>;
|
|
127
143
|
/**
|
|
@@ -138,6 +154,8 @@ export declare const createAlternativeBillingTokenAndroid: MutationField<'create
|
|
|
138
154
|
* // Proceed with billing program flow
|
|
139
155
|
* }
|
|
140
156
|
* ```
|
|
157
|
+
*
|
|
158
|
+
* @see {@link https://www.openiap.dev/docs/apis/android/is-billing-program-available-android}
|
|
141
159
|
*/
|
|
142
160
|
export declare const isBillingProgramAvailableAndroid: MutationField<'isBillingProgramAvailableAndroid'>;
|
|
143
161
|
/**
|
|
@@ -156,6 +174,8 @@ export declare const isBillingProgramAvailableAndroid: MutationField<'isBillingP
|
|
|
156
174
|
* linkUri: 'https://your-payment-site.com',
|
|
157
175
|
* });
|
|
158
176
|
* ```
|
|
177
|
+
*
|
|
178
|
+
* @see {@link https://www.openiap.dev/docs/apis/android/launch-external-link-android}
|
|
159
179
|
*/
|
|
160
180
|
export declare const launchExternalLinkAndroid: MutationField<'launchExternalLinkAndroid'>;
|
|
161
181
|
/**
|
|
@@ -174,6 +194,8 @@ export declare const launchExternalLinkAndroid: MutationField<'launchExternalLin
|
|
|
174
194
|
* // Report details.externalTransactionToken to Google Play within 24 hours
|
|
175
195
|
* await reportToGooglePlay(details.externalTransactionToken);
|
|
176
196
|
* ```
|
|
197
|
+
*
|
|
198
|
+
* @see {@link https://www.openiap.dev/docs/apis/android/create-billing-program-reporting-details-android}
|
|
177
199
|
*/
|
|
178
200
|
export declare const createBillingProgramReportingDetailsAndroid: MutationField<'createBillingProgramReportingDetailsAndroid'>;
|
|
179
201
|
//# sourceMappingURL=android.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"android.d.ts","sourceRoot":"","sources":["../../src/modules/android.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EACV,eAAe,EACf,aAAa,EACb,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,KAA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