expo-iap 2.7.12 → 2.7.14
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/android/src/main/java/expo/modules/iap/ExpoIapModule.kt +30 -1
- package/build/ExpoIap.types.d.ts +5 -0
- package/build/ExpoIap.types.d.ts.map +1 -1
- package/build/ExpoIap.types.js.map +1 -1
- package/build/index.d.ts.map +1 -1
- package/build/index.js +4 -9
- package/build/index.js.map +1 -1
- package/build/types/ExpoIapAndroid.types.d.ts +6 -0
- package/build/types/ExpoIapAndroid.types.d.ts.map +1 -1
- package/build/types/ExpoIapAndroid.types.js.map +1 -1
- package/build/types/ExpoIapIos.types.d.ts +4 -0
- package/build/types/ExpoIapIos.types.d.ts.map +1 -1
- package/build/types/ExpoIapIos.types.js.map +1 -1
- package/ios/ExpoIapModule.swift +97 -2
- package/package.json +1 -1
- package/src/ExpoIap.types.ts +5 -0
- package/src/index.ts +5 -13
- package/src/types/ExpoIapAndroid.types.ts +6 -0
- package/src/types/ExpoIapIos.types.ts +4 -0
|
@@ -93,6 +93,7 @@ class ExpoIapModule :
|
|
|
93
93
|
"transactionDate" to purchase.purchaseTime.toDouble(),
|
|
94
94
|
"transactionReceipt" to purchase.originalJson,
|
|
95
95
|
"purchaseTokenAndroid" to purchase.purchaseToken,
|
|
96
|
+
"purchaseToken" to purchase.purchaseToken,
|
|
96
97
|
"dataAndroid" to purchase.originalJson,
|
|
97
98
|
"signatureAndroid" to purchase.signature,
|
|
98
99
|
"autoRenewingAndroid" to purchase.isAutoRenewing,
|
|
@@ -269,6 +270,7 @@ class ExpoIapModule :
|
|
|
269
270
|
"transactionReceipt" to purchase.originalJson,
|
|
270
271
|
"orderId" to purchase.orderId,
|
|
271
272
|
"purchaseTokenAndroid" to purchase.purchaseToken,
|
|
273
|
+
"purchaseToken" to purchase.purchaseToken,
|
|
272
274
|
"developerPayloadAndroid" to purchase.developerPayload,
|
|
273
275
|
"signatureAndroid" to purchase.signature,
|
|
274
276
|
"purchaseStateAndroid" to purchase.purchaseState,
|
|
@@ -408,10 +410,11 @@ class ExpoIapModule :
|
|
|
408
410
|
if (billingResult.responseCode != BillingClient.BillingResponseCode.OK) {
|
|
409
411
|
val errorData = PlayUtils.getBillingResponseData(billingResult.responseCode)
|
|
410
412
|
var errorMessage = billingResult.debugMessage ?: errorData.message
|
|
413
|
+
var subResponseCode: Int? = null
|
|
411
414
|
|
|
412
415
|
// Check for sub-response codes (v8.0.0+)
|
|
413
416
|
try {
|
|
414
|
-
|
|
417
|
+
subResponseCode = billingResult.javaClass.getMethod("getSubResponseCode").invoke(billingResult) as? Int
|
|
415
418
|
if (subResponseCode != null && subResponseCode != 0) {
|
|
416
419
|
if (subResponseCode == 1) { // PAYMENT_DECLINED_DUE_TO_INSUFFICIENT_FUNDS
|
|
417
420
|
errorMessage = "$errorMessage (Payment declined due to insufficient funds)"
|
|
@@ -423,6 +426,32 @@ class ExpoIapModule :
|
|
|
423
426
|
// Method doesn't exist in older versions, ignore
|
|
424
427
|
}
|
|
425
428
|
|
|
429
|
+
// Send error event to match iOS behavior
|
|
430
|
+
val errorMap = mutableMapOf<String, Any?>(
|
|
431
|
+
"responseCode" to billingResult.responseCode,
|
|
432
|
+
"debugMessage" to billingResult.debugMessage,
|
|
433
|
+
"code" to errorData.code,
|
|
434
|
+
"message" to errorMessage
|
|
435
|
+
)
|
|
436
|
+
|
|
437
|
+
// Add product ID if available
|
|
438
|
+
if (skuArr.isNotEmpty()) {
|
|
439
|
+
errorMap["productId"] = skuArr.first()
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
// Add sub-response code if available
|
|
443
|
+
subResponseCode?.let {
|
|
444
|
+
if (it != 0) {
|
|
445
|
+
errorMap["subResponseCode"] = it
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
try {
|
|
450
|
+
sendEvent(IapEvent.PURCHASE_ERROR, errorMap.toMap())
|
|
451
|
+
} catch (e: Exception) {
|
|
452
|
+
Log.e(TAG, "Failed to send PURCHASE_ERROR event: ${e.message}")
|
|
453
|
+
}
|
|
454
|
+
|
|
426
455
|
promise.reject(errorData.code, errorMessage, null)
|
|
427
456
|
return@ensureConnection
|
|
428
457
|
}
|
package/build/ExpoIap.types.d.ts
CHANGED
|
@@ -20,6 +20,7 @@ export type PurchaseBase = {
|
|
|
20
20
|
transactionId?: string;
|
|
21
21
|
transactionDate: number;
|
|
22
22
|
transactionReceipt: string;
|
|
23
|
+
purchaseToken?: string;
|
|
23
24
|
};
|
|
24
25
|
export type IosPlatform = {
|
|
25
26
|
platform: 'ios';
|
|
@@ -41,7 +42,11 @@ export type PurchaseResult = {
|
|
|
41
42
|
debugMessage?: string;
|
|
42
43
|
code?: string;
|
|
43
44
|
message?: string;
|
|
45
|
+
/**
|
|
46
|
+
* @deprecated Use `purchaseToken` instead. This field will be removed in a future version.
|
|
47
|
+
*/
|
|
44
48
|
purchaseTokenAndroid?: string;
|
|
49
|
+
purchaseToken?: string;
|
|
45
50
|
};
|
|
46
51
|
/**
|
|
47
52
|
* Centralized error codes for expo-iap
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpoIap.types.d.ts","sourceRoot":"","sources":["../src/ExpoIap.types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,sBAAsB,EACtB,0BAA0B,EAC3B,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,UAAU,EACV,kBAAkB,EAClB,sBAAsB,EACvB,MAAM,0BAA0B,CAAC;AAGlC,MAAM,MAAM,kBAAkB,GAAG;IAC/B,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG,OAAO,GAAG,MAAM,CAAC;AAE3C,MAAM,MAAM,WAAW,GAAG;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,WAAW,CAAC;IAClB,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AAC,CAAC,SAAS,CAAC;YACrC,CAAC,QAAQ,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CACvC,CAAC;IACJ,CAAC;IAED;;;;;OAKG;IACH,kBAAkB,EAAE,CAClB,SAAoB,EACpB,QAA2B,EAClB,EAAE;QACX,OAAO,SAAS,IAAI,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IACjD,CAAC;CACF,CAAC;AA8FF,2EAA2E","sourcesContent":["import {\n ProductAndroid,\n ProductPurchaseAndroid,\n SubscriptionProductAndroid,\n} from './types/ExpoIapAndroid.types';\nimport {\n ProductIos,\n ProductPurchaseIos,\n SubscriptionProductIos,\n} from './types/ExpoIapIos.types';\nimport {NATIVE_ERROR_CODES} from './ExpoIapModule';\n\nexport type ChangeEventPayload = {\n value: string;\n};\n\nexport type ProductType = 'inapp' | 'subs';\n\nexport type ProductBase = {\n id: string;\n title: string;\n description: string;\n type: ProductType;\n displayName?: string;\n displayPrice: string;\n currency: string;\n price?: number;\n};\n\nexport type PurchaseBase = {\n id: string; // Transaction identifier - used by finishTransaction\n productId: string; // Product identifier - which product was purchased\n transactionId?: string; // @deprecated - use id instead\n transactionDate: number;\n transactionReceipt: string;\n};\n\n// Define literal platform types for better type discrimination\nexport type IosPlatform = {platform: 'ios'};\nexport type AndroidPlatform = {platform: 'android'};\n\n// Platform-agnostic unified product types (public API)\nexport type Product =\n | (ProductAndroid & AndroidPlatform)\n | (ProductIos & IosPlatform);\n\nexport type SubscriptionProduct =\n | (SubscriptionProductAndroid & AndroidPlatform)\n | (SubscriptionProductIos & IosPlatform);\n\n// ============================================================================\n// Legacy Types (For backward compatibility with useIap hook)\n// ============================================================================\n\n// Re-export platform-specific purchase types for legacy compatibility\nexport type {ProductPurchaseAndroid} from './types/ExpoIapAndroid.types';\nexport type {ProductPurchaseIos} from './types/ExpoIapIos.types';\n\n// Union type for platform-specific purchase types (legacy support)\nexport type ProductPurchase =\n | (ProductPurchaseAndroid & AndroidPlatform)\n | (ProductPurchaseIos & IosPlatform);\n\n// Union type for platform-specific subscription purchase types (legacy support)\nexport type SubscriptionPurchase =\n | (ProductPurchaseAndroid & AndroidPlatform & {autoRenewingAndroid: boolean})\n | (ProductPurchaseIos & IosPlatform);\n\nexport type Purchase = ProductPurchase | SubscriptionPurchase;\n\n// Legacy result type\nexport type PurchaseResult = {\n responseCode?: number;\n debugMessage?: string;\n code?: string;\n message?: string;\n purchaseTokenAndroid?: string;\n};\n/**\n * Centralized error codes for expo-iap\n * These are mapped to platform-specific error codes and provide consistent error handling\n */\nexport enum ErrorCode {\n E_UNKNOWN = 'E_UNKNOWN',\n E_USER_CANCELLED = 'E_USER_CANCELLED',\n E_USER_ERROR = 'E_USER_ERROR',\n E_ITEM_UNAVAILABLE = 'E_ITEM_UNAVAILABLE',\n E_REMOTE_ERROR = 'E_REMOTE_ERROR',\n E_NETWORK_ERROR = 'E_NETWORK_ERROR',\n E_SERVICE_ERROR = 'E_SERVICE_ERROR',\n E_RECEIPT_FAILED = 'E_RECEIPT_FAILED',\n E_RECEIPT_FINISHED_FAILED = 'E_RECEIPT_FINISHED_FAILED',\n E_NOT_PREPARED = 'E_NOT_PREPARED',\n E_NOT_ENDED = 'E_NOT_ENDED',\n E_ALREADY_OWNED = 'E_ALREADY_OWNED',\n E_DEVELOPER_ERROR = 'E_DEVELOPER_ERROR',\n E_BILLING_RESPONSE_JSON_PARSE_ERROR = 'E_BILLING_RESPONSE_JSON_PARSE_ERROR',\n E_DEFERRED_PAYMENT = 'E_DEFERRED_PAYMENT',\n E_INTERRUPTED = 'E_INTERRUPTED',\n E_IAP_NOT_AVAILABLE = 'E_IAP_NOT_AVAILABLE',\n E_PURCHASE_ERROR = 'E_PURCHASE_ERROR',\n E_SYNC_ERROR = 'E_SYNC_ERROR',\n E_TRANSACTION_VALIDATION_FAILED = 'E_TRANSACTION_VALIDATION_FAILED',\n E_ACTIVITY_UNAVAILABLE = 'E_ACTIVITY_UNAVAILABLE',\n E_ALREADY_PREPARED = 'E_ALREADY_PREPARED',\n E_PENDING = 'E_PENDING',\n E_CONNECTION_CLOSED = 'E_CONNECTION_CLOSED',\n}\n\n/**\n * Platform-specific error code mappings\n * Maps ErrorCode enum values to platform-specific integer codes\n */\nexport const ErrorCodeMapping = {\n ios: {\n [ErrorCode.E_UNKNOWN]: 0,\n [ErrorCode.E_SERVICE_ERROR]: 1,\n [ErrorCode.E_USER_CANCELLED]: 2,\n [ErrorCode.E_USER_ERROR]: 3,\n [ErrorCode.E_ITEM_UNAVAILABLE]: 4,\n [ErrorCode.E_REMOTE_ERROR]: 5,\n [ErrorCode.E_NETWORK_ERROR]: 6,\n [ErrorCode.E_RECEIPT_FAILED]: 7,\n [ErrorCode.E_RECEIPT_FINISHED_FAILED]: 8,\n [ErrorCode.E_DEVELOPER_ERROR]: 9,\n [ErrorCode.E_PURCHASE_ERROR]: 10,\n [ErrorCode.E_SYNC_ERROR]: 11,\n [ErrorCode.E_DEFERRED_PAYMENT]: 12,\n [ErrorCode.E_TRANSACTION_VALIDATION_FAILED]: 13,\n [ErrorCode.E_NOT_PREPARED]: 14,\n [ErrorCode.E_NOT_ENDED]: 15,\n [ErrorCode.E_ALREADY_OWNED]: 16,\n [ErrorCode.E_BILLING_RESPONSE_JSON_PARSE_ERROR]: 17,\n [ErrorCode.E_INTERRUPTED]: 18,\n [ErrorCode.E_IAP_NOT_AVAILABLE]: 19,\n [ErrorCode.E_ACTIVITY_UNAVAILABLE]: 20,\n [ErrorCode.E_ALREADY_PREPARED]: 21,\n [ErrorCode.E_PENDING]: 22,\n [ErrorCode.E_CONNECTION_CLOSED]: 23,\n },\n android: {\n [ErrorCode.E_UNKNOWN]: 'E_UNKNOWN',\n [ErrorCode.E_USER_CANCELLED]: 'E_USER_CANCELLED',\n [ErrorCode.E_USER_ERROR]: 'E_USER_ERROR',\n [ErrorCode.E_ITEM_UNAVAILABLE]: 'E_ITEM_UNAVAILABLE',\n [ErrorCode.E_REMOTE_ERROR]: 'E_REMOTE_ERROR',\n [ErrorCode.E_NETWORK_ERROR]: 'E_NETWORK_ERROR',\n [ErrorCode.E_SERVICE_ERROR]: 'E_SERVICE_ERROR',\n [ErrorCode.E_RECEIPT_FAILED]: 'E_RECEIPT_FAILED',\n [ErrorCode.E_RECEIPT_FINISHED_FAILED]: 'E_RECEIPT_FINISHED_FAILED',\n [ErrorCode.E_NOT_PREPARED]: 'E_NOT_PREPARED',\n [ErrorCode.E_NOT_ENDED]: 'E_NOT_ENDED',\n [ErrorCode.E_ALREADY_OWNED]: 'E_ALREADY_OWNED',\n [ErrorCode.E_DEVELOPER_ERROR]: 'E_DEVELOPER_ERROR',\n [ErrorCode.E_BILLING_RESPONSE_JSON_PARSE_ERROR]:\n 'E_BILLING_RESPONSE_JSON_PARSE_ERROR',\n [ErrorCode.E_DEFERRED_PAYMENT]: 'E_DEFERRED_PAYMENT',\n [ErrorCode.E_INTERRUPTED]: 'E_INTERRUPTED',\n [ErrorCode.E_IAP_NOT_AVAILABLE]: 'E_IAP_NOT_AVAILABLE',\n [ErrorCode.E_PURCHASE_ERROR]: 'E_PURCHASE_ERROR',\n [ErrorCode.E_SYNC_ERROR]: 'E_SYNC_ERROR',\n [ErrorCode.E_TRANSACTION_VALIDATION_FAILED]:\n 'E_TRANSACTION_VALIDATION_FAILED',\n [ErrorCode.E_ACTIVITY_UNAVAILABLE]: 'E_ACTIVITY_UNAVAILABLE',\n [ErrorCode.E_ALREADY_PREPARED]: 'E_ALREADY_PREPARED',\n [ErrorCode.E_PENDING]: 'E_PENDING',\n [ErrorCode.E_CONNECTION_CLOSED]: 'E_CONNECTION_CLOSED',\n },\n} as const;\n\nexport class PurchaseError implements Error {\n constructor(\n public name: string,\n public message: string,\n public responseCode?: number,\n public debugMessage?: string,\n public code?: ErrorCode,\n public productId?: string,\n public platform?: 'ios' | 'android',\n ) {\n this.name = '[expo-iap]: PurchaseError';\n this.message = message;\n this.responseCode = responseCode;\n this.debugMessage = debugMessage;\n this.code = code;\n this.productId = productId;\n this.platform = platform;\n }\n\n /**\n * Creates a PurchaseError from platform-specific error data\n * @param errorData Raw error data from native modules\n * @param platform Platform where the error occurred\n * @returns Properly typed PurchaseError instance\n */\n static fromPlatformError(\n errorData: any,\n platform: 'ios' | 'android',\n ): PurchaseError {\n const errorCode = errorData.code\n ? ErrorCodeUtils.fromPlatformCode(errorData.code, platform)\n : ErrorCode.E_UNKNOWN;\n\n return new PurchaseError(\n '[expo-iap]: PurchaseError',\n errorData.message || 'Unknown error occurred',\n errorData.responseCode,\n errorData.debugMessage,\n errorCode,\n errorData.productId,\n platform,\n );\n }\n\n /**\n * Gets the platform-specific error code for this error\n * @returns Platform-specific error code\n */\n getPlatformCode(): string | number | undefined {\n if (!this.code || !this.platform) return undefined;\n return ErrorCodeUtils.toPlatformCode(this.code, this.platform);\n }\n}\n\n/**\n * Utility functions for error code mapping and validation\n */\nexport const ErrorCodeUtils = {\n /**\n * Gets the native error code for the current platform\n * @param errorCode ErrorCode enum value\n * @returns Platform-specific error code from native constants\n */\n getNativeErrorCode: (errorCode: ErrorCode): string => {\n return NATIVE_ERROR_CODES[errorCode] || errorCode;\n },\n\n /**\n * Maps a platform-specific error code back to the standardized ErrorCode enum\n * @param platformCode Platform-specific error code (string for Android, number for iOS)\n * @param platform Target platform\n * @returns Corresponding ErrorCode enum value or E_UNKNOWN if not found\n */\n fromPlatformCode: (\n platformCode: string | number,\n platform: 'ios' | 'android',\n ): ErrorCode => {\n const mapping = ErrorCodeMapping[platform];\n\n for (const [errorCode, mappedCode] of Object.entries(mapping)) {\n if (mappedCode === platformCode) {\n return errorCode as ErrorCode;\n }\n }\n\n return ErrorCode.E_UNKNOWN;\n },\n\n /**\n * Maps an ErrorCode enum to platform-specific code\n * @param errorCode ErrorCode enum value\n * @param platform Target platform\n * @returns Platform-specific error code\n */\n toPlatformCode: (\n errorCode: ErrorCode,\n platform: 'ios' | 'android',\n ): string | number => {\n return (\n ErrorCodeMapping[platform][errorCode] ??\n (platform === 'ios' ? 0 : 'E_UNKNOWN')\n );\n },\n\n /**\n * Checks if an error code is valid for the specified platform\n * @param errorCode ErrorCode enum value\n * @param platform Target platform\n * @returns True if the error code is supported on the platform\n */\n isValidForPlatform: (\n errorCode: ErrorCode,\n platform: 'ios' | 'android',\n ): boolean => {\n return errorCode in ErrorCodeMapping[platform];\n },\n};\n\n// ============================================================================\n// Enhanced Unified Request Types\n// ============================================================================\n\n/**\n * Unified request props that work on both iOS and Android platforms\n * iOS will use 'sku', Android will use 'skus' (or convert sku to skus array)\n */\nexport interface UnifiedRequestPurchaseProps {\n // Universal properties - works on both platforms\n readonly sku?: string; // Single SKU (iOS native, Android fallback)\n readonly skus?: string[]; // Multiple SKUs (Android native, iOS uses first item)\n\n // iOS-specific properties (ignored on Android)\n readonly andDangerouslyFinishTransactionAutomaticallyIOS?: boolean;\n readonly appAccountToken?: string;\n readonly quantity?: number;\n readonly withOffer?: import('./types/ExpoIapIos.types').PaymentDiscount;\n\n // Android-specific properties (ignored on iOS)\n readonly obfuscatedAccountIdAndroid?: string;\n readonly obfuscatedProfileIdAndroid?: string;\n readonly isOfferPersonalized?: boolean;\n}\n\n// ============================================================================\n// New Platform-Specific Request Types (v2.7.0+)\n// ============================================================================\n\n/**\n * iOS-specific purchase request parameters\n */\nexport interface RequestPurchaseIosProps {\n readonly sku: string;\n readonly andDangerouslyFinishTransactionAutomaticallyIOS?: boolean;\n readonly appAccountToken?: string;\n readonly quantity?: number;\n readonly withOffer?: import('./types/ExpoIapIos.types').PaymentDiscount;\n}\n\n/**\n * Android-specific purchase request parameters\n */\nexport interface RequestPurchaseAndroidProps {\n readonly skus: string[];\n readonly obfuscatedAccountIdAndroid?: string;\n readonly obfuscatedProfileIdAndroid?: string;\n readonly isOfferPersonalized?: boolean;\n}\n\n/**\n * Android-specific subscription request parameters\n */\nexport interface RequestSubscriptionAndroidProps\n extends RequestPurchaseAndroidProps {\n readonly purchaseTokenAndroid?: string;\n readonly replacementModeAndroid?: number;\n readonly subscriptionOffers: {\n sku: string;\n offerToken: string;\n }[];\n}\n\n/**\n * Modern platform-specific request structure (v2.7.0+)\n * Allows clear separation of iOS and Android parameters\n */\nexport interface RequestPurchasePropsByPlatforms {\n readonly ios?: RequestPurchaseIosProps;\n readonly android?: RequestPurchaseAndroidProps;\n}\n\n/**\n * Modern platform-specific subscription request structure (v2.7.0+)\n */\nexport interface RequestSubscriptionPropsByPlatforms {\n readonly ios?: RequestPurchaseIosProps;\n readonly android?: RequestSubscriptionAndroidProps;\n}\n\n/**\n * Modern request purchase parameters (v2.7.0+)\n * This is the recommended API moving forward\n */\nexport type RequestPurchaseProps = RequestPurchasePropsByPlatforms;\n\n/**\n * Modern request subscription parameters (v2.7.0+)\n * This is the recommended API moving forward\n */\nexport type RequestSubscriptionProps = RequestSubscriptionPropsByPlatforms;\n\n// Note: Type guard functions are exported from index.ts to avoid conflicts\n"]}
|
|
1
|
+
{"version":3,"file":"ExpoIap.types.js","sourceRoot":"","sources":["../src/ExpoIap.types.ts"],"names":[],"mappings":"AAUA,OAAO,EAAC,kBAAkB,EAAC,MAAM,iBAAiB,CAAC;AAyEnD;;;GAGG;AACH,MAAM,CAAN,IAAY,SAyBX;AAzBD,WAAY,SAAS;IACnB,oCAAuB,CAAA;IACvB,kDAAqC,CAAA;IACrC,0CAA6B,CAAA;IAC7B,sDAAyC,CAAA;IACzC,8CAAiC,CAAA;IACjC,gDAAmC,CAAA;IACnC,gDAAmC,CAAA;IACnC,kDAAqC,CAAA;IACrC,oEAAuD,CAAA;IACvD,8CAAiC,CAAA;IACjC,wCAA2B,CAAA;IAC3B,gDAAmC,CAAA;IACnC,oDAAuC,CAAA;IACvC,wFAA2E,CAAA;IAC3E,sDAAyC,CAAA;IACzC,4CAA+B,CAAA;IAC/B,wDAA2C,CAAA;IAC3C,kDAAqC,CAAA;IACrC,0CAA6B,CAAA;IAC7B,gFAAmE,CAAA;IACnE,8DAAiD,CAAA;IACjD,sDAAyC,CAAA;IACzC,o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2EAA2E","sourcesContent":["import {\n ProductAndroid,\n ProductPurchaseAndroid,\n SubscriptionProductAndroid,\n} from './types/ExpoIapAndroid.types';\nimport {\n ProductIos,\n ProductPurchaseIos,\n SubscriptionProductIos,\n} from './types/ExpoIapIos.types';\nimport {NATIVE_ERROR_CODES} from './ExpoIapModule';\n\nexport type ChangeEventPayload = {\n value: string;\n};\n\nexport type ProductType = 'inapp' | 'subs';\n\nexport type ProductBase = {\n id: string;\n title: string;\n description: string;\n type: ProductType;\n displayName?: string;\n displayPrice: string;\n currency: string;\n price?: number;\n};\n\nexport type PurchaseBase = {\n id: string; // Transaction identifier - used by finishTransaction\n productId: string; // Product identifier - which product was purchased\n transactionId?: string; // @deprecated - use id instead\n transactionDate: number;\n transactionReceipt: string;\n purchaseToken?: string; // Unified purchase token (jwsRepresentation for iOS, purchaseToken for Android)\n};\n\n// Define literal platform types for better type discrimination\nexport type IosPlatform = {platform: 'ios'};\nexport type AndroidPlatform = {platform: 'android'};\n\n// Platform-agnostic unified product types (public API)\nexport type Product =\n | (ProductAndroid & AndroidPlatform)\n | (ProductIos & IosPlatform);\n\nexport type SubscriptionProduct =\n | (SubscriptionProductAndroid & AndroidPlatform)\n | (SubscriptionProductIos & IosPlatform);\n\n// ============================================================================\n// Legacy Types (For backward compatibility with useIap hook)\n// ============================================================================\n\n// Re-export platform-specific purchase types for legacy compatibility\nexport type {ProductPurchaseAndroid} from './types/ExpoIapAndroid.types';\nexport type {ProductPurchaseIos} from './types/ExpoIapIos.types';\n\n// Union type for platform-specific purchase types (legacy support)\nexport type ProductPurchase =\n | (ProductPurchaseAndroid & AndroidPlatform)\n | (ProductPurchaseIos & IosPlatform);\n\n// Union type for platform-specific subscription purchase types (legacy support)\nexport type SubscriptionPurchase =\n | (ProductPurchaseAndroid & AndroidPlatform & {autoRenewingAndroid: boolean})\n | (ProductPurchaseIos & IosPlatform);\n\nexport type Purchase = ProductPurchase | SubscriptionPurchase;\n\n// Legacy result type\nexport type PurchaseResult = {\n responseCode?: number;\n debugMessage?: string;\n code?: string;\n message?: string;\n /**\n * @deprecated Use `purchaseToken` instead. This field will be removed in a future version.\n */\n purchaseTokenAndroid?: string;\n purchaseToken?: string;\n};\n/**\n * Centralized error codes for expo-iap\n * These are mapped to platform-specific error codes and provide consistent error handling\n */\nexport enum ErrorCode {\n E_UNKNOWN = 'E_UNKNOWN',\n E_USER_CANCELLED = 'E_USER_CANCELLED',\n E_USER_ERROR = 'E_USER_ERROR',\n E_ITEM_UNAVAILABLE = 'E_ITEM_UNAVAILABLE',\n E_REMOTE_ERROR = 'E_REMOTE_ERROR',\n E_NETWORK_ERROR = 'E_NETWORK_ERROR',\n E_SERVICE_ERROR = 'E_SERVICE_ERROR',\n E_RECEIPT_FAILED = 'E_RECEIPT_FAILED',\n E_RECEIPT_FINISHED_FAILED = 'E_RECEIPT_FINISHED_FAILED',\n E_NOT_PREPARED = 'E_NOT_PREPARED',\n E_NOT_ENDED = 'E_NOT_ENDED',\n E_ALREADY_OWNED = 'E_ALREADY_OWNED',\n E_DEVELOPER_ERROR = 'E_DEVELOPER_ERROR',\n E_BILLING_RESPONSE_JSON_PARSE_ERROR = 'E_BILLING_RESPONSE_JSON_PARSE_ERROR',\n E_DEFERRED_PAYMENT = 'E_DEFERRED_PAYMENT',\n E_INTERRUPTED = 'E_INTERRUPTED',\n E_IAP_NOT_AVAILABLE = 'E_IAP_NOT_AVAILABLE',\n E_PURCHASE_ERROR = 'E_PURCHASE_ERROR',\n E_SYNC_ERROR = 'E_SYNC_ERROR',\n E_TRANSACTION_VALIDATION_FAILED = 'E_TRANSACTION_VALIDATION_FAILED',\n E_ACTIVITY_UNAVAILABLE = 'E_ACTIVITY_UNAVAILABLE',\n E_ALREADY_PREPARED = 'E_ALREADY_PREPARED',\n E_PENDING = 'E_PENDING',\n E_CONNECTION_CLOSED = 'E_CONNECTION_CLOSED',\n}\n\n/**\n * Platform-specific error code mappings\n * Maps ErrorCode enum values to platform-specific integer codes\n */\nexport const ErrorCodeMapping = {\n ios: {\n [ErrorCode.E_UNKNOWN]: 0,\n [ErrorCode.E_SERVICE_ERROR]: 1,\n [ErrorCode.E_USER_CANCELLED]: 2,\n [ErrorCode.E_USER_ERROR]: 3,\n [ErrorCode.E_ITEM_UNAVAILABLE]: 4,\n [ErrorCode.E_REMOTE_ERROR]: 5,\n [ErrorCode.E_NETWORK_ERROR]: 6,\n [ErrorCode.E_RECEIPT_FAILED]: 7,\n [ErrorCode.E_RECEIPT_FINISHED_FAILED]: 8,\n [ErrorCode.E_DEVELOPER_ERROR]: 9,\n [ErrorCode.E_PURCHASE_ERROR]: 10,\n [ErrorCode.E_SYNC_ERROR]: 11,\n [ErrorCode.E_DEFERRED_PAYMENT]: 12,\n [ErrorCode.E_TRANSACTION_VALIDATION_FAILED]: 13,\n [ErrorCode.E_NOT_PREPARED]: 14,\n [ErrorCode.E_NOT_ENDED]: 15,\n [ErrorCode.E_ALREADY_OWNED]: 16,\n [ErrorCode.E_BILLING_RESPONSE_JSON_PARSE_ERROR]: 17,\n [ErrorCode.E_INTERRUPTED]: 18,\n [ErrorCode.E_IAP_NOT_AVAILABLE]: 19,\n [ErrorCode.E_ACTIVITY_UNAVAILABLE]: 20,\n [ErrorCode.E_ALREADY_PREPARED]: 21,\n [ErrorCode.E_PENDING]: 22,\n [ErrorCode.E_CONNECTION_CLOSED]: 23,\n },\n android: {\n [ErrorCode.E_UNKNOWN]: 'E_UNKNOWN',\n [ErrorCode.E_USER_CANCELLED]: 'E_USER_CANCELLED',\n [ErrorCode.E_USER_ERROR]: 'E_USER_ERROR',\n [ErrorCode.E_ITEM_UNAVAILABLE]: 'E_ITEM_UNAVAILABLE',\n [ErrorCode.E_REMOTE_ERROR]: 'E_REMOTE_ERROR',\n [ErrorCode.E_NETWORK_ERROR]: 'E_NETWORK_ERROR',\n [ErrorCode.E_SERVICE_ERROR]: 'E_SERVICE_ERROR',\n [ErrorCode.E_RECEIPT_FAILED]: 'E_RECEIPT_FAILED',\n [ErrorCode.E_RECEIPT_FINISHED_FAILED]: 'E_RECEIPT_FINISHED_FAILED',\n [ErrorCode.E_NOT_PREPARED]: 'E_NOT_PREPARED',\n [ErrorCode.E_NOT_ENDED]: 'E_NOT_ENDED',\n [ErrorCode.E_ALREADY_OWNED]: 'E_ALREADY_OWNED',\n [ErrorCode.E_DEVELOPER_ERROR]: 'E_DEVELOPER_ERROR',\n [ErrorCode.E_BILLING_RESPONSE_JSON_PARSE_ERROR]:\n 'E_BILLING_RESPONSE_JSON_PARSE_ERROR',\n [ErrorCode.E_DEFERRED_PAYMENT]: 'E_DEFERRED_PAYMENT',\n [ErrorCode.E_INTERRUPTED]: 'E_INTERRUPTED',\n [ErrorCode.E_IAP_NOT_AVAILABLE]: 'E_IAP_NOT_AVAILABLE',\n [ErrorCode.E_PURCHASE_ERROR]: 'E_PURCHASE_ERROR',\n [ErrorCode.E_SYNC_ERROR]: 'E_SYNC_ERROR',\n [ErrorCode.E_TRANSACTION_VALIDATION_FAILED]:\n 'E_TRANSACTION_VALIDATION_FAILED',\n [ErrorCode.E_ACTIVITY_UNAVAILABLE]: 'E_ACTIVITY_UNAVAILABLE',\n [ErrorCode.E_ALREADY_PREPARED]: 'E_ALREADY_PREPARED',\n [ErrorCode.E_PENDING]: 'E_PENDING',\n [ErrorCode.E_CONNECTION_CLOSED]: 'E_CONNECTION_CLOSED',\n },\n} as const;\n\nexport class PurchaseError implements Error {\n constructor(\n public name: string,\n public message: string,\n public responseCode?: number,\n public debugMessage?: string,\n public code?: ErrorCode,\n public productId?: string,\n public platform?: 'ios' | 'android',\n ) {\n this.name = '[expo-iap]: PurchaseError';\n this.message = message;\n this.responseCode = responseCode;\n this.debugMessage = debugMessage;\n this.code = code;\n this.productId = productId;\n this.platform = platform;\n }\n\n /**\n * Creates a PurchaseError from platform-specific error data\n * @param errorData Raw error data from native modules\n * @param platform Platform where the error occurred\n * @returns Properly typed PurchaseError instance\n */\n static fromPlatformError(\n errorData: any,\n platform: 'ios' | 'android',\n ): PurchaseError {\n const errorCode = errorData.code\n ? ErrorCodeUtils.fromPlatformCode(errorData.code, platform)\n : ErrorCode.E_UNKNOWN;\n\n return new PurchaseError(\n '[expo-iap]: PurchaseError',\n errorData.message || 'Unknown error occurred',\n errorData.responseCode,\n errorData.debugMessage,\n errorCode,\n errorData.productId,\n platform,\n );\n }\n\n /**\n * Gets the platform-specific error code for this error\n * @returns Platform-specific error code\n */\n getPlatformCode(): string | number | undefined {\n if (!this.code || !this.platform) return undefined;\n return ErrorCodeUtils.toPlatformCode(this.code, this.platform);\n }\n}\n\n/**\n * Utility functions for error code mapping and validation\n */\nexport const ErrorCodeUtils = {\n /**\n * Gets the native error code for the current platform\n * @param errorCode ErrorCode enum value\n * @returns Platform-specific error code from native constants\n */\n getNativeErrorCode: (errorCode: ErrorCode): string => {\n return NATIVE_ERROR_CODES[errorCode] || errorCode;\n },\n\n /**\n * Maps a platform-specific error code back to the standardized ErrorCode enum\n * @param platformCode Platform-specific error code (string for Android, number for iOS)\n * @param platform Target platform\n * @returns Corresponding ErrorCode enum value or E_UNKNOWN if not found\n */\n fromPlatformCode: (\n platformCode: string | number,\n platform: 'ios' | 'android',\n ): ErrorCode => {\n const mapping = ErrorCodeMapping[platform];\n\n for (const [errorCode, mappedCode] of Object.entries(mapping)) {\n if (mappedCode === platformCode) {\n return errorCode as ErrorCode;\n }\n }\n\n return ErrorCode.E_UNKNOWN;\n },\n\n /**\n * Maps an ErrorCode enum to platform-specific code\n * @param errorCode ErrorCode enum value\n * @param platform Target platform\n * @returns Platform-specific error code\n */\n toPlatformCode: (\n errorCode: ErrorCode,\n platform: 'ios' | 'android',\n ): string | number => {\n return (\n ErrorCodeMapping[platform][errorCode] ??\n (platform === 'ios' ? 0 : 'E_UNKNOWN')\n );\n },\n\n /**\n * Checks if an error code is valid for the specified platform\n * @param errorCode ErrorCode enum value\n * @param platform Target platform\n * @returns True if the error code is supported on the platform\n */\n isValidForPlatform: (\n errorCode: ErrorCode,\n platform: 'ios' | 'android',\n ): boolean => {\n return errorCode in ErrorCodeMapping[platform];\n },\n};\n\n// ============================================================================\n// Enhanced Unified Request Types\n// ============================================================================\n\n/**\n * Unified request props that work on both iOS and Android platforms\n * iOS will use 'sku', Android will use 'skus' (or convert sku to skus array)\n */\nexport interface UnifiedRequestPurchaseProps {\n // Universal properties - works on both platforms\n readonly sku?: string; // Single SKU (iOS native, Android fallback)\n readonly skus?: string[]; // Multiple SKUs (Android native, iOS uses first item)\n\n // iOS-specific properties (ignored on Android)\n readonly andDangerouslyFinishTransactionAutomaticallyIOS?: boolean;\n readonly appAccountToken?: string;\n readonly quantity?: number;\n readonly withOffer?: import('./types/ExpoIapIos.types').PaymentDiscount;\n\n // Android-specific properties (ignored on iOS)\n readonly obfuscatedAccountIdAndroid?: string;\n readonly obfuscatedProfileIdAndroid?: string;\n readonly isOfferPersonalized?: boolean;\n}\n\n// ============================================================================\n// New Platform-Specific Request Types (v2.7.0+)\n// ============================================================================\n\n/**\n * iOS-specific purchase request parameters\n */\nexport interface RequestPurchaseIosProps {\n readonly sku: string;\n readonly andDangerouslyFinishTransactionAutomaticallyIOS?: boolean;\n readonly appAccountToken?: string;\n readonly quantity?: number;\n readonly withOffer?: import('./types/ExpoIapIos.types').PaymentDiscount;\n}\n\n/**\n * Android-specific purchase request parameters\n */\nexport interface RequestPurchaseAndroidProps {\n readonly skus: string[];\n readonly obfuscatedAccountIdAndroid?: string;\n readonly obfuscatedProfileIdAndroid?: string;\n readonly isOfferPersonalized?: boolean;\n}\n\n/**\n * Android-specific subscription request parameters\n */\nexport interface RequestSubscriptionAndroidProps\n extends RequestPurchaseAndroidProps {\n readonly purchaseTokenAndroid?: string;\n readonly replacementModeAndroid?: number;\n readonly subscriptionOffers: {\n sku: string;\n offerToken: string;\n }[];\n}\n\n/**\n * Modern platform-specific request structure (v2.7.0+)\n * Allows clear separation of iOS and Android parameters\n */\nexport interface RequestPurchasePropsByPlatforms {\n readonly ios?: RequestPurchaseIosProps;\n readonly android?: RequestPurchaseAndroidProps;\n}\n\n/**\n * Modern platform-specific subscription request structure (v2.7.0+)\n */\nexport interface RequestSubscriptionPropsByPlatforms {\n readonly ios?: RequestPurchaseIosProps;\n readonly android?: RequestSubscriptionAndroidProps;\n}\n\n/**\n * Modern request purchase parameters (v2.7.0+)\n * This is the recommended API moving forward\n */\nexport type RequestPurchaseProps = RequestPurchasePropsByPlatforms;\n\n/**\n * Modern request subscription parameters (v2.7.0+)\n * This is the recommended API moving forward\n */\nexport type RequestSubscriptionProps = RequestSubscriptionPropsByPlatforms;\n\n// Note: Type guard functions are exported from index.ts to avoid conflicts\n"]}
|
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAkBA,OAAO,EACL,OAAO,EACP,eAAe,EACf,QAAQ,EACR,aAAa,EACb,cAAc,EACd,wBAAwB,EACxB,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,EACrB,MAAM,iBAAiB,CAAC;AAKzB,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,YAAY,EAAC,iBAAiB,EAAC,MAAM,0BAA0B,CAAC;AAGhE,OAAO,EACL,sBAAsB,EACtB,sBAAsB,EACtB,KAAK,kBAAkB,GACxB,MAAM,wBAAwB,CAAC;AAGhC,eAAO,MAAM,EAAE,KAAmB,CAAC;AAEnC,oBAAY,QAAQ;IAClB,eAAe,qBAAqB;IACpC,aAAa,mBAAmB;IAChC,yFAAyF;IACzF,qBAAqB,4BAA4B;IACjD,kBAAkB,yBAAyB;CAC5C;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,OAE1C;AAGD,eAAO,MAAM,OAAO,EAAoD;IACtE,WAAW,EAAE,CACX,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,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I,6BAG/B;IACD,QAAQ,EAAE,QAAQ,CAAC;IACnB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,KAAG,OAAO,CAAC,cAAc,GAAG,OAAO,CAwBnC,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,gBAAgB,QAAO,OAAO,CAAC,MAAM,CAMjD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,aAAa,QAAO,OAAO,CAAC,MAAM,CAK9C,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,GAC1B,KAAK,MAAM,EACX,iBAAiB;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,KACA,OAAO,CAAC,GAAG,CAwBb,CAAC;AAEF;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,uBAAuB,GAAI,SAAS;IAC/C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B,KAAG,OAAO,CAAC,IAAI,CA2Bf,CAAC;AAEF,cAAc,UAAU,CAAC;AACzB,cAAc,sBAAsB,CAAC"}
|
package/build/index.js
CHANGED
|
@@ -298,12 +298,12 @@ export const requestPurchase = (requestObj) => {
|
|
|
298
298
|
})();
|
|
299
299
|
}
|
|
300
300
|
if (type === 'subs') {
|
|
301
|
-
const { skus, obfuscatedAccountIdAndroid, obfuscatedProfileIdAndroid, isOfferPersonalized, subscriptionOffers = [], replacementModeAndroid = -1, purchaseTokenAndroid, } = normalizedRequest;
|
|
301
|
+
const { skus, obfuscatedAccountIdAndroid, obfuscatedProfileIdAndroid, isOfferPersonalized, subscriptionOffers = [], replacementModeAndroid = -1, purchaseTokenAndroid, purchaseToken, } = normalizedRequest;
|
|
302
302
|
return (async () => {
|
|
303
303
|
return ExpoIapModule.buyItemByType({
|
|
304
304
|
type: 'subs',
|
|
305
305
|
skuArr: skus,
|
|
306
|
-
purchaseToken: purchaseTokenAndroid,
|
|
306
|
+
purchaseToken: purchaseTokenAndroid || purchaseToken,
|
|
307
307
|
replacementMode: replacementModeAndroid,
|
|
308
308
|
obfuscatedAccountId: obfuscatedAccountIdAndroid,
|
|
309
309
|
obfuscatedProfileId: obfuscatedProfileIdAndroid,
|
|
@@ -357,15 +357,10 @@ export const finishTransaction = ({ purchase, isConsumable = false, }) => {
|
|
|
357
357
|
},
|
|
358
358
|
android: async () => {
|
|
359
359
|
const androidPurchase = purchase;
|
|
360
|
-
if (!('purchaseTokenAndroid' in androidPurchase)) {
|
|
361
|
-
return Promise.reject(new Error('purchaseToken is required to finish transaction'));
|
|
362
|
-
}
|
|
363
360
|
if (isConsumable) {
|
|
364
|
-
return ExpoIapModule.consumeProduct(androidPurchase.
|
|
365
|
-
}
|
|
366
|
-
else {
|
|
367
|
-
return ExpoIapModule.acknowledgePurchase(androidPurchase.purchaseTokenAndroid);
|
|
361
|
+
return ExpoIapModule.consumeProduct(androidPurchase.purchaseToken);
|
|
368
362
|
}
|
|
363
|
+
return ExpoIapModule.acknowledgePurchase(androidPurchase.purchaseToken);
|
|
369
364
|
},
|
|
370
365
|
}) || (() => Promise.reject(new Error('Unsupported Platform'))))();
|
|
371
366
|
};
|
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,kBAAkB,EAAC,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAC,QAAQ,EAAC,MAAM,cAAc,CAAC;AAEtC,mBAAmB;AACnB,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,0BAA0B,GAC3B,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,gBAAgB,EAChB,sBAAsB,EACtB,8BAA8B,GAC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3E,CAAC,CAAC;AAEF,cAAc,UAAU,CAAC;AACzB,cAAc,sBAAsB,CAAC","sourcesContent":["// External dependencies\nimport {NativeModulesProxy} from 'expo-modules-core';\nimport {Platform} from 'react-native';\n\n// Internal modules\nimport ExpoIapModule from './ExpoIapModule';\nimport {\n isProductIos,\n validateReceiptIOS,\n deepLinkToSubscriptionsIos,\n} from './modules/ios';\nimport {\n isProductAndroid,\n validateReceiptAndroid,\n deepLinkToSubscriptionsAndroid,\n} from './modules/android';\n\n// Types\nimport {\n Product,\n ProductPurchase,\n Purchase,\n PurchaseError,\n PurchaseResult,\n RequestSubscriptionProps,\n RequestPurchaseProps,\n SubscriptionProduct,\n SubscriptionPurchase,\n} from './ExpoIap.types';\nimport {ProductPurchaseAndroid} from './types/ExpoIapAndroid.types';\nimport {PaymentDiscount} from './types/ExpoIapIos.types';\n\n// Export all types\nexport * from './ExpoIap.types';\nexport * from './modules/android';\nexport * from './modules/ios';\nexport type {AppTransactionIOS} from './types/ExpoIapIos.types';\n\n// Export subscription helpers\nexport {\n getActiveSubscriptions,\n hasActiveSubscriptions,\n type ActiveSubscription,\n} from './helpers/subscription';\n\n// Get the native constant value\nexport const PI = ExpoIapModule.PI;\n\nexport enum IapEvent {\n PurchaseUpdated = 'purchase-updated',\n PurchaseError = 'purchase-error',\n /** @deprecated Use PurchaseUpdated instead. This will be removed in a future version. */\n TransactionIapUpdated = 'iap-transaction-updated',\n PromotedProductIOS = 'promoted-product-ios',\n}\n\nexport function setValueAsync(value: string) {\n return ExpoIapModule.setValueAsync(value);\n}\n\n// Ensure the emitter has proper EventEmitter interface\nexport const emitter = (ExpoIapModule || NativeModulesProxy.ExpoIap) as {\n addListener: (\n eventName: string,\n listener: (...args: any[]) => void,\n ) => {remove: () => void};\n removeListener: (\n eventName: string,\n listener: (...args: any[]) => void,\n ) => void;\n};\n\nexport const purchaseUpdatedListener = (\n listener: (event: Purchase) => void,\n) => {\n const emitterSubscription = emitter.addListener(\n IapEvent.PurchaseUpdated,\n listener,\n );\n return emitterSubscription;\n};\n\nexport const purchaseErrorListener = (\n listener: (error: PurchaseError) => void,\n) => {\n return emitter.addListener(IapEvent.PurchaseError, listener);\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 console.warn(\n 'promotedProductListenerIOS: This listener is only available on iOS',\n );\n return {remove: () => {}};\n }\n return emitter.addListener(IapEvent.PromotedProductIOS, listener);\n};\n\nexport function initConnection(): Promise<boolean> {\n const result = ExpoIapModule.initConnection();\n return Promise.resolve(result);\n}\n\nexport const getProducts = async (skus: string[]): Promise<Product[]> => {\n console.warn(\n \"`getProducts` is deprecated. Use `requestProducts({ skus, type: 'inapp' })` instead. This function will be removed in version 3.0.0.\",\n );\n if (!skus?.length) {\n return Promise.reject(new Error('\"skus\" is required'));\n }\n\n return Platform.select({\n ios: async () => {\n const rawItems = await ExpoIapModule.getItems(skus);\n return rawItems.filter((item: unknown) => {\n if (!isProductIos(item)) return false;\n return (\n typeof item === 'object' &&\n item !== null &&\n 'id' in item &&\n typeof item.id === 'string' &&\n skus.includes(item.id)\n );\n }) as Product[];\n },\n android: async () => {\n const products = await ExpoIapModule.getItemsByType('inapp', skus);\n return products.filter((product: unknown) =>\n isProductAndroid<Product>(product),\n );\n },\n default: () => Promise.reject(new Error('Unsupported Platform')),\n })();\n};\n\nexport const getSubscriptions = async (\n skus: string[],\n): Promise<SubscriptionProduct[]> => {\n console.warn(\n \"`getSubscriptions` is deprecated. Use `requestProducts({ skus, type: 'subs' })` instead. This function will be removed in version 3.0.0.\",\n );\n if (!skus?.length) {\n return Promise.reject(new Error('\"skus\" is required'));\n }\n\n return Platform.select({\n ios: async () => {\n const rawItems = await ExpoIapModule.getItems(skus);\n return rawItems.filter((item: unknown) => {\n if (!isProductIos(item)) return false;\n return (\n typeof item === 'object' &&\n item !== null &&\n 'id' in item &&\n typeof item.id === 'string' &&\n skus.includes(item.id)\n );\n }) as SubscriptionProduct[];\n },\n android: async () => {\n const rawItems = await ExpoIapModule.getItemsByType('subs', skus);\n return rawItems.filter((item: unknown) => {\n if (!isProductAndroid(item)) return false;\n return (\n typeof item === 'object' &&\n item !== null &&\n 'id' in item &&\n typeof item.id === 'string' &&\n skus.includes(item.id)\n );\n }) as SubscriptionProduct[];\n },\n default: () => Promise.reject(new Error('Unsupported Platform')),\n })();\n};\n\nexport async function endConnection(): Promise<boolean> {\n return ExpoIapModule.endConnection();\n}\n\n/**\n * Request products with unified API (v2.7.0+)\n *\n * @param params - Product request configuration\n * @param params.skus - Array of product SKUs to fetch\n * @param params.type - Type of products: 'inapp' for regular products (default) or 'subs' for subscriptions\n *\n * @example\n * ```typescript\n * // Regular products\n * const products = await requestProducts({\n * skus: ['product1', 'product2'],\n * type: 'inapp'\n * });\n *\n * // Subscriptions\n * const subscriptions = await requestProducts({\n * skus: ['sub1', 'sub2'],\n * type: 'subs'\n * });\n * ```\n */\nexport const requestProducts = async ({\n skus,\n type = 'inapp',\n}: {\n skus: string[];\n type?: 'inapp' | 'subs';\n}): Promise<Product[] | SubscriptionProduct[]> => {\n if (!skus?.length) {\n throw new Error('No SKUs provided');\n }\n\n if (Platform.OS === 'ios') {\n const rawItems = await ExpoIapModule.getItems(skus);\n const filteredItems = rawItems.filter((item: unknown) => {\n if (!isProductIos(item)) return false;\n return (\n typeof item === 'object' &&\n item !== null &&\n 'id' in item &&\n typeof item.id === 'string' &&\n skus.includes(item.id)\n );\n });\n\n return type === 'inapp'\n ? (filteredItems as Product[])\n : (filteredItems as SubscriptionProduct[]);\n }\n\n if (Platform.OS === 'android') {\n const items = await ExpoIapModule.getItemsByType(type, skus);\n const filteredItems = items.filter((item: unknown) => {\n if (!isProductAndroid(item)) return false;\n return (\n typeof item === 'object' &&\n item !== null &&\n 'id' in item &&\n typeof item.id === 'string' &&\n skus.includes(item.id)\n );\n });\n\n return type === 'inapp'\n ? (filteredItems as Product[])\n : (filteredItems as SubscriptionProduct[]);\n }\n\n throw new Error('Unsupported platform');\n};\n\n/**\n * @deprecated Use `getPurchaseHistories` instead. This function will be removed in version 3.0.0.\n */\nexport const getPurchaseHistory = ({\n alsoPublishToEventListener = false,\n onlyIncludeActiveItems = false,\n}: {\n alsoPublishToEventListener?: boolean;\n onlyIncludeActiveItems?: boolean;\n} = {}): Promise<ProductPurchase[]> => {\n console.warn(\n '`getPurchaseHistory` is deprecated. Use `getPurchaseHistories` instead. This function will be removed in version 3.0.0.',\n );\n return getPurchaseHistories({\n alsoPublishToEventListener,\n onlyIncludeActiveItems,\n });\n};\n\nexport const getPurchaseHistories = ({\n alsoPublishToEventListener = false,\n onlyIncludeActiveItems = false,\n}: {\n alsoPublishToEventListener?: boolean;\n onlyIncludeActiveItems?: boolean;\n} = {}): Promise<ProductPurchase[]> =>\n (\n Platform.select({\n ios: async () => {\n return ExpoIapModule.getAvailableItems(\n alsoPublishToEventListener,\n onlyIncludeActiveItems,\n );\n },\n android: async () => {\n // getPurchaseHistoryByType was removed in Google Play Billing Library v8\n // Android doesn't provide purchase history anymore, only active purchases\n console.warn(\n 'getPurchaseHistories is not supported on Android with Google Play Billing Library v8. Use getAvailablePurchases instead to get active purchases.',\n );\n return [];\n },\n }) || (() => Promise.resolve([]))\n )();\n\nexport const getAvailablePurchases = ({\n alsoPublishToEventListener = false,\n onlyIncludeActiveItems = true,\n}: {\n alsoPublishToEventListener?: boolean;\n onlyIncludeActiveItems?: boolean;\n} = {}): Promise<ProductPurchase[]> =>\n (\n Platform.select({\n ios: () =>\n ExpoIapModule.getAvailableItems(\n alsoPublishToEventListener,\n onlyIncludeActiveItems,\n ),\n android: async () => {\n const products = await ExpoIapModule.getAvailableItemsByType('inapp');\n const subscriptions = await ExpoIapModule.getAvailableItemsByType(\n 'subs',\n );\n return products.concat(subscriptions);\n },\n }) || (() => Promise.resolve([]))\n )();\n\nconst offerToRecordIos = (\n offer: PaymentDiscount | undefined,\n): Record<keyof PaymentDiscount, string> | undefined => {\n if (!offer) return undefined;\n return {\n identifier: offer.identifier,\n keyIdentifier: offer.keyIdentifier,\n nonce: offer.nonce,\n signature: offer.signature,\n timestamp: offer.timestamp.toString(),\n };\n};\n\n// Define discriminated union with explicit type parameter\ntype PurchaseRequest =\n | {\n request: RequestPurchaseProps;\n type?: 'inapp';\n }\n | {\n request: RequestSubscriptionProps;\n type: 'subs';\n };\n\n/**\n * Helper to normalize request props to platform-specific format\n */\nconst normalizeRequestProps = (\n request: RequestPurchaseProps | RequestSubscriptionProps,\n platform: 'ios' | 'android',\n): any => {\n // Platform-specific format - directly return the appropriate platform data\n return platform === 'ios' ? request.ios : request.android;\n};\n\n/**\n * Request a purchase for products or subscriptions.\n *\n * @param requestObj - Purchase request configuration\n * @param requestObj.request - Platform-specific purchase parameters\n * @param requestObj.type - Type of purchase: 'inapp' for products (default) or 'subs' for subscriptions\n *\n * @example\n * ```typescript\n * // Product purchase\n * await requestPurchase({\n * request: {\n * ios: { sku: productId },\n * android: { skus: [productId] }\n * },\n * type: 'inapp'\n * });\n *\n * // Subscription purchase\n * await requestPurchase({\n * request: {\n * ios: { sku: subscriptionId },\n * android: {\n * skus: [subscriptionId],\n * subscriptionOffers: [{ sku: subscriptionId, offerToken: 'token' }]\n * }\n * },\n * type: 'subs'\n * });\n * ```\n */\nexport const requestPurchase = (\n requestObj: PurchaseRequest,\n): Promise<\n | ProductPurchase\n | SubscriptionPurchase\n | ProductPurchase[]\n | SubscriptionPurchase[]\n | void\n> => {\n const {request, type = 'inapp'} = requestObj;\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 iOS. The `sku` property is required and must be a string.',\n );\n }\n\n const {\n sku,\n andDangerouslyFinishTransactionAutomaticallyIOS = false,\n appAccountToken,\n quantity,\n withOffer,\n } = normalizedRequest;\n\n return (async () => {\n const offer = offerToRecordIos(withOffer);\n const purchase = await ExpoIapModule.buyProduct(\n sku,\n andDangerouslyFinishTransactionAutomaticallyIOS,\n appAccountToken,\n quantity ?? -1,\n offer,\n );\n\n return type === 'inapp'\n ? (purchase as ProductPurchase)\n : (purchase as SubscriptionPurchase);\n })();\n }\n\n if (Platform.OS === 'android') {\n const normalizedRequest = normalizeRequestProps(request, 'android');\n\n if (!normalizedRequest?.skus?.length) {\n throw new Error(\n 'Invalid request for Android. The `skus` property is required and must be a non-empty array.',\n );\n }\n\n if (type === 'inapp') {\n const {\n skus,\n obfuscatedAccountIdAndroid,\n obfuscatedProfileIdAndroid,\n isOfferPersonalized,\n } = normalizedRequest;\n\n return (async () => {\n return ExpoIapModule.buyItemByType({\n type: 'inapp',\n skuArr: skus,\n purchaseToken: undefined,\n replacementMode: -1,\n obfuscatedAccountId: obfuscatedAccountIdAndroid,\n obfuscatedProfileId: obfuscatedProfileIdAndroid,\n offerTokenArr: [],\n isOfferPersonalized: isOfferPersonalized ?? false,\n }) as Promise<ProductPurchase[]>;\n })();\n }\n\n if (type === 'subs') {\n const {\n skus,\n obfuscatedAccountIdAndroid,\n obfuscatedProfileIdAndroid,\n isOfferPersonalized,\n subscriptionOffers = [],\n replacementModeAndroid = -1,\n purchaseTokenAndroid,\n } = normalizedRequest;\n\n return (async () => {\n return ExpoIapModule.buyItemByType({\n type: 'subs',\n skuArr: skus,\n purchaseToken: purchaseTokenAndroid,\n replacementMode: replacementModeAndroid,\n obfuscatedAccountId: obfuscatedAccountIdAndroid,\n obfuscatedProfileId: obfuscatedProfileIdAndroid,\n offerTokenArr: subscriptionOffers.map((so: any) => so.offerToken),\n isOfferPersonalized: isOfferPersonalized ?? false,\n }) as Promise<SubscriptionPurchase[]>;\n })();\n }\n\n throw new Error(\n \"Invalid request for Android: Expected a valid request object with 'skus' array.\",\n );\n }\n\n return Promise.resolve(); // Fallback for unsupported platforms\n};\n\n/**\n * @deprecated Use `requestPurchase({ request, type: 'subs' })` instead. This method will be removed in version 3.0.0.\n *\n * @example\n * ```typescript\n * // Old way (deprecated)\n * await requestSubscription({\n * sku: subscriptionId,\n * // or for Android\n * skus: [subscriptionId],\n * });\n *\n * // New way (recommended)\n * await requestPurchase({\n * request: {\n * ios: { sku: subscriptionId },\n * android: {\n * skus: [subscriptionId],\n * subscriptionOffers: [{ sku: subscriptionId, offerToken: 'token' }]\n * }\n * },\n * type: 'subs'\n * });\n * ```\n */\nexport const requestSubscription = async (\n request: RequestSubscriptionProps,\n): Promise<SubscriptionPurchase | SubscriptionPurchase[] | null | void> => {\n console.warn(\n \"`requestSubscription` is deprecated and will be removed in version 3.0.0. Use `requestPurchase({ request, type: 'subs' })` instead.\",\n );\n return (await requestPurchase({request, type: 'subs'})) as\n | SubscriptionPurchase\n | SubscriptionPurchase[]\n | null\n | void;\n};\n\nexport const finishTransaction = ({\n purchase,\n isConsumable = false,\n}: {\n purchase: Purchase;\n isConsumable?: boolean;\n}): Promise<PurchaseResult | boolean> => {\n return (\n Platform.select({\n ios: async () => {\n const transactionId = purchase.id;\n if (!transactionId) {\n return Promise.reject(\n new Error('purchase.id required to finish iOS transaction'),\n );\n }\n await ExpoIapModule.finishTransaction(transactionId);\n return Promise.resolve(true);\n },\n android: async () => {\n const androidPurchase = purchase as ProductPurchaseAndroid;\n\n if (!('purchaseTokenAndroid' in androidPurchase)) {\n return Promise.reject(\n new Error('purchaseToken is required to finish transaction'),\n );\n }\n if (isConsumable) {\n return ExpoIapModule.consumeProduct(\n androidPurchase.purchaseTokenAndroid,\n );\n } else {\n return ExpoIapModule.acknowledgePurchase(\n androidPurchase.purchaseTokenAndroid,\n );\n }\n },\n }) || (() => Promise.reject(new Error('Unsupported Platform')))\n )();\n};\n\n/**\n * Retrieves the current storefront information from iOS App Store\n *\n * @returns Promise resolving to the storefront country code\n * @throws Error if called on non-iOS platform\n *\n * @example\n * ```typescript\n * const storefront = await getStorefrontIOS();\n * console.log(storefront); // 'US'\n * ```\n *\n * @platform iOS\n */\nexport const getStorefrontIOS = (): Promise<string> => {\n if (Platform.OS !== 'ios') {\n console.warn('getStorefrontIOS: This method is only available on iOS');\n return Promise.resolve('');\n }\n return ExpoIapModule.getStorefront();\n};\n\n/**\n * @deprecated Use `getStorefrontIOS` instead. This function will be removed in version 3.0.0.\n */\nexport const getStorefront = (): Promise<string> => {\n console.warn(\n '`getStorefront` is deprecated. Use `getStorefrontIOS` instead. This function will be removed in version 3.0.0.',\n );\n return getStorefrontIOS();\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 */\nexport const validateReceipt = async (\n sku: string,\n androidOptions?: {\n packageName: string;\n productToken: string;\n accessToken: string;\n isSub?: boolean;\n },\n): Promise<any> => {\n if (Platform.OS === 'ios') {\n return await validateReceiptIOS(sku);\n } else if (Platform.OS === 'android') {\n if (\n !androidOptions ||\n !androidOptions.packageName ||\n !androidOptions.productToken ||\n !androidOptions.accessToken\n ) {\n throw new Error(\n 'Android validation requires packageName, productToken, and accessToken',\n );\n }\n return await validateReceiptAndroid({\n packageName: androidOptions.packageName,\n productId: sku,\n productToken: androidOptions.productToken,\n accessToken: androidOptions.accessToken,\n isSub: androidOptions.isSub,\n });\n } else {\n throw new Error('Platform not supported');\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 = (options: {\n skuAndroid?: string;\n packageNameAndroid?: string;\n}): Promise<void> => {\n if (Platform.OS === 'ios') {\n return deepLinkToSubscriptionsIos();\n }\n\n if (Platform.OS === 'android') {\n if (!options.skuAndroid) {\n return Promise.reject(\n new Error(\n 'skuAndroid is required to locate subscription in Android Store',\n ),\n );\n }\n if (!options.packageNameAndroid) {\n return Promise.reject(\n new Error(\n 'packageNameAndroid is required to identify your app in Android Store',\n ),\n );\n }\n return deepLinkToSubscriptionsAndroid({\n sku: options.skuAndroid,\n packageName: options.packageNameAndroid,\n });\n }\n\n return Promise.reject(new Error(`Unsupported platform: ${Platform.OS}`));\n};\n\nexport * from './useIap';\nexport * from './utils/errorMapping';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,wBAAwB;AACxB,OAAO,EAAC,kBAAkB,EAAC,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAC,QAAQ,EAAC,MAAM,cAAc,CAAC;AAEtC,mBAAmB;AACnB,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,0BAA0B,GAC3B,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,gBAAgB,EAChB,sBAAsB,EACtB,8BAA8B,GAC/B,MAAM,mBAAmB,CAAC;AAiB3B,mBAAmB;AACnB,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAG9B,8BAA8B;AAC9B,OAAO,EACL,sBAAsB,EACtB,sBAAsB,GAEvB,MAAM,wBAAwB,CAAC;AAEhC,gCAAgC;AAChC,MAAM,CAAC,M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I,KAAK,CAAC,wBAAwB,CAAC,CAAC;IAC5C,CAAC;AACH,CAAC,CAAC;AAEF;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,OAGvC,EAAiB,EAAE;IAClB,IAAI,QAAQ,CAAC,EAAE,KAAK,KAAK,EAAE,CAAC;QAC1B,OAAO,0BAA0B,EAAE,CAAC;IACtC,CAAC;IAED,IAAI,QAAQ,CAAC,EAAE,KAAK,SAAS,EAAE,CAAC;QAC9B,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC;YACxB,OAAO,OAAO,CAAC,MAAM,CACnB,IAAI,KAAK,CACP,gEAAgE,CACjE,CACF,CAAC;QACJ,CAAC;QACD,IAAI,CAAC,OAAO,CAAC,kBAAkB,EAAE,CAAC;YAChC,OAAO,OAAO,CAAC,MAAM,CACnB,IAAI,KAAK,CACP,sEAAsE,CACvE,CACF,CAAC;QACJ,CAAC;QACD,OAAO,8BAA8B,CAAC;YACpC,GAAG,EAAE,OAAO,CAAC,UAAU;YACvB,WAAW,EAAE,OAAO,CAAC,kBAAkB;SACxC,CAAC,CAAC;IACL,CAAC;IAED,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,yBAAyB,QAAQ,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;AAC3E,CAAC,CAAC;AAEF,cAAc,UAAU,CAAC;AACzB,cAAc,sBAAsB,CAAC","sourcesContent":["// External dependencies\nimport {NativeModulesProxy} from 'expo-modules-core';\nimport {Platform} from 'react-native';\n\n// Internal modules\nimport ExpoIapModule from './ExpoIapModule';\nimport {\n isProductIos,\n validateReceiptIOS,\n deepLinkToSubscriptionsIos,\n} from './modules/ios';\nimport {\n isProductAndroid,\n validateReceiptAndroid,\n deepLinkToSubscriptionsAndroid,\n} from './modules/android';\n\n// Types\nimport {\n Product,\n ProductPurchase,\n Purchase,\n PurchaseError,\n PurchaseResult,\n RequestSubscriptionProps,\n RequestPurchaseProps,\n SubscriptionProduct,\n SubscriptionPurchase,\n} from './ExpoIap.types';\nimport {ProductPurchaseAndroid} from './types/ExpoIapAndroid.types';\nimport {PaymentDiscount} from './types/ExpoIapIos.types';\n\n// Export all types\nexport * from './ExpoIap.types';\nexport * from './modules/android';\nexport * from './modules/ios';\nexport type {AppTransactionIOS} from './types/ExpoIapIos.types';\n\n// Export subscription helpers\nexport {\n getActiveSubscriptions,\n hasActiveSubscriptions,\n type ActiveSubscription,\n} from './helpers/subscription';\n\n// Get the native constant value\nexport const PI = ExpoIapModule.PI;\n\nexport enum IapEvent {\n PurchaseUpdated = 'purchase-updated',\n PurchaseError = 'purchase-error',\n /** @deprecated Use PurchaseUpdated instead. This will be removed in a future version. */\n TransactionIapUpdated = 'iap-transaction-updated',\n PromotedProductIOS = 'promoted-product-ios',\n}\n\nexport function setValueAsync(value: string) {\n return ExpoIapModule.setValueAsync(value);\n}\n\n// Ensure the emitter has proper EventEmitter interface\nexport const emitter = (ExpoIapModule || NativeModulesProxy.ExpoIap) as {\n addListener: (\n eventName: string,\n listener: (...args: any[]) => void,\n ) => {remove: () => void};\n removeListener: (\n eventName: string,\n listener: (...args: any[]) => void,\n ) => void;\n};\n\nexport const purchaseUpdatedListener = (\n listener: (event: Purchase) => void,\n) => {\n const emitterSubscription = emitter.addListener(\n IapEvent.PurchaseUpdated,\n listener,\n );\n return emitterSubscription;\n};\n\nexport const purchaseErrorListener = (\n listener: (error: PurchaseError) => void,\n) => {\n return emitter.addListener(IapEvent.PurchaseError, listener);\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 console.warn(\n 'promotedProductListenerIOS: This listener is only available on iOS',\n );\n return {remove: () => {}};\n }\n return emitter.addListener(IapEvent.PromotedProductIOS, listener);\n};\n\nexport function initConnection(): Promise<boolean> {\n const result = ExpoIapModule.initConnection();\n return Promise.resolve(result);\n}\n\nexport const getProducts = async (skus: string[]): Promise<Product[]> => {\n console.warn(\n \"`getProducts` is deprecated. Use `requestProducts({ skus, type: 'inapp' })` instead. This function will be removed in version 3.0.0.\",\n );\n if (!skus?.length) {\n return Promise.reject(new Error('\"skus\" is required'));\n }\n\n return Platform.select({\n ios: async () => {\n const rawItems = await ExpoIapModule.getItems(skus);\n return rawItems.filter((item: unknown) => {\n if (!isProductIos(item)) return false;\n return (\n typeof item === 'object' &&\n item !== null &&\n 'id' in item &&\n typeof item.id === 'string' &&\n skus.includes(item.id)\n );\n }) as Product[];\n },\n android: async () => {\n const products = await ExpoIapModule.getItemsByType('inapp', skus);\n return products.filter((product: unknown) =>\n isProductAndroid<Product>(product),\n );\n },\n default: () => Promise.reject(new Error('Unsupported Platform')),\n })();\n};\n\nexport const getSubscriptions = async (\n skus: string[],\n): Promise<SubscriptionProduct[]> => {\n console.warn(\n \"`getSubscriptions` is deprecated. Use `requestProducts({ skus, type: 'subs' })` instead. This function will be removed in version 3.0.0.\",\n );\n if (!skus?.length) {\n return Promise.reject(new Error('\"skus\" is required'));\n }\n\n return Platform.select({\n ios: async () => {\n const rawItems = await ExpoIapModule.getItems(skus);\n return rawItems.filter((item: unknown) => {\n if (!isProductIos(item)) return false;\n return (\n typeof item === 'object' &&\n item !== null &&\n 'id' in item &&\n typeof item.id === 'string' &&\n skus.includes(item.id)\n );\n }) as SubscriptionProduct[];\n },\n android: async () => {\n const rawItems = await ExpoIapModule.getItemsByType('subs', skus);\n return rawItems.filter((item: unknown) => {\n if (!isProductAndroid(item)) return false;\n return (\n typeof item === 'object' &&\n item !== null &&\n 'id' in item &&\n typeof item.id === 'string' &&\n skus.includes(item.id)\n );\n }) as SubscriptionProduct[];\n },\n default: () => Promise.reject(new Error('Unsupported Platform')),\n })();\n};\n\nexport async function endConnection(): Promise<boolean> {\n return ExpoIapModule.endConnection();\n}\n\n/**\n * Request products with unified API (v2.7.0+)\n *\n * @param params - Product request configuration\n * @param params.skus - Array of product SKUs to fetch\n * @param params.type - Type of products: 'inapp' for regular products (default) or 'subs' for subscriptions\n *\n * @example\n * ```typescript\n * // Regular products\n * const products = await requestProducts({\n * skus: ['product1', 'product2'],\n * type: 'inapp'\n * });\n *\n * // Subscriptions\n * const subscriptions = await requestProducts({\n * skus: ['sub1', 'sub2'],\n * type: 'subs'\n * });\n * ```\n */\nexport const requestProducts = async ({\n skus,\n type = 'inapp',\n}: {\n skus: string[];\n type?: 'inapp' | 'subs';\n}): Promise<Product[] | SubscriptionProduct[]> => {\n if (!skus?.length) {\n throw new Error('No SKUs provided');\n }\n\n if (Platform.OS === 'ios') {\n const rawItems = await ExpoIapModule.getItems(skus);\n const filteredItems = rawItems.filter((item: unknown) => {\n if (!isProductIos(item)) return false;\n return (\n typeof item === 'object' &&\n item !== null &&\n 'id' in item &&\n typeof item.id === 'string' &&\n skus.includes(item.id)\n );\n });\n\n return type === 'inapp'\n ? (filteredItems as Product[])\n : (filteredItems as SubscriptionProduct[]);\n }\n\n if (Platform.OS === 'android') {\n const items = await ExpoIapModule.getItemsByType(type, skus);\n const filteredItems = items.filter((item: unknown) => {\n if (!isProductAndroid(item)) return false;\n return (\n typeof item === 'object' &&\n item !== null &&\n 'id' in item &&\n typeof item.id === 'string' &&\n skus.includes(item.id)\n );\n });\n\n return type === 'inapp'\n ? (filteredItems as Product[])\n : (filteredItems as SubscriptionProduct[]);\n }\n\n throw new Error('Unsupported platform');\n};\n\n/**\n * @deprecated Use `getPurchaseHistories` instead. This function will be removed in version 3.0.0.\n */\nexport const getPurchaseHistory = ({\n alsoPublishToEventListener = false,\n onlyIncludeActiveItems = false,\n}: {\n alsoPublishToEventListener?: boolean;\n onlyIncludeActiveItems?: boolean;\n} = {}): Promise<ProductPurchase[]> => {\n console.warn(\n '`getPurchaseHistory` is deprecated. Use `getPurchaseHistories` instead. This function will be removed in version 3.0.0.',\n );\n return getPurchaseHistories({\n alsoPublishToEventListener,\n onlyIncludeActiveItems,\n });\n};\n\nexport const getPurchaseHistories = ({\n alsoPublishToEventListener = false,\n onlyIncludeActiveItems = false,\n}: {\n alsoPublishToEventListener?: boolean;\n onlyIncludeActiveItems?: boolean;\n} = {}): Promise<ProductPurchase[]> =>\n (\n Platform.select({\n ios: async () => {\n return ExpoIapModule.getAvailableItems(\n alsoPublishToEventListener,\n onlyIncludeActiveItems,\n );\n },\n android: async () => {\n // getPurchaseHistoryByType was removed in Google Play Billing Library v8\n // Android doesn't provide purchase history anymore, only active purchases\n console.warn(\n 'getPurchaseHistories is not supported on Android with Google Play Billing Library v8. Use getAvailablePurchases instead to get active purchases.',\n );\n return [];\n },\n }) || (() => Promise.resolve([]))\n )();\n\nexport const getAvailablePurchases = ({\n alsoPublishToEventListener = false,\n onlyIncludeActiveItems = true,\n}: {\n alsoPublishToEventListener?: boolean;\n onlyIncludeActiveItems?: boolean;\n} = {}): Promise<ProductPurchase[]> =>\n (\n Platform.select({\n ios: () =>\n ExpoIapModule.getAvailableItems(\n alsoPublishToEventListener,\n onlyIncludeActiveItems,\n ),\n android: async () => {\n const products = await ExpoIapModule.getAvailableItemsByType('inapp');\n const subscriptions = await ExpoIapModule.getAvailableItemsByType(\n 'subs',\n );\n return products.concat(subscriptions);\n },\n }) || (() => Promise.resolve([]))\n )();\n\nconst offerToRecordIos = (\n offer: PaymentDiscount | undefined,\n): Record<keyof PaymentDiscount, string> | undefined => {\n if (!offer) return undefined;\n return {\n identifier: offer.identifier,\n keyIdentifier: offer.keyIdentifier,\n nonce: offer.nonce,\n signature: offer.signature,\n timestamp: offer.timestamp.toString(),\n };\n};\n\n// Define discriminated union with explicit type parameter\ntype PurchaseRequest =\n | {\n request: RequestPurchaseProps;\n type?: 'inapp';\n }\n | {\n request: RequestSubscriptionProps;\n type: 'subs';\n };\n\n/**\n * Helper to normalize request props to platform-specific format\n */\nconst normalizeRequestProps = (\n request: RequestPurchaseProps | RequestSubscriptionProps,\n platform: 'ios' | 'android',\n): any => {\n // Platform-specific format - directly return the appropriate platform data\n return platform === 'ios' ? request.ios : request.android;\n};\n\n/**\n * Request a purchase for products or subscriptions.\n *\n * @param requestObj - Purchase request configuration\n * @param requestObj.request - Platform-specific purchase parameters\n * @param requestObj.type - Type of purchase: 'inapp' for products (default) or 'subs' for subscriptions\n *\n * @example\n * ```typescript\n * // Product purchase\n * await requestPurchase({\n * request: {\n * ios: { sku: productId },\n * android: { skus: [productId] }\n * },\n * type: 'inapp'\n * });\n *\n * // Subscription purchase\n * await requestPurchase({\n * request: {\n * ios: { sku: subscriptionId },\n * android: {\n * skus: [subscriptionId],\n * subscriptionOffers: [{ sku: subscriptionId, offerToken: 'token' }]\n * }\n * },\n * type: 'subs'\n * });\n * ```\n */\nexport const requestPurchase = (\n requestObj: PurchaseRequest,\n): Promise<\n | ProductPurchase\n | SubscriptionPurchase\n | ProductPurchase[]\n | SubscriptionPurchase[]\n | void\n> => {\n const {request, type = 'inapp'} = requestObj;\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 iOS. The `sku` property is required and must be a string.',\n );\n }\n\n const {\n sku,\n andDangerouslyFinishTransactionAutomaticallyIOS = false,\n appAccountToken,\n quantity,\n withOffer,\n } = normalizedRequest;\n\n return (async () => {\n const offer = offerToRecordIos(withOffer);\n const purchase = await ExpoIapModule.buyProduct(\n sku,\n andDangerouslyFinishTransactionAutomaticallyIOS,\n appAccountToken,\n quantity ?? -1,\n offer,\n );\n\n return type === 'inapp'\n ? (purchase as ProductPurchase)\n : (purchase as SubscriptionPurchase);\n })();\n }\n\n if (Platform.OS === 'android') {\n const normalizedRequest = normalizeRequestProps(request, 'android');\n\n if (!normalizedRequest?.skus?.length) {\n throw new Error(\n 'Invalid request for Android. The `skus` property is required and must be a non-empty array.',\n );\n }\n\n if (type === 'inapp') {\n const {\n skus,\n obfuscatedAccountIdAndroid,\n obfuscatedProfileIdAndroid,\n isOfferPersonalized,\n } = normalizedRequest;\n\n return (async () => {\n return ExpoIapModule.buyItemByType({\n type: 'inapp',\n skuArr: skus,\n purchaseToken: undefined,\n replacementMode: -1,\n obfuscatedAccountId: obfuscatedAccountIdAndroid,\n obfuscatedProfileId: obfuscatedProfileIdAndroid,\n offerTokenArr: [],\n isOfferPersonalized: isOfferPersonalized ?? false,\n }) as Promise<ProductPurchase[]>;\n })();\n }\n\n if (type === 'subs') {\n const {\n skus,\n obfuscatedAccountIdAndroid,\n obfuscatedProfileIdAndroid,\n isOfferPersonalized,\n subscriptionOffers = [],\n replacementModeAndroid = -1,\n purchaseTokenAndroid,\n purchaseToken,\n } = normalizedRequest;\n\n return (async () => {\n return ExpoIapModule.buyItemByType({\n type: 'subs',\n skuArr: skus,\n purchaseToken: purchaseTokenAndroid || purchaseToken,\n replacementMode: replacementModeAndroid,\n obfuscatedAccountId: obfuscatedAccountIdAndroid,\n obfuscatedProfileId: obfuscatedProfileIdAndroid,\n offerTokenArr: subscriptionOffers.map((so: any) => so.offerToken),\n isOfferPersonalized: isOfferPersonalized ?? false,\n }) as Promise<SubscriptionPurchase[]>;\n })();\n }\n\n throw new Error(\n \"Invalid request for Android: Expected a valid request object with 'skus' array.\",\n );\n }\n\n return Promise.resolve(); // Fallback for unsupported platforms\n};\n\n/**\n * @deprecated Use `requestPurchase({ request, type: 'subs' })` instead. This method will be removed in version 3.0.0.\n *\n * @example\n * ```typescript\n * // Old way (deprecated)\n * await requestSubscription({\n * sku: subscriptionId,\n * // or for Android\n * skus: [subscriptionId],\n * });\n *\n * // New way (recommended)\n * await requestPurchase({\n * request: {\n * ios: { sku: subscriptionId },\n * android: {\n * skus: [subscriptionId],\n * subscriptionOffers: [{ sku: subscriptionId, offerToken: 'token' }]\n * }\n * },\n * type: 'subs'\n * });\n * ```\n */\nexport const requestSubscription = async (\n request: RequestSubscriptionProps,\n): Promise<SubscriptionPurchase | SubscriptionPurchase[] | null | void> => {\n console.warn(\n \"`requestSubscription` is deprecated and will be removed in version 3.0.0. Use `requestPurchase({ request, type: 'subs' })` instead.\",\n );\n return (await requestPurchase({request, type: 'subs'})) as\n | SubscriptionPurchase\n | SubscriptionPurchase[]\n | null\n | void;\n};\n\nexport const finishTransaction = ({\n purchase,\n isConsumable = false,\n}: {\n purchase: Purchase;\n isConsumable?: boolean;\n}): Promise<PurchaseResult | boolean> => {\n return (\n Platform.select({\n ios: async () => {\n const transactionId = purchase.id;\n if (!transactionId) {\n return Promise.reject(\n new Error('purchase.id required to finish iOS transaction'),\n );\n }\n await ExpoIapModule.finishTransaction(transactionId);\n return Promise.resolve(true);\n },\n android: async () => {\n const androidPurchase = purchase as ProductPurchaseAndroid;\n\n if (isConsumable) {\n return ExpoIapModule.consumeProduct(androidPurchase.purchaseToken);\n }\n\n return ExpoIapModule.acknowledgePurchase(androidPurchase.purchaseToken);\n },\n }) || (() => Promise.reject(new Error('Unsupported Platform')))\n )();\n};\n\n/**\n * Retrieves the current storefront information from iOS App Store\n *\n * @returns Promise resolving to the storefront country code\n * @throws Error if called on non-iOS platform\n *\n * @example\n * ```typescript\n * const storefront = await getStorefrontIOS();\n * console.log(storefront); // 'US'\n * ```\n *\n * @platform iOS\n */\nexport const getStorefrontIOS = (): Promise<string> => {\n if (Platform.OS !== 'ios') {\n console.warn('getStorefrontIOS: This method is only available on iOS');\n return Promise.resolve('');\n }\n return ExpoIapModule.getStorefront();\n};\n\n/**\n * @deprecated Use `getStorefrontIOS` instead. This function will be removed in version 3.0.0.\n */\nexport const getStorefront = (): Promise<string> => {\n console.warn(\n '`getStorefront` is deprecated. Use `getStorefrontIOS` instead. This function will be removed in version 3.0.0.',\n );\n return getStorefrontIOS();\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 */\nexport const validateReceipt = async (\n sku: string,\n androidOptions?: {\n packageName: string;\n productToken: string;\n accessToken: string;\n isSub?: boolean;\n },\n): Promise<any> => {\n if (Platform.OS === 'ios') {\n return await validateReceiptIOS(sku);\n } else if (Platform.OS === 'android') {\n if (\n !androidOptions ||\n !androidOptions.packageName ||\n !androidOptions.productToken ||\n !androidOptions.accessToken\n ) {\n throw new Error(\n 'Android validation requires packageName, productToken, and accessToken',\n );\n }\n return await validateReceiptAndroid({\n packageName: androidOptions.packageName,\n productId: sku,\n productToken: androidOptions.productToken,\n accessToken: androidOptions.accessToken,\n isSub: androidOptions.isSub,\n });\n } else {\n throw new Error('Platform not supported');\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 = (options: {\n skuAndroid?: string;\n packageNameAndroid?: string;\n}): Promise<void> => {\n if (Platform.OS === 'ios') {\n return deepLinkToSubscriptionsIos();\n }\n\n if (Platform.OS === 'android') {\n if (!options.skuAndroid) {\n return Promise.reject(\n new Error(\n 'skuAndroid is required to locate subscription in Android Store',\n ),\n );\n }\n if (!options.packageNameAndroid) {\n return Promise.reject(\n new Error(\n 'packageNameAndroid is required to identify your app in Android Store',\n ),\n );\n }\n return deepLinkToSubscriptionsAndroid({\n sku: options.skuAndroid,\n packageName: options.packageNameAndroid,\n });\n }\n\n return Promise.reject(new Error(`Unsupported platform: ${Platform.OS}`));\n};\n\nexport * from './useIap';\nexport * from './utils/errorMapping';\n"]}
|
|
@@ -56,6 +56,9 @@ type SubscriptionOffer = {
|
|
|
56
56
|
offerToken: string;
|
|
57
57
|
};
|
|
58
58
|
export type RequestSubscriptionAndroidProps = RequestPurchaseAndroidProps & {
|
|
59
|
+
/**
|
|
60
|
+
* @deprecated Use `purchaseToken` instead. This field will be removed in a future version.
|
|
61
|
+
*/
|
|
59
62
|
purchaseTokenAndroid?: string;
|
|
60
63
|
replacementModeAndroid?: ReplacementModesAndroid;
|
|
61
64
|
subscriptionOffers: SubscriptionOffer[];
|
|
@@ -99,6 +102,9 @@ export declare enum PurchaseStateAndroid {
|
|
|
99
102
|
}
|
|
100
103
|
export type ProductPurchaseAndroid = PurchaseBase & {
|
|
101
104
|
ids?: string[];
|
|
105
|
+
/**
|
|
106
|
+
* @deprecated Use `purchaseToken` instead. This field will be removed in a future version.
|
|
107
|
+
*/
|
|
102
108
|
purchaseTokenAndroid?: string;
|
|
103
109
|
dataAndroid?: string;
|
|
104
110
|
signatureAndroid?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpoIapAndroid.types.d.ts","sourceRoot":"","sources":["../../src/types/ExpoIapAndroid.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAE,WAAW,EAAC,MAAM,kBAAkB,CAAC;AAE3D,KAAK,2BAA2B,GAAG;IACjC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,cAAc,EAAE,MAAM,CAAC;IACvB,iBAAiB,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEF,KAAK,mBAAmB,GAAG;IACzB,cAAc,EAAE,MAAM,CAAC;IACvB,iBAAiB,EAAE,MAAM,CAAC;IAE1B,aAAa,EAAE,MAAM,CAAC;IACtB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,iBA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AE,MAAM,CAAC;IACpC,0BAA0B,CAAC,EAAE,MAAM,CAAC;CACrC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpoIapAndroid.types.js","sourceRoot":"","sources":["../../src/types/ExpoIapAndroid.types.ts"],"names":[],"mappings":"AAuDA,IAAK,uBAOJ;AAPD,WAAK,uBAAuB;IAC1B,6GAA4B,CAAA;IAC5B,mGAAuB,CAAA;IACvB,uGAAyB,CAAA;IACzB,+FAAqB,CAAA;IACrB,+FAAqB,CAAA;IACrB,6EAAY,CAAA;AACd,CAAC,EAPI,uBAAuB,KAAvB,uBAAuB,QAO3B;
|
|
1
|
+
{"version":3,"file":"ExpoIapAndroid.types.js","sourceRoot":"","sources":["../../src/types/ExpoIapAndroid.types.ts"],"names":[],"mappings":"AAuDA,IAAK,uBAOJ;AAPD,WAAK,uBAAuB;IAC1B,6GAA4B,CAAA;IAC5B,mGAAuB,CAAA;IACvB,uGAAyB,CAAA;IACzB,+FAAqB,CAAA;IACrB,+FAAqB,CAAA;IACrB,6EAAY,CAAA;AACd,CAAC,EAPI,uBAAuB,KAAvB,uBAAuB,QAO3B;AAqCD,MAAM,CAAN,IAAY,kBAWX;AAXD,WAAY,kBAAkB;IAC5B,0EAA0E;IAC1E,2DAAqC,CAAA;IACrC,+CAA+C;IAC/C,6EAAuD,CAAA;IACvD,oFAAoF;IACpF,yDAAmC,CAAA;IACnC,wCAAwC;IACxC,qDAA+B,CAAA;IAC/B,oCAAoC;IACpC,mEAA6C,CAAA;AAC/C,CAAC,EAXW,kBAAkB,KAAlB,kBAAkB,QAW7B;AAED,MAAM,CAAN,IAAY,oBAIX;AAJD,WAAY,oBAAoB;IAC9B,yFAAqB,CAAA;IACrB,yEAAa,CAAA;IACb,qEAAW,CAAA;AACb,CAAC,EAJW,oBAAoB,KAApB,oBAAoB,QAI/B","sourcesContent":["import {PurchaseBase, ProductBase} from '../ExpoIap.types';\n\ntype OneTimePurchaseOfferDetails = {\n priceCurrencyCode: string;\n formattedPrice: string;\n priceAmountMicros: string;\n};\n\ntype PricingPhaseAndroid = {\n formattedPrice: string;\n priceCurrencyCode: string;\n // P1W, P1M, P1Y\n billingPeriod: string;\n billingCycleCount: number;\n priceAmountMicros: string;\n recurrenceMode: number;\n};\n\ntype PricingPhasesAndroid = {\n pricingPhaseList: PricingPhaseAndroid[];\n};\n\ntype SubscriptionOfferDetail = {\n basePlanId: string;\n offerId: string;\n offerToken: string;\n offerTags: string[];\n pricingPhases: PricingPhasesAndroid;\n};\n\nexport type ProductAndroid = ProductBase & {\n name: string;\n oneTimePurchaseOfferDetails?: OneTimePurchaseOfferDetails;\n subscriptionOfferDetails?: SubscriptionOfferDetail[];\n};\n\ntype SubscriptionOfferAndroid = {\n basePlanId: string;\n offerId: string | null;\n offerToken: string;\n pricingPhases: PricingPhasesAndroid;\n offerTags: string[];\n};\n\nexport type SubscriptionProductAndroid = ProductAndroid & {\n subscriptionOfferDetails: SubscriptionOfferAndroid[];\n};\n\nexport type RequestPurchaseAndroidProps = {\n skus: string[];\n obfuscatedAccountIdAndroid?: string;\n obfuscatedProfileIdAndroid?: string;\n isOfferPersonalized?: boolean; // For AndroidBilling V5 https://developer.android.com/google/play/billing/integrate#personalized-price\n};\n\nenum ReplacementModesAndroid {\n UNKNOWN_REPLACEMENT_MODE = 0,\n WITH_TIME_PRORATION = 1,\n CHARGE_PRORATED_PRICE = 2,\n WITHOUT_PRORATION = 3,\n CHARGE_FULL_PRICE = 5,\n DEFERRED = 6,\n}\n\ntype SubscriptionOffer = {\n sku: string;\n offerToken: string;\n};\n\nexport type RequestSubscriptionAndroidProps = RequestPurchaseAndroidProps & {\n /**\n * @deprecated Use `purchaseToken` instead. This field will be removed in a future version.\n */\n purchaseTokenAndroid?: string;\n replacementModeAndroid?: ReplacementModesAndroid;\n subscriptionOffers: SubscriptionOffer[];\n};\n\nexport type ReceiptAndroid = {\n autoRenewing: boolean;\n betaProduct: boolean;\n cancelDate: number | null;\n cancelReason: string;\n deferredDate: number | null;\n deferredSku: number | null;\n freeTrialEndDate: number;\n gracePeriodEndDate: number;\n parentProductId: string;\n productId: string;\n productType: string;\n purchaseDate: number;\n quantity: number;\n receiptId: string;\n renewalDate: number;\n term: string;\n termSku: string;\n testTransaction: boolean;\n};\n\nexport enum FeatureTypeAndroid {\n /** Show in-app messages. Included in documentation by the annotations: */\n IN_APP_MESSAGING = 'IN_APP_MESSAGING',\n /** Launch a price change confirmation flow. */\n PRICE_CHANGE_CONFIRMATION = 'PRICE_CHANGE_CONFIRMATION',\n /** Play billing library support for querying and purchasing with ProductDetails. */\n PRODUCT_DETAILS = 'PRODUCT_DETAILS',\n /** Purchase/query for subscriptions. */\n SUBSCRIPTIONS = 'SUBSCRIPTIONS',\n /** Subscriptions update/replace. */\n SUBSCRIPTIONS_UPDATE = 'SUBSCRIPTIONS_UPDATE',\n}\n\nexport enum PurchaseStateAndroid {\n UNSPECIFIED_STATE = 0,\n PURCHASED = 1,\n PENDING = 2,\n}\n\nexport type ProductPurchaseAndroid = PurchaseBase & {\n ids?: string[];\n /**\n * @deprecated Use `purchaseToken` instead. This field will be removed in a future version.\n */\n purchaseTokenAndroid?: string;\n dataAndroid?: string;\n signatureAndroid?: string;\n autoRenewingAndroid?: boolean;\n purchaseStateAndroid?: PurchaseStateAndroid;\n isAcknowledgedAndroid?: boolean;\n packageNameAndroid?: string;\n developerPayloadAndroid?: string;\n obfuscatedAccountIdAndroid?: string;\n obfuscatedProfileIdAndroid?: string;\n};\n"]}
|
|
@@ -118,6 +118,10 @@ export type ProductPurchaseIos = PurchaseBase & {
|
|
|
118
118
|
};
|
|
119
119
|
priceIos?: number;
|
|
120
120
|
currencyIos?: string;
|
|
121
|
+
/**
|
|
122
|
+
* @deprecated Use `purchaseToken` instead. This field will be removed in a future version.
|
|
123
|
+
* iOS 15+ JWS representation is now available through the `purchaseToken` field.
|
|
124
|
+
*/
|
|
121
125
|
jwsRepresentationIos?: string;
|
|
122
126
|
};
|
|
123
127
|
export type AppTransactionIOS = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpoIapIos.types.d.ts","sourceRoot":"","sources":["../../src/types/ExpoIapIos.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAE,WAAW,EAAC,MAAM,kBAAkB,CAAC;AAE3D,KAAK,qBAAqB,GAAG,KAAK,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,EAAE,CAAC;AACpE,KAAK,WAAW,GAAG,EAAE,GAAG,WAAW,GAAG,YAAY,GAAG,YAAY,CAAC;AAElE,KAAK,iBAAiB,GAAG;IACvB,YAAY,EAAE,MAAM,CAAC;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,WAAW,CAAC;IACzB,MAAM,EAAE;QACN,IAAI,EAAE,qBAAqB,CAAC;QAC5B,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;IACF,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,cAAc,GAAG,aAAa,CAAC;CACtC,CAAC;AAEF,KAAK,gBAAgB,GAAG;IACtB,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;IACtC,iBAAiB,CAAC,EAAE,iBAAiB,EAAE,CAAC;IACxC,mBAAmB,EAAE,MAAM,CAAC;IAC5B,kBAAkB,EAAE;QAClB,IAAI,EAAE,qBAAqB,CAAC;QAC5B,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG,WAAW,GAAG;IACrC,WAAW,EAAE,MAAM,CAAC;IACpB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,YAAY,CAAC,EAAE,gBAAgB,CAAC;IAChC,mCAAmC,CAAC,EAAE,MAAM,CAAC;IAC7C,sCAAsC,CAAC,EAAE,qBAAqB,CAAC;CAChE,CAAC;AAEF,MAAM,MAAM,QAAQ,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,CAAC;IACxB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,6BAA6B,CAAC,EAAE,MAAM,CAAC;IACvC,oBAAoB,CAAC,EAAE,UAAU,GAAG,SAAS,GAAG,MAAM,CAAC;IACvD,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,EAAE;QACT,EAAE,EAAE,MAAM,CAAC;QACX,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,EAAE,MAAM,CAAC;KACrB,CAAC;IACF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,oBAAoB,EAAE,MAAM,CAAC;IAC7B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,uBAAuB,EAAE,MAAM,CAAC;IAChC,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpoIapIos.types.js","sourceRoot":"","sources":["../../src/types/ExpoIapIos.types.ts"],"names":[],"mappings":"","sourcesContent":["import {PurchaseBase, ProductBase} from '../ExpoIap.types';\n\ntype SubscriptionIosPeriod = 'DAY' | 'WEEK' | 'MONTH' | 'YEAR' | '';\ntype PaymentMode = '' | 'FREETRIAL' | 'PAYASYOUGO' | 'PAYUPFRONT';\n\ntype SubscriptionOffer = {\n displayPrice: string;\n id: string;\n paymentMode: PaymentMode;\n period: {\n unit: SubscriptionIosPeriod;\n value: number;\n };\n periodCount: number;\n price: number;\n type: 'introductory' | 'promotional';\n};\n\ntype SubscriptionInfo = {\n introductoryOffer?: SubscriptionOffer;\n promotionalOffers?: SubscriptionOffer[];\n subscriptionGroupID: string;\n subscriptionPeriod: {\n unit: SubscriptionIosPeriod;\n value: number;\n };\n};\n\nexport type ProductIos = ProductBase & {\n displayName: string;\n isFamilyShareable: boolean;\n jsonRepresentation: string;\n subscription?: SubscriptionInfo;\n introductoryPriceNumberOfPeriodsIOS?: string;\n introductoryPriceSubscriptionPeriodIOS?: SubscriptionIosPeriod;\n};\n\nexport type Discount = {\n identifier: string;\n type: string;\n numberOfPeriods: string;\n price: string;\n localizedPrice: string;\n paymentMode: PaymentMode;\n subscriptionPeriod: string;\n};\n\nexport type SubscriptionProductIos = ProductIos & {\n discounts?: Discount[];\n introductoryPrice?: string;\n introductoryPriceAsAmountIOS?: string;\n introductoryPricePaymentModeIOS?: PaymentMode;\n introductoryPriceNumberOfPeriodsIOS?: string;\n introductoryPriceSubscriptionPeriodIOS?: SubscriptionIosPeriod;\n subscriptionPeriodNumberIOS?: string;\n subscriptionPeriodUnitIOS?: SubscriptionIosPeriod;\n};\n\nexport type PaymentDiscount = {\n /**\n * A string used to uniquely identify a discount offer for a product.\n */\n identifier: string;\n /**\n * A string that identifies the key used to generate the signature.\n */\n keyIdentifier: string;\n /**\n * A universally unique ID (UUID) value that you define.\n */\n nonce: string;\n /**\n * A UTF-8 string representing the properties of a specific discount offer, cryptographically signed.\n */\n signature: string;\n /**\n * The date and time of the signature's creation in milliseconds, formatted in Unix epoch time.\n */\n timestamp: number;\n};\n\nexport type RequestPurchaseIosProps = {\n sku: string;\n andDangerouslyFinishTransactionAutomaticallyIOS?: boolean;\n /**\n * UUID representing user account\n */\n appAccountToken?: string;\n quantity?: number;\n withOffer?: PaymentDiscount;\n};\n\nexport type RequestSubscriptionIosProps = RequestPurchaseIosProps;\n\ntype SubscriptionStatus =\n | 'expired'\n | 'inBillingRetryPeriod'\n | 'inGracePeriod'\n | 'revoked'\n | 'subscribed';\n\ntype RenewalInfo = {\n jsonRepresentation?: string;\n willAutoRenew: boolean;\n autoRenewPreference?: string;\n};\n\nexport type ProductStatusIos = {\n state: SubscriptionStatus;\n renewalInfo?: RenewalInfo;\n};\n\nexport type ProductPurchaseIos = PurchaseBase & {\n // iOS basic fields\n quantityIos?: number;\n originalTransactionDateIos?: number;\n originalTransactionIdentifierIos?: string;\n appAccountToken?: string;\n // iOS additional fields from StoreKit 2\n expirationDateIos?: number;\n webOrderLineItemIdIos?: number;\n environmentIos?: string;\n storefrontCountryCodeIos?: string;\n appBundleIdIos?: string;\n productTypeIos?: string;\n subscriptionGroupIdIos?: string;\n isUpgradedIos?: boolean;\n ownershipTypeIos?: string;\n reasonIos?: string;\n reasonStringRepresentationIos?: string;\n transactionReasonIos?: 'PURCHASE' | 'RENEWAL' | string;\n revocationDateIos?: number;\n revocationReasonIos?: string;\n offerIos?: {\n id: string;\n type: string;\n paymentMode: string;\n };\n priceIos?: number;\n currencyIos?: string;\n jwsRepresentationIos?: string;\n};\n\nexport type AppTransactionIOS = {\n appTransactionID?: string; // Only available in iOS 18.4+\n originalPlatform?: string; // Only available in iOS 18.4+\n bundleID: string;\n appVersion: string;\n originalAppVersion: string;\n originalPurchaseDate: number;\n deviceVerification: string;\n deviceVerificationNonce: string;\n environment: string;\n signedDate: number;\n appID?: number;\n appVersionID?: number;\n preorderDate?: number;\n};\n"]}
|
|
1
|
+
{"version":3,"file":"ExpoIapIos.types.js","sourceRoot":"","sources":["../../src/types/ExpoIapIos.types.ts"],"names":[],"mappings":"","sourcesContent":["import {PurchaseBase, ProductBase} from '../ExpoIap.types';\n\ntype SubscriptionIosPeriod = 'DAY' | 'WEEK' | 'MONTH' | 'YEAR' | '';\ntype PaymentMode = '' | 'FREETRIAL' | 'PAYASYOUGO' | 'PAYUPFRONT';\n\ntype SubscriptionOffer = {\n displayPrice: string;\n id: string;\n paymentMode: PaymentMode;\n period: {\n unit: SubscriptionIosPeriod;\n value: number;\n };\n periodCount: number;\n price: number;\n type: 'introductory' | 'promotional';\n};\n\ntype SubscriptionInfo = {\n introductoryOffer?: SubscriptionOffer;\n promotionalOffers?: SubscriptionOffer[];\n subscriptionGroupID: string;\n subscriptionPeriod: {\n unit: SubscriptionIosPeriod;\n value: number;\n };\n};\n\nexport type ProductIos = ProductBase & {\n displayName: string;\n isFamilyShareable: boolean;\n jsonRepresentation: string;\n subscription?: SubscriptionInfo;\n introductoryPriceNumberOfPeriodsIOS?: string;\n introductoryPriceSubscriptionPeriodIOS?: SubscriptionIosPeriod;\n};\n\nexport type Discount = {\n identifier: string;\n type: string;\n numberOfPeriods: string;\n price: string;\n localizedPrice: string;\n paymentMode: PaymentMode;\n subscriptionPeriod: string;\n};\n\nexport type SubscriptionProductIos = ProductIos & {\n discounts?: Discount[];\n introductoryPrice?: string;\n introductoryPriceAsAmountIOS?: string;\n introductoryPricePaymentModeIOS?: PaymentMode;\n introductoryPriceNumberOfPeriodsIOS?: string;\n introductoryPriceSubscriptionPeriodIOS?: SubscriptionIosPeriod;\n subscriptionPeriodNumberIOS?: string;\n subscriptionPeriodUnitIOS?: SubscriptionIosPeriod;\n};\n\nexport type PaymentDiscount = {\n /**\n * A string used to uniquely identify a discount offer for a product.\n */\n identifier: string;\n /**\n * A string that identifies the key used to generate the signature.\n */\n keyIdentifier: string;\n /**\n * A universally unique ID (UUID) value that you define.\n */\n nonce: string;\n /**\n * A UTF-8 string representing the properties of a specific discount offer, cryptographically signed.\n */\n signature: string;\n /**\n * The date and time of the signature's creation in milliseconds, formatted in Unix epoch time.\n */\n timestamp: number;\n};\n\nexport type RequestPurchaseIosProps = {\n sku: string;\n andDangerouslyFinishTransactionAutomaticallyIOS?: boolean;\n /**\n * UUID representing user account\n */\n appAccountToken?: string;\n quantity?: number;\n withOffer?: PaymentDiscount;\n};\n\nexport type RequestSubscriptionIosProps = RequestPurchaseIosProps;\n\ntype SubscriptionStatus =\n | 'expired'\n | 'inBillingRetryPeriod'\n | 'inGracePeriod'\n | 'revoked'\n | 'subscribed';\n\ntype RenewalInfo = {\n jsonRepresentation?: string;\n willAutoRenew: boolean;\n autoRenewPreference?: string;\n};\n\nexport type ProductStatusIos = {\n state: SubscriptionStatus;\n renewalInfo?: RenewalInfo;\n};\n\nexport type ProductPurchaseIos = PurchaseBase & {\n // iOS basic fields\n quantityIos?: number;\n originalTransactionDateIos?: number;\n originalTransactionIdentifierIos?: string;\n appAccountToken?: string;\n // iOS additional fields from StoreKit 2\n expirationDateIos?: number;\n webOrderLineItemIdIos?: number;\n environmentIos?: string;\n storefrontCountryCodeIos?: string;\n appBundleIdIos?: string;\n productTypeIos?: string;\n subscriptionGroupIdIos?: string;\n isUpgradedIos?: boolean;\n ownershipTypeIos?: string;\n reasonIos?: string;\n reasonStringRepresentationIos?: string;\n transactionReasonIos?: 'PURCHASE' | 'RENEWAL' | string;\n revocationDateIos?: number;\n revocationReasonIos?: string;\n offerIos?: {\n id: string;\n type: string;\n paymentMode: string;\n };\n priceIos?: number;\n currencyIos?: string;\n /**\n * @deprecated Use `purchaseToken` instead. This field will be removed in a future version.\n * iOS 15+ JWS representation is now available through the `purchaseToken` field.\n */\n jwsRepresentationIos?: string;\n};\n\nexport type AppTransactionIOS = {\n appTransactionID?: string; // Only available in iOS 18.4+\n originalPlatform?: string; // Only available in iOS 18.4+\n bundleID: string;\n appVersion: string;\n originalAppVersion: string;\n originalPurchaseDate: number;\n deviceVerification: string;\n deviceVerificationNonce: string;\n environment: string;\n signedDate: number;\n appID?: number;\n appVersionID?: number;\n preorderDate?: number;\n};\n"]}
|
package/ios/ExpoIapModule.swift
CHANGED
|
@@ -80,6 +80,7 @@ func serializeTransaction(_ transaction: Transaction, jwsRepresentationIos: Stri
|
|
|
80
80
|
if (jwsRepresentationIos != nil) {
|
|
81
81
|
logDebug("serializeTransaction adding jwsRepresentationIos with length: \(jwsRepresentationIos!.count)")
|
|
82
82
|
purchaseMap["jwsRepresentationIos"] = jwsRepresentationIos
|
|
83
|
+
purchaseMap["purchaseToken"] = jwsRepresentationIos
|
|
83
84
|
} else {
|
|
84
85
|
logDebug("serializeTransaction jwsRepresentationIos is nil")
|
|
85
86
|
}
|
|
@@ -241,7 +242,7 @@ public class ExpoIapModule: Module {
|
|
|
241
242
|
"ERROR_CODES": IapErrorCode.toDictionary()
|
|
242
243
|
])
|
|
243
244
|
|
|
244
|
-
Events(IapEvent.PurchaseUpdated, IapEvent.PurchaseError)
|
|
245
|
+
Events(IapEvent.PurchaseUpdated, IapEvent.PurchaseError, IapEvent.PromotedProductIOS)
|
|
245
246
|
|
|
246
247
|
OnStartObserving {
|
|
247
248
|
self.hasListeners = true
|
|
@@ -494,6 +495,14 @@ public class ExpoIapModule: Module {
|
|
|
494
495
|
options.insert(.appAccountToken(appAccountUUID))
|
|
495
496
|
}
|
|
496
497
|
guard let windowScene = await self.currentWindowScene() else {
|
|
498
|
+
let errorData = [
|
|
499
|
+
"responseCode": IapErrorCode.serviceError,
|
|
500
|
+
"debugMessage": "Could not find window scene",
|
|
501
|
+
"code": IapErrorCode.serviceError,
|
|
502
|
+
"message": "Could not find window scene",
|
|
503
|
+
"productId": sku,
|
|
504
|
+
]
|
|
505
|
+
self.sendEvent(IapEvent.PurchaseError, errorData)
|
|
497
506
|
throw Exception(name: "ExpoIapModule", description: "Could not find window scene", code: IapErrorCode.serviceError)
|
|
498
507
|
}
|
|
499
508
|
let result: Product.PurchaseResult
|
|
@@ -537,19 +546,105 @@ public class ExpoIapModule: Module {
|
|
|
537
546
|
return serialized
|
|
538
547
|
}
|
|
539
548
|
case .userCancelled:
|
|
549
|
+
let errorData = [
|
|
550
|
+
"responseCode": IapErrorCode.userCancelled,
|
|
551
|
+
"debugMessage": "User cancelled the purchase",
|
|
552
|
+
"code": IapErrorCode.userCancelled,
|
|
553
|
+
"message": "User cancelled the purchase",
|
|
554
|
+
"productId": sku,
|
|
555
|
+
]
|
|
556
|
+
self.sendEvent(IapEvent.PurchaseError, errorData)
|
|
540
557
|
throw Exception(name: "ExpoIapModule", description: "User cancelled the purchase", code: IapErrorCode.userCancelled)
|
|
541
558
|
case .pending:
|
|
559
|
+
let errorData = [
|
|
560
|
+
"responseCode": IapErrorCode.deferredPayment,
|
|
561
|
+
"debugMessage": "The payment was deferred",
|
|
562
|
+
"code": IapErrorCode.deferredPayment,
|
|
563
|
+
"message": "The payment was deferred",
|
|
564
|
+
"productId": sku,
|
|
565
|
+
]
|
|
566
|
+
self.sendEvent(IapEvent.PurchaseError, errorData)
|
|
542
567
|
throw Exception(name: "ExpoIapModule", description: "The payment was deferred", code: IapErrorCode.deferredPayment)
|
|
543
568
|
@unknown default:
|
|
569
|
+
let errorData = [
|
|
570
|
+
"responseCode": IapErrorCode.unknown,
|
|
571
|
+
"debugMessage": "Unknown purchase result",
|
|
572
|
+
"code": IapErrorCode.unknown,
|
|
573
|
+
"message": "Unknown purchase result",
|
|
574
|
+
"productId": sku,
|
|
575
|
+
]
|
|
576
|
+
self.sendEvent(IapEvent.PurchaseError, errorData)
|
|
544
577
|
throw Exception(name: "ExpoIapModule", description: "Unknown purchase result", code: IapErrorCode.unknown)
|
|
545
578
|
}
|
|
546
579
|
} catch {
|
|
547
580
|
if error is Exception {
|
|
548
581
|
throw error
|
|
549
582
|
}
|
|
550
|
-
|
|
583
|
+
|
|
584
|
+
// Map StoreKit errors to proper error codes
|
|
585
|
+
var errorCode = IapErrorCode.purchaseError
|
|
586
|
+
var errorMessage = error.localizedDescription
|
|
587
|
+
|
|
588
|
+
// Check for specific StoreKit error types
|
|
589
|
+
if let nsError = error as NSError? {
|
|
590
|
+
switch nsError.domain {
|
|
591
|
+
case "SKErrorDomain":
|
|
592
|
+
// Handle SKError codes
|
|
593
|
+
switch nsError.code {
|
|
594
|
+
case 0: // SKError.unknown
|
|
595
|
+
errorCode = IapErrorCode.unknown
|
|
596
|
+
case 1: // SKError.clientInvalid
|
|
597
|
+
errorCode = IapErrorCode.serviceError
|
|
598
|
+
case 2: // SKError.paymentCancelled
|
|
599
|
+
errorCode = IapErrorCode.userCancelled
|
|
600
|
+
errorMessage = "User cancelled the purchase"
|
|
601
|
+
case 3: // SKError.paymentInvalid
|
|
602
|
+
errorCode = IapErrorCode.userError
|
|
603
|
+
case 4: // SKError.paymentNotAllowed
|
|
604
|
+
errorCode = IapErrorCode.userError
|
|
605
|
+
errorMessage = "Payment not allowed"
|
|
606
|
+
case 5: // SKError.storeProductNotAvailable
|
|
607
|
+
errorCode = IapErrorCode.itemUnavailable
|
|
608
|
+
case 6: // SKError.cloudServicePermissionDenied
|
|
609
|
+
errorCode = IapErrorCode.serviceError
|
|
610
|
+
case 7: // SKError.cloudServiceNetworkConnectionFailed
|
|
611
|
+
errorCode = IapErrorCode.networkError
|
|
612
|
+
case 8: // SKError.cloudServiceRevoked
|
|
613
|
+
errorCode = IapErrorCode.serviceError
|
|
614
|
+
default:
|
|
615
|
+
errorCode = IapErrorCode.purchaseError
|
|
616
|
+
}
|
|
617
|
+
case "NSURLErrorDomain":
|
|
618
|
+
errorCode = IapErrorCode.networkError
|
|
619
|
+
errorMessage = "Network error: \(error.localizedDescription)"
|
|
620
|
+
default:
|
|
621
|
+
errorCode = IapErrorCode.purchaseError
|
|
622
|
+
}
|
|
623
|
+
} else if error.localizedDescription.lowercased().contains("network") {
|
|
624
|
+
errorCode = IapErrorCode.networkError
|
|
625
|
+
} else if error.localizedDescription.lowercased().contains("cancelled") {
|
|
626
|
+
errorCode = IapErrorCode.userCancelled
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
let errorData = [
|
|
630
|
+
"responseCode": errorCode,
|
|
631
|
+
"debugMessage": "Purchase failed: \(error.localizedDescription)",
|
|
632
|
+
"code": errorCode,
|
|
633
|
+
"message": errorMessage,
|
|
634
|
+
"productId": sku,
|
|
635
|
+
]
|
|
636
|
+
self.sendEvent(IapEvent.PurchaseError, errorData)
|
|
637
|
+
throw Exception(name: "ExpoIapModule", description: errorMessage, code: errorCode)
|
|
551
638
|
}
|
|
552
639
|
} else {
|
|
640
|
+
let errorData = [
|
|
641
|
+
"responseCode": IapErrorCode.itemUnavailable,
|
|
642
|
+
"debugMessage": "Invalid product ID",
|
|
643
|
+
"code": IapErrorCode.itemUnavailable,
|
|
644
|
+
"message": "Invalid product ID",
|
|
645
|
+
"productId": sku,
|
|
646
|
+
]
|
|
647
|
+
self.sendEvent(IapEvent.PurchaseError, errorData)
|
|
553
648
|
throw Exception(name: "ExpoIapModule", description: "Invalid product ID", code: IapErrorCode.itemUnavailable)
|
|
554
649
|
}
|
|
555
650
|
}
|
package/package.json
CHANGED
package/src/ExpoIap.types.ts
CHANGED
|
@@ -33,6 +33,7 @@ export type PurchaseBase = {
|
|
|
33
33
|
transactionId?: string; // @deprecated - use id instead
|
|
34
34
|
transactionDate: number;
|
|
35
35
|
transactionReceipt: string;
|
|
36
|
+
purchaseToken?: string; // Unified purchase token (jwsRepresentation for iOS, purchaseToken for Android)
|
|
36
37
|
};
|
|
37
38
|
|
|
38
39
|
// Define literal platform types for better type discrimination
|
|
@@ -74,7 +75,11 @@ export type PurchaseResult = {
|
|
|
74
75
|
debugMessage?: string;
|
|
75
76
|
code?: string;
|
|
76
77
|
message?: string;
|
|
78
|
+
/**
|
|
79
|
+
* @deprecated Use `purchaseToken` instead. This field will be removed in a future version.
|
|
80
|
+
*/
|
|
77
81
|
purchaseTokenAndroid?: string;
|
|
82
|
+
purchaseToken?: string;
|
|
78
83
|
};
|
|
79
84
|
/**
|
|
80
85
|
* Centralized error codes for expo-iap
|
package/src/index.ts
CHANGED
|
@@ -491,13 +491,14 @@ export const requestPurchase = (
|
|
|
491
491
|
subscriptionOffers = [],
|
|
492
492
|
replacementModeAndroid = -1,
|
|
493
493
|
purchaseTokenAndroid,
|
|
494
|
+
purchaseToken,
|
|
494
495
|
} = normalizedRequest;
|
|
495
496
|
|
|
496
497
|
return (async () => {
|
|
497
498
|
return ExpoIapModule.buyItemByType({
|
|
498
499
|
type: 'subs',
|
|
499
500
|
skuArr: skus,
|
|
500
|
-
purchaseToken: purchaseTokenAndroid,
|
|
501
|
+
purchaseToken: purchaseTokenAndroid || purchaseToken,
|
|
501
502
|
replacementMode: replacementModeAndroid,
|
|
502
503
|
obfuscatedAccountId: obfuscatedAccountIdAndroid,
|
|
503
504
|
obfuscatedProfileId: obfuscatedProfileIdAndroid,
|
|
@@ -575,20 +576,11 @@ export const finishTransaction = ({
|
|
|
575
576
|
android: async () => {
|
|
576
577
|
const androidPurchase = purchase as ProductPurchaseAndroid;
|
|
577
578
|
|
|
578
|
-
if (!('purchaseTokenAndroid' in androidPurchase)) {
|
|
579
|
-
return Promise.reject(
|
|
580
|
-
new Error('purchaseToken is required to finish transaction'),
|
|
581
|
-
);
|
|
582
|
-
}
|
|
583
579
|
if (isConsumable) {
|
|
584
|
-
return ExpoIapModule.consumeProduct(
|
|
585
|
-
androidPurchase.purchaseTokenAndroid,
|
|
586
|
-
);
|
|
587
|
-
} else {
|
|
588
|
-
return ExpoIapModule.acknowledgePurchase(
|
|
589
|
-
androidPurchase.purchaseTokenAndroid,
|
|
590
|
-
);
|
|
580
|
+
return ExpoIapModule.consumeProduct(androidPurchase.purchaseToken);
|
|
591
581
|
}
|
|
582
|
+
|
|
583
|
+
return ExpoIapModule.acknowledgePurchase(androidPurchase.purchaseToken);
|
|
592
584
|
},
|
|
593
585
|
}) || (() => Promise.reject(new Error('Unsupported Platform')))
|
|
594
586
|
)();
|
|
@@ -68,6 +68,9 @@ type SubscriptionOffer = {
|
|
|
68
68
|
};
|
|
69
69
|
|
|
70
70
|
export type RequestSubscriptionAndroidProps = RequestPurchaseAndroidProps & {
|
|
71
|
+
/**
|
|
72
|
+
* @deprecated Use `purchaseToken` instead. This field will be removed in a future version.
|
|
73
|
+
*/
|
|
71
74
|
purchaseTokenAndroid?: string;
|
|
72
75
|
replacementModeAndroid?: ReplacementModesAndroid;
|
|
73
76
|
subscriptionOffers: SubscriptionOffer[];
|
|
@@ -115,6 +118,9 @@ export enum PurchaseStateAndroid {
|
|
|
115
118
|
|
|
116
119
|
export type ProductPurchaseAndroid = PurchaseBase & {
|
|
117
120
|
ids?: string[];
|
|
121
|
+
/**
|
|
122
|
+
* @deprecated Use `purchaseToken` instead. This field will be removed in a future version.
|
|
123
|
+
*/
|
|
118
124
|
purchaseTokenAndroid?: string;
|
|
119
125
|
dataAndroid?: string;
|
|
120
126
|
signatureAndroid?: string;
|
|
@@ -138,6 +138,10 @@ export type ProductPurchaseIos = PurchaseBase & {
|
|
|
138
138
|
};
|
|
139
139
|
priceIos?: number;
|
|
140
140
|
currencyIos?: string;
|
|
141
|
+
/**
|
|
142
|
+
* @deprecated Use `purchaseToken` instead. This field will be removed in a future version.
|
|
143
|
+
* iOS 15+ JWS representation is now available through the `purchaseToken` field.
|
|
144
|
+
*/
|
|
141
145
|
jwsRepresentationIos?: string;
|
|
142
146
|
};
|
|
143
147
|
|