react-native-iap 12.4.4 → 12.4.5

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.
@@ -41,7 +41,7 @@ extension Date {
41
41
  }
42
42
 
43
43
  var millisecondsSince1970String: String {
44
- return String((self.timeIntervalSince1970 * 1000.0).rounded())
44
+ return String(self.millisecondsSince1970)
45
45
  }
46
46
 
47
47
  init(milliseconds: Int64) {
@@ -796,7 +796,7 @@ class RNIapIos: RCTEventEmitter, SKRequestDelegate, SKPaymentTransactionObserver
796
796
  block(nil)
797
797
  } else {
798
798
  var purchase = [
799
- "transactionDate": transaction.transactionDate?.millisecondsSince1970String,
799
+ "transactionDate": transaction.transactionDate?.millisecondsSince1970,
800
800
  "transactionId": transaction.transactionIdentifier,
801
801
  "productId": transaction.payment.productIdentifier,
802
802
  "transactionReceipt": receiptData?.base64EncodedString(options: [.endLineWithCarriageReturn])
@@ -804,7 +804,7 @@ class RNIapIos: RCTEventEmitter, SKRequestDelegate, SKPaymentTransactionObserver
804
804
 
805
805
  // originalTransaction is available for restore purchase and purchase of cancelled/expired subscriptions
806
806
  if let originalTransaction = transaction.original {
807
- purchase["originalTransactionDateIOS"] = originalTransaction.transactionDate?.millisecondsSince1970String
807
+ purchase["originalTransactionDateIOS"] = originalTransaction.transactionDate?.millisecondsSince1970
808
808
  purchase["originalTransactionIdentifierIOS"] = originalTransaction.transactionIdentifier
809
809
  }
810
810
 
@@ -78,7 +78,7 @@ const transactionSk2Map = _ref3 => {
78
78
  purchaseToken: '',
79
79
  //Not avaiable
80
80
  quantityIOS: purchasedQuantity,
81
- originalTransactionDateIOS: String(originalPurchaseDate),
81
+ originalTransactionDateIOS: originalPurchaseDate,
82
82
  originalTransactionIdentifierIOS: originalID
83
83
  };
84
84
  return purchase;
@@ -1 +1 @@
1
- {"version":3,"names":["productSk2Map","id","description","displayName","price","displayPrice","prod","title","productId","String","type","localizedPrice","currency","subscriptionSk2Map","subscription","platform","SubscriptionPlatform","ios","subscriptionPeriodNumberIOS","subscriptionPeriod","value","subscriptionPeriodUnitIOS","unit","toUpperCase","transactionSk2Map","originalPurchaseDate","productID","purchaseDate","purchasedQuantity","originalID","purchase","transactionId","transactionDate","transactionReceipt","purchaseToken","quantityIOS","originalTransactionDateIOS","originalTransactionIdentifierIOS","offerSk2Map","offer","undefined","offerID","identifier","keyID","keyIdentifier","nonce","signature","timestamp","toString"],"sources":["appleSk2.ts"],"sourcesContent":["import type {PurchaseError} from '../purchaseError';\n\nimport type {\n ProductIOS,\n Purchase,\n SubscriptionIOS,\n SubscriptionIosPeriod,\n} from '.';\nimport type * as Apple from './apple';\nimport {SubscriptionPlatform} from '.';\n\nexport type SubscriptionPeriod = {\n unit: 'day' | 'week' | 'month' | 'year';\n value: number;\n};\n\nexport type PaymentMode = 'freeTrial' | 'payAsYouGo' | 'payUpFront';\n\nexport type SubscriptionOffer = {\n displayPrice: string;\n id: string;\n paymentMode: PaymentMode;\n period: SubscriptionPeriod;\n periodCount: number;\n price: number;\n type: 'introductory' | 'promotional';\n};\n\nexport type SubscriptionInfo = {\n introductoryOffer?: SubscriptionOffer;\n promotionalOffers?: SubscriptionOffer[];\n subscriptionGroupID: string;\n subscriptionPeriod: SubscriptionPeriod;\n};\n\nexport type RefundRequestStatus = 'success' | 'userCancelled';\n\nexport type ProductSk2 = {\n description: string;\n displayName: string;\n displayPrice: string;\n id: number;\n isFamilyShareable: boolean;\n jsonRepresentation: string;\n price: number;\n subscription: SubscriptionInfo;\n type: 'autoRenewable' | 'consumable' | 'nonConsumable' | 'nonRenewable';\n};\nexport const productSk2Map = ({\n id,\n description,\n displayName,\n price,\n displayPrice,\n}: ProductSk2): ProductIOS => {\n const prod: ProductIOS = {\n title: displayName,\n productId: String(id),\n description,\n type: 'iap',\n price: String(price),\n localizedPrice: displayPrice,\n currency: '', // Not avaiable on new API, use localizedPrice instead\n };\n return prod;\n};\n\nexport const subscriptionSk2Map = ({\n id,\n description,\n displayName,\n price,\n displayPrice,\n subscription,\n}: ProductSk2): SubscriptionIOS => {\n const prod: SubscriptionIOS = {\n platform: SubscriptionPlatform.ios,\n title: displayName,\n productId: String(id),\n description,\n type: 'subs',\n price: String(price),\n localizedPrice: displayPrice,\n currency: '', // Not avaiable on new API, use localizedPrice instead\n subscriptionPeriodNumberIOS: `${subscription?.subscriptionPeriod?.value}`,\n subscriptionPeriodUnitIOS:\n subscription?.subscriptionPeriod?.unit.toUpperCase() as SubscriptionIosPeriod,\n };\n return prod;\n};\n\nexport type TransactionSk2 = {\n appAccountToken: string;\n appBundleID: string;\n debugDescription: string;\n deviceVerification: string;\n deviceVerificationNonce: string;\n expirationDate: number;\n id: number;\n isUpgraded: boolean;\n jsonRepresentation: string;\n offerID: string;\n offerType: string;\n originalID: string;\n originalPurchaseDate: number;\n ownershipType: string;\n productID: string;\n productType: string;\n purchaseDate: number;\n purchasedQuantity: number;\n revocationDate: number;\n revocationReason: string;\n signedDate: number;\n subscriptionGroupID: number;\n webOrderLineItemID: number;\n};\n\nexport type TransactionError = PurchaseError;\n\n/**\n * Only one of `transaction` and `error` is not undefined at the time\n */\nexport type TransactionEvent = {\n transaction?: TransactionSk2;\n error?: TransactionError;\n};\n\nexport type SubscriptionStatus =\n | 'expired'\n | 'inBillingRetryPeriod'\n | 'inGracePeriod'\n | 'revoked'\n | 'subscribed';\n\nexport type ProductStatus = {\n state: SubscriptionStatus;\n};\n\nexport const transactionSk2Map = ({\n id,\n originalPurchaseDate,\n productID,\n purchaseDate,\n purchasedQuantity,\n originalID,\n}: TransactionSk2): Purchase => {\n const purchase: Purchase = {\n productId: productID,\n transactionId: String(id),\n transactionDate: purchaseDate, //??\n transactionReceipt: '', // Not available\n purchaseToken: '', //Not avaiable\n quantityIOS: purchasedQuantity,\n originalTransactionDateIOS: String(originalPurchaseDate),\n originalTransactionIdentifierIOS: originalID,\n };\n return purchase;\n};\n\n/**\n * Payment discount interface @see https://developer.apple.com/documentation/storekit/skpaymentdiscount?language=objc\n */\nexport interface PaymentDiscountSk2 {\n /**\n * A string used to uniquely identify a discount offer for a product.\n */\n offerID: string;\n\n /**\n * A string that identifies the key used to generate the signature.\n */\n keyID: string;\n\n /**\n * A universally unique ID (UUID) value that you define.\n */\n nonce: string;\n\n /**\n * A UTF-8 string representing the properties of a specific discount offer, cryptographically signed.\n */\n signature: string;\n\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 const offerSk2Map = (\n offer: Apple.PaymentDiscount | undefined,\n): Record<keyof PaymentDiscountSk2, string> | undefined => {\n if (!offer) {\n return undefined;\n }\n return {\n offerID: offer.identifier,\n keyID: offer.keyIdentifier,\n nonce: offer.nonce,\n signature: offer.signature,\n timestamp: offer.timestamp.toString(),\n };\n};\n"],"mappings":";;;;;;;AASA;;AAuCO,MAAMA,aAAa,GAAG,QAMC;EAAA,IANA;IAC5BC,EAD4B;IAE5BC,WAF4B;IAG5BC,WAH4B;IAI5BC,KAJ4B;IAK5BC;EAL4B,CAMA;EAC5B,MAAMC,IAAgB,GAAG;IACvBC,KAAK,EAAEJ,WADgB;IAEvBK,SAAS,EAAEC,MAAM,CAACR,EAAD,CAFM;IAGvBC,WAHuB;IAIvBQ,IAAI,EAAE,KAJiB;IAKvBN,KAAK,EAAEK,MAAM,CAACL,KAAD,CALU;IAMvBO,cAAc,EAAEN,YANO;IAOvBO,QAAQ,EAAE,EAPa,CAOT;;EAPS,CAAzB;EASA,OAAON,IAAP;AACD,CAjBM;;;;AAmBA,MAAMO,kBAAkB,GAAG,SAOC;EAAA;;EAAA,IAPA;IACjCZ,EADiC;IAEjCC,WAFiC;IAGjCC,WAHiC;IAIjCC,KAJiC;IAKjCC,YALiC;IAMjCS;EANiC,CAOA;EACjC,MAAMR,IAAqB,GAAG;IAC5BS,QAAQ,EAAEC,sBAAA,CAAqBC,GADH;IAE5BV,KAAK,EAAEJ,WAFqB;IAG5BK,SAAS,EAAEC,MAAM,CAACR,EAAD,CAHW;IAI5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AgBC,QAAhB;EALN,CAAP;AAOD,CAbM"}
1
+ {"version":3,"names":["productSk2Map","id","description","displayName","price","displayPrice","prod","title","productId","String","type","localizedPrice","currency","subscriptionSk2Map","subscription","platform","SubscriptionPlatform","ios","subscriptionPeriodNumberIOS","subscriptionPeriod","value","subscriptionPeriodUnitIOS","unit","toUpperCase","transactionSk2Map","originalPurchaseDate","productID","purchaseDate","purchasedQuantity","originalID","purchase","transactionId","transactionDate","transactionReceipt","purchaseToken","quantityIOS","originalTransactionDateIOS","originalTransactionIdentifierIOS","offerSk2Map","offer","undefined","offerID","identifier","keyID","keyIdentifier","nonce","signature","timestamp","toString"],"sources":["appleSk2.ts"],"sourcesContent":["import type {PurchaseError} from '../purchaseError';\n\nimport type {\n ProductIOS,\n Purchase,\n SubscriptionIOS,\n SubscriptionIosPeriod,\n} from '.';\nimport type * as Apple from './apple';\nimport {SubscriptionPlatform} from '.';\n\nexport type SubscriptionPeriod = {\n unit: 'day' | 'week' | 'month' | 'year';\n value: number;\n};\n\nexport type PaymentMode = 'freeTrial' | 'payAsYouGo' | 'payUpFront';\n\nexport type SubscriptionOffer = {\n displayPrice: string;\n id: string;\n paymentMode: PaymentMode;\n period: SubscriptionPeriod;\n periodCount: number;\n price: number;\n type: 'introductory' | 'promotional';\n};\n\nexport type SubscriptionInfo = {\n introductoryOffer?: SubscriptionOffer;\n promotionalOffers?: SubscriptionOffer[];\n subscriptionGroupID: string;\n subscriptionPeriod: SubscriptionPeriod;\n};\n\nexport type RefundRequestStatus = 'success' | 'userCancelled';\n\nexport type ProductSk2 = {\n description: string;\n displayName: string;\n displayPrice: string;\n id: number;\n isFamilyShareable: boolean;\n jsonRepresentation: string;\n price: number;\n subscription: SubscriptionInfo;\n type: 'autoRenewable' | 'consumable' | 'nonConsumable' | 'nonRenewable';\n};\nexport const productSk2Map = ({\n id,\n description,\n displayName,\n price,\n displayPrice,\n}: ProductSk2): ProductIOS => {\n const prod: ProductIOS = {\n title: displayName,\n productId: String(id),\n description,\n type: 'iap',\n price: String(price),\n localizedPrice: displayPrice,\n currency: '', // Not avaiable on new API, use localizedPrice instead\n };\n return prod;\n};\n\nexport const subscriptionSk2Map = ({\n id,\n description,\n displayName,\n price,\n displayPrice,\n subscription,\n}: ProductSk2): SubscriptionIOS => {\n const prod: SubscriptionIOS = {\n platform: SubscriptionPlatform.ios,\n title: displayName,\n productId: String(id),\n description,\n type: 'subs',\n price: String(price),\n localizedPrice: displayPrice,\n currency: '', // Not avaiable on new API, use localizedPrice instead\n subscriptionPeriodNumberIOS: `${subscription?.subscriptionPeriod?.value}`,\n subscriptionPeriodUnitIOS:\n subscription?.subscriptionPeriod?.unit.toUpperCase() as SubscriptionIosPeriod,\n };\n return prod;\n};\n\nexport type TransactionSk2 = {\n appAccountToken: string;\n appBundleID: string;\n debugDescription: string;\n deviceVerification: string;\n deviceVerificationNonce: string;\n expirationDate: number;\n id: number;\n isUpgraded: boolean;\n jsonRepresentation: string;\n offerID: string;\n offerType: string;\n originalID: string;\n originalPurchaseDate: number;\n ownershipType: string;\n productID: string;\n productType: string;\n purchaseDate: number;\n purchasedQuantity: number;\n revocationDate: number;\n revocationReason: string;\n signedDate: number;\n subscriptionGroupID: number;\n webOrderLineItemID: number;\n};\n\nexport type TransactionError = PurchaseError;\n\n/**\n * Only one of `transaction` and `error` is not undefined at the time\n */\nexport type TransactionEvent = {\n transaction?: TransactionSk2;\n error?: TransactionError;\n};\n\nexport type SubscriptionStatus =\n | 'expired'\n | 'inBillingRetryPeriod'\n | 'inGracePeriod'\n | 'revoked'\n | 'subscribed';\n\nexport type ProductStatus = {\n state: SubscriptionStatus;\n};\n\nexport const transactionSk2Map = ({\n id,\n originalPurchaseDate,\n productID,\n purchaseDate,\n purchasedQuantity,\n originalID,\n}: TransactionSk2): Purchase => {\n const purchase: Purchase = {\n productId: productID,\n transactionId: String(id),\n transactionDate: purchaseDate, //??\n transactionReceipt: '', // Not available\n purchaseToken: '', //Not avaiable\n quantityIOS: purchasedQuantity,\n originalTransactionDateIOS: originalPurchaseDate,\n originalTransactionIdentifierIOS: originalID,\n };\n return purchase;\n};\n\n/**\n * Payment discount interface @see https://developer.apple.com/documentation/storekit/skpaymentdiscount?language=objc\n */\nexport interface PaymentDiscountSk2 {\n /**\n * A string used to uniquely identify a discount offer for a product.\n */\n offerID: string;\n\n /**\n * A string that identifies the key used to generate the signature.\n */\n keyID: string;\n\n /**\n * A universally unique ID (UUID) value that you define.\n */\n nonce: string;\n\n /**\n * A UTF-8 string representing the properties of a specific discount offer, cryptographically signed.\n */\n signature: string;\n\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 const offerSk2Map = (\n offer: Apple.PaymentDiscount | undefined,\n): Record<keyof PaymentDiscountSk2, string> | undefined => {\n if (!offer) {\n return undefined;\n }\n return {\n offerID: offer.identifier,\n keyID: offer.keyIdentifier,\n nonce: offer.nonce,\n signature: offer.signature,\n timestamp: offer.timestamp.toString(),\n };\n};\n"],"mappings":";;;;;;;AASA;;AAuCO,MAAMA,aAAa,GAAG,QAMC;EAAA,IANA;IAC5BC,EAD4B;IAE5BC,WAF4B;IAG5BC,WAH4B;IAI5BC,KAJ4B;IAK5BC;EAL4B,CAMA;EAC5B,MAAMC,IAAgB,GAAG;IACvBC,KAAK,EAAEJ,WADgB;IAEvBK,SAAS,EAAEC,MAAM,CAACR,EAAD,CAFM;IAGvBC,WAHuB;IAIvBQ,IAAI,EAAE,KAJiB;IAKvBN,KAAK,EAAEK,MAAM,CAACL,KAAD,CALU;IAMvBO,cAAc,EAAEN,YANO;IAOvBO,QAAQ,EAAE,EAPa,CAOT;;EAPS,CAAzB;EASA,OAAON,IAAP;AACD,CAjBM;;;;AAmBA,MAAMO,kBAAkB,GAAG,SAOC;EAAA;;EAAA,IAPA;IACjCZ,EADiC;IAEjCC,WAFiC;IAGjCC,WAHiC;IAIjCC,KAJiC;IAKjCC,YALiC;IAMjCS;EANiC,CAOA;EACjC,MAAMR,I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GLC,KAAK,EAAEN,KAAK,CAACM,KAHR;IAILC,SAAS,EAAEP,KAAK,CAACO,SAJZ;IAKLC,SAAS,EAAER,KAAK,CAACQ,SAAN,CAAgBC,QAAhB;EALN,CAAP;AAOD,CAbM"}
@@ -1 +1 @@
1
- {"version":3,"names":["ProrationModesAndroid","PurchaseStateAndroid","PROMOTED_PRODUCT","InstallSourceAndroid","ProductType","SubscriptionPlatform"],"sources":["index.ts"],"sourcesContent":["import type {\n AmazonModuleProps,\n AndroidModuleProps,\n IosModuleProps,\n} from '../modules';\nimport type {IosModulePropsSk2} from '../modules/iosSk2';\n\nimport type * as Apple from './apple';\n\nexport type Sku = string;\n\nexport enum ProrationModesAndroid {\n IMMEDIATE_WITH_TIME_PRORATION = 1,\n IMMEDIATE_AND_CHARGE_PRORATED_PRICE = 2,\n IMMEDIATE_WITHOUT_PRORATION = 3,\n DEFERRED = 4,\n IMMEDIATE_AND_CHARGE_FULL_PRICE = 5,\n UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY = 0,\n}\n\nexport enum PurchaseStateAndroid {\n UNSPECIFIED_STATE = 0,\n PURCHASED = 1,\n PENDING = 2,\n}\n\nexport const PROMOTED_PRODUCT = 'iap-promoted-product';\n\nexport enum InstallSourceAndroid {\n NOT_SET = 0,\n GOOGLE_PLAY = 1,\n AMAZON = 2,\n}\n\nexport enum ProductType {\n /** Subscription */\n subs = 'subs',\n\n /** Subscription */\n sub = 'sub',\n\n /** Consumable */\n inapp = 'inapp',\n\n /** Consumable */\n iap = 'iap',\n}\n\nexport interface ProductCommon {\n type: 'subs' | 'sub' | 'inapp' | 'iap';\n productId: string; //iOS\n productIds?: string[];\n title: string;\n description: string;\n price: string;\n currency: string;\n localizedPrice: string;\n countryCode?: string;\n}\n\nexport interface ProductPurchase {\n productId: string;\n transactionId?: string;\n transactionDate: number;\n transactionReceipt: string;\n purchaseToken?: string;\n //iOS\n quantityIOS?: number;\n originalTransactionDateIOS?: string;\n originalTransactionIdentifierIOS?: string;\n //Android\n productIds?: 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 //Amazon\n userIdAmazon?: string;\n userMarketplaceAmazon?: string;\n userJsonAmazon?: string;\n isCanceledAmazon?: boolean;\n}\n\nexport interface PurchaseResult {\n responseCode?: number;\n debugMessage?: string;\n code?: string;\n message?: string;\n purchaseToken?: string;\n}\n\nexport interface SubscriptionPurchase extends ProductPurchase {\n autoRenewingAndroid?: boolean;\n originalTransactionDateIOS?: string;\n originalTransactionIdentifierIOS?: string;\n}\n\nexport type Purchase = ProductPurchase | SubscriptionPurchase;\n\nexport interface Discount {\n identifier: string;\n type: string;\n numberOfPeriods: string;\n price: string;\n localizedPrice: string;\n paymentMode: '' | 'FREETRIAL' | 'PAYASYOUGO' | 'PAYUPFRONT';\n subscriptionPeriod: string;\n}\n\nexport interface ProductAndroid extends ProductCommon {\n type: 'inapp' | 'iap';\n oneTimePurchaseOfferDetails?: {\n priceCurrencyCode: string;\n formattedPrice: string;\n priceAmountMicros: string;\n };\n}\nexport interface ProductIOS extends ProductCommon {\n type: 'inapp' | 'iap';\n}\n\nexport type Product = ProductAndroid & ProductIOS;\n\n/**\n * Can be used to distinguish the different platforms' subscription information\n */\nexport enum SubscriptionPlatform {\n android = 'android',\n amazon = 'amazon',\n ios = 'ios',\n}\n\n/** Android Billing v5 type */\nexport interface SubscriptionAndroid {\n platform: SubscriptionPlatform.android;\n productType: 'subs';\n name: string;\n title: string;\n description: string;\n productId: string;\n subscriptionOfferDetails: SubscriptionOfferAndroid[];\n}\n\nexport interface SubscriptionOfferAndroid {\n offerToken: string;\n pricingPhases: {\n pricingPhaseList: PricingPhaseAndroid[];\n };\n offerTags: string[];\n}\n\nexport interface PricingPhaseAndroid {\n formattedPrice: string;\n priceCurrencyCode: string;\n /**\n * P1W, P1M, P1Y\n */\n billingPeriod: string;\n billingCycleCount: number;\n priceAmountMicros: string;\n recurrenceMode: number;\n}\n\n/**\n * TODO: As of 2022-10-10, this typing is not verified against the real\n * Amazon API. Please update this if you have a more accurate type.\n */\nexport interface SubscriptionAmazon extends ProductCommon {\n platform: SubscriptionPlatform.amazon;\n type: 'subs';\n\n productType?: string;\n name?: string;\n}\n\nexport type SubscriptionIosPeriod = 'DAY' | 'WEEK' | 'MONTH' | 'YEAR' | '';\nexport interface SubscriptionIOS extends ProductCommon {\n platform: SubscriptionPlatform.ios;\n type: 'subs';\n discounts?: Discount[];\n introductoryPrice?: string;\n introductoryPriceAsAmountIOS?: string;\n introductoryPricePaymentModeIOS?:\n | ''\n | 'FREETRIAL'\n | 'PAYASYOUGO'\n | 'PAYUPFRONT';\n introductoryPriceNumberOfPeriodsIOS?: string;\n introductoryPriceSubscriptionPeriodIOS?: SubscriptionIosPeriod;\n\n subscriptionPeriodNumberIOS?: string;\n subscriptionPeriodUnitIOS?: SubscriptionIosPeriod;\n}\n\nexport type Subscription =\n | SubscriptionAndroid\n | SubscriptionAmazon\n | SubscriptionIOS;\n\nexport interface RequestPurchaseBaseAndroid {\n obfuscatedAccountIdAndroid?: string;\n obfuscatedProfileIdAndroid?: string;\n isOfferPersonalized?: boolean; // For AndroidBilling V5 https://developer.android.com/google/play/billing/integrate#personalized-price\n}\n\nexport interface RequestPurchaseAndroid extends RequestPurchaseBaseAndroid {\n skus: Sku[];\n}\n\nexport interface RequestPurchaseIOS {\n sku: Sku;\n andDangerouslyFinishTransactionAutomaticallyIOS?: boolean;\n /**\n * UUID representing user account\n */\n appAccountToken?: string;\n quantity?: number;\n withOffer?: Apple.PaymentDiscount;\n}\n\n/** As of 2022-10-12, we only use the `sku` field for Amazon purchases */\nexport type RequestPurchaseAmazon = RequestPurchaseIOS;\n\nexport type RequestPurchase =\n | RequestPurchaseAndroid\n | RequestPurchaseAmazon\n | RequestPurchaseIOS;\n\n/**\n * In order to purchase a new subscription, every sku must have a selected offerToken\n * @see SubscriptionAndroid.subscriptionOfferDetails.offerToken\n */\nexport interface SubscriptionOffer {\n sku: Sku;\n offerToken: string;\n}\n\nexport interface RequestSubscriptionAndroid extends RequestPurchaseBaseAndroid {\n purchaseTokenAndroid?: string;\n prorationModeAndroid?: ProrationModesAndroid;\n subscriptionOffers: SubscriptionOffer[];\n}\n\nexport type RequestSubscriptionIOS = RequestPurchaseIOS;\n\n/** As of 2022-10-12, we only use the `sku` field for Amazon subscriptions */\nexport type RequestSubscriptionAmazon = RequestSubscriptionIOS;\n\nexport type RequestSubscription =\n | RequestSubscriptionAndroid\n | RequestSubscriptionAmazon\n | RequestSubscriptionIOS;\n\ndeclare module 'react-native' {\n interface NativeModulesStatic {\n RNIapIos: IosModuleProps;\n RNIapIosSk2: IosModulePropsSk2;\n RNIapModule: AndroidModuleProps;\n RNIapAmazonModule: AmazonModuleProps;\n }\n}\n"],"mappings":";;;;;;IAWYA,qB;;;WAAAA,qB;EAAAA,qB,CAAAA,qB;EAAAA,qB,CAAAA,qB;EAAAA,qB,CAAAA,qB;EAAAA,qB,CAAAA,qB;EAAAA,qB,CAAAA,qB;EAAAA,qB,CAAAA,qB;GAAAA,qB,qCAAAA,qB;;IASAC,oB;;;WAAAA,oB;EAAAA,oB,CAAAA,oB;EAAAA,oB,CAAAA,oB;EAAAA,oB,CAAAA,oB;GAAAA,oB,oCAAAA,oB;;AAML,MAAMC,gBAAgB,GAAG,sBAAzB;;IAEKC,oB;;;WAAAA,oB;EAAAA,oB,CAAAA,oB;EAAAA,oB,CAAAA,oB;EAAAA,oB,CAAAA,oB;GAAAA,oB,oCAAAA,oB;;IAMAC,W;;;WAAAA,W;EAAAA,W;EAAAA,W;EAAAA,W;EAAAA,W;GAAAA,W,2BAAAA,W;;AA8FZ;AACA;AACA;IACYC,oB;AAMZ;;;;WANYA,oB;EAAAA,oB;EAAAA,oB;EAAAA,oB;GAAAA,oB,oCAAAA,oB"}
1
+ {"version":3,"names":["ProrationModesAndroid","PurchaseStateAndroid","PROMOTED_PRODUCT","InstallSourceAndroid","ProductType","SubscriptionPlatform"],"sources":["index.ts"],"sourcesContent":["import type {\n AmazonModuleProps,\n AndroidModuleProps,\n IosModuleProps,\n} from '../modules';\nimport type {IosModulePropsSk2} from '../modules/iosSk2';\n\nimport type * as Apple from './apple';\n\nexport type Sku = string;\n\nexport enum ProrationModesAndroid {\n IMMEDIATE_WITH_TIME_PRORATION = 1,\n IMMEDIATE_AND_CHARGE_PRORATED_PRICE = 2,\n IMMEDIATE_WITHOUT_PRORATION = 3,\n DEFERRED = 4,\n IMMEDIATE_AND_CHARGE_FULL_PRICE = 5,\n UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY = 0,\n}\n\nexport enum PurchaseStateAndroid {\n UNSPECIFIED_STATE = 0,\n PURCHASED = 1,\n PENDING = 2,\n}\n\nexport const PROMOTED_PRODUCT = 'iap-promoted-product';\n\nexport enum InstallSourceAndroid {\n NOT_SET = 0,\n GOOGLE_PLAY = 1,\n AMAZON = 2,\n}\n\nexport enum ProductType {\n /** Subscription */\n subs = 'subs',\n\n /** Subscription */\n sub = 'sub',\n\n /** Consumable */\n inapp = 'inapp',\n\n /** Consumable */\n iap = 'iap',\n}\n\nexport interface ProductCommon {\n type: 'subs' | 'sub' | 'inapp' | 'iap';\n productId: string; //iOS\n productIds?: string[];\n title: string;\n description: string;\n price: string;\n currency: string;\n localizedPrice: string;\n countryCode?: string;\n}\n\nexport interface ProductPurchase {\n productId: string;\n transactionId?: string;\n transactionDate: number;\n transactionReceipt: string;\n purchaseToken?: string;\n //iOS\n quantityIOS?: number;\n originalTransactionDateIOS?: number;\n originalTransactionIdentifierIOS?: string;\n //Android\n productIds?: 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 //Amazon\n userIdAmazon?: string;\n userMarketplaceAmazon?: string;\n userJsonAmazon?: string;\n isCanceledAmazon?: boolean;\n}\n\nexport interface PurchaseResult {\n responseCode?: number;\n debugMessage?: string;\n code?: string;\n message?: string;\n purchaseToken?: string;\n}\n\nexport interface SubscriptionPurchase extends ProductPurchase {\n autoRenewingAndroid?: boolean;\n originalTransactionDateIOS?: number;\n originalTransactionIdentifierIOS?: string;\n}\n\nexport type Purchase = ProductPurchase | SubscriptionPurchase;\n\nexport interface Discount {\n identifier: string;\n type: string;\n numberOfPeriods: string;\n price: string;\n localizedPrice: string;\n paymentMode: '' | 'FREETRIAL' | 'PAYASYOUGO' | 'PAYUPFRONT';\n subscriptionPeriod: string;\n}\n\nexport interface ProductAndroid extends ProductCommon {\n type: 'inapp' | 'iap';\n oneTimePurchaseOfferDetails?: {\n priceCurrencyCode: string;\n formattedPrice: string;\n priceAmountMicros: string;\n };\n}\nexport interface ProductIOS extends ProductCommon {\n type: 'inapp' | 'iap';\n}\n\nexport type Product = ProductAndroid & ProductIOS;\n\n/**\n * Can be used to distinguish the different platforms' subscription information\n */\nexport enum SubscriptionPlatform {\n android = 'android',\n amazon = 'amazon',\n ios = 'ios',\n}\n\n/** Android Billing v5 type */\nexport interface SubscriptionAndroid {\n platform: SubscriptionPlatform.android;\n productType: 'subs';\n name: string;\n title: string;\n description: string;\n productId: string;\n subscriptionOfferDetails: SubscriptionOfferAndroid[];\n}\n\nexport interface SubscriptionOfferAndroid {\n offerToken: string;\n pricingPhases: {\n pricingPhaseList: PricingPhaseAndroid[];\n };\n offerTags: string[];\n}\n\nexport interface PricingPhaseAndroid {\n formattedPrice: string;\n priceCurrencyCode: string;\n /**\n * P1W, P1M, P1Y\n */\n billingPeriod: string;\n billingCycleCount: number;\n priceAmountMicros: string;\n recurrenceMode: number;\n}\n\n/**\n * TODO: As of 2022-10-10, this typing is not verified against the real\n * Amazon API. Please update this if you have a more accurate type.\n */\nexport interface SubscriptionAmazon extends ProductCommon {\n platform: SubscriptionPlatform.amazon;\n type: 'subs';\n\n productType?: string;\n name?: string;\n}\n\nexport type SubscriptionIosPeriod = 'DAY' | 'WEEK' | 'MONTH' | 'YEAR' | '';\nexport interface SubscriptionIOS extends ProductCommon {\n platform: SubscriptionPlatform.ios;\n type: 'subs';\n discounts?: Discount[];\n introductoryPrice?: string;\n introductoryPriceAsAmountIOS?: string;\n introductoryPricePaymentModeIOS?:\n | ''\n | 'FREETRIAL'\n | 'PAYASYOUGO'\n | 'PAYUPFRONT';\n introductoryPriceNumberOfPeriodsIOS?: string;\n introductoryPriceSubscriptionPeriodIOS?: SubscriptionIosPeriod;\n\n subscriptionPeriodNumberIOS?: string;\n subscriptionPeriodUnitIOS?: SubscriptionIosPeriod;\n}\n\nexport type Subscription =\n | SubscriptionAndroid\n | SubscriptionAmazon\n | SubscriptionIOS;\n\nexport interface RequestPurchaseBaseAndroid {\n obfuscatedAccountIdAndroid?: string;\n obfuscatedProfileIdAndroid?: string;\n isOfferPersonalized?: boolean; // For AndroidBilling V5 https://developer.android.com/google/play/billing/integrate#personalized-price\n}\n\nexport interface RequestPurchaseAndroid extends RequestPurchaseBaseAndroid {\n skus: Sku[];\n}\n\nexport interface RequestPurchaseIOS {\n sku: Sku;\n andDangerouslyFinishTransactionAutomaticallyIOS?: boolean;\n /**\n * UUID representing user account\n */\n appAccountToken?: string;\n quantity?: number;\n withOffer?: Apple.PaymentDiscount;\n}\n\n/** As of 2022-10-12, we only use the `sku` field for Amazon purchases */\nexport type RequestPurchaseAmazon = RequestPurchaseIOS;\n\nexport type RequestPurchase =\n | RequestPurchaseAndroid\n | RequestPurchaseAmazon\n | RequestPurchaseIOS;\n\n/**\n * In order to purchase a new subscription, every sku must have a selected offerToken\n * @see SubscriptionAndroid.subscriptionOfferDetails.offerToken\n */\nexport interface SubscriptionOffer {\n sku: Sku;\n offerToken: string;\n}\n\nexport interface RequestSubscriptionAndroid extends RequestPurchaseBaseAndroid {\n purchaseTokenAndroid?: string;\n prorationModeAndroid?: ProrationModesAndroid;\n subscriptionOffers: SubscriptionOffer[];\n}\n\nexport type RequestSubscriptionIOS = RequestPurchaseIOS;\n\n/** As of 2022-10-12, we only use the `sku` field for Amazon subscriptions */\nexport type RequestSubscriptionAmazon = RequestSubscriptionIOS;\n\nexport type RequestSubscription =\n | RequestSubscriptionAndroid\n | RequestSubscriptionAmazon\n | RequestSubscriptionIOS;\n\ndeclare module 'react-native' {\n interface NativeModulesStatic {\n RNIapIos: IosModuleProps;\n RNIapIosSk2: IosModulePropsSk2;\n RNIapModule: AndroidModuleProps;\n RNIapAmazonModule: AmazonModuleProps;\n }\n}\n"],"mappings":";;;;;;IAWYA,qB;;;WAAAA,qB;EAAAA,qB,CAAAA,qB;EAAAA,qB,CAAAA,qB;EAAAA,qB,CAAAA,qB;EAAAA,qB,CAAAA,qB;EAAAA,qB,CAAAA,qB;EAAAA,qB,CAAAA,qB;GAAAA,qB,qCAAAA,qB;;IASAC,oB;;;WAAAA,oB;EAAAA,oB,CAAAA,oB;EAAAA,oB,CAAAA,oB;EAAAA,oB,CAAAA,oB;GAAAA,oB,oCAAAA,oB;;AAML,MAAMC,gBAAgB,GAAG,sBAAzB;;IAEKC,oB;;;WAAAA,oB;EAAAA,oB,CAAAA,oB;EAAAA,oB,CAAAA,oB;EAAAA,oB,CAAAA,oB;GAAAA,oB,oCAAAA,oB;;IAMAC,W;;;WAAAA,W;EAAAA,W;EAAAA,W;EAAAA,W;EAAAA,W;GAAAA,W,2BAAAA,W;;AA8FZ;AACA;AACA;IACYC,oB;AAMZ;;;;WANYA,oB;EAAAA,oB;EAAAA,oB;EAAAA,oB;GAAAA,oB,oCAAAA,oB"}
@@ -64,7 +64,7 @@ export const transactionSk2Map = _ref3 => {
64
64
  purchaseToken: '',
65
65
  //Not avaiable
66
66
  quantityIOS: purchasedQuantity,
67
- originalTransactionDateIOS: String(originalPurchaseDate),
67
+ originalTransactionDateIOS: originalPurchaseDate,
68
68
  originalTransactionIdentifierIOS: originalID
69
69
  };
70
70
  return purchase;
@@ -1 +1 @@
1
- {"version":3,"names":["SubscriptionPlatform","productSk2Map","id","description","displayName","price","displayPrice","prod","title","productId","String","type","localizedPrice","currency","subscriptionSk2Map","subscription","platform","ios","subscriptionPeriodNumberIOS","subscriptionPeriod","value","subscriptionPeriodUnitIOS","unit","toUpperCase","transactionSk2Map","originalPurchaseDate","productID","purchaseDate","purchasedQuantity","originalID","purchase","transactionId","transactionDate","transactionReceipt","purchaseToken","quantityIOS","originalTransactionDateIOS","originalTransactionIdentifierIOS","offerSk2Map","offer","undefined","offerID","identifier","keyID","keyIdentifier","nonce","signature","timestamp","toString"],"sources":["appleSk2.ts"],"sourcesContent":["import type {PurchaseError} from '../purchaseError';\n\nimport type {\n ProductIOS,\n Purchase,\n SubscriptionIOS,\n SubscriptionIosPeriod,\n} from '.';\nimport type * as Apple from './apple';\nimport {SubscriptionPlatform} from '.';\n\nexport type SubscriptionPeriod = {\n unit: 'day' | 'week' | 'month' | 'year';\n value: number;\n};\n\nexport type PaymentMode = 'freeTrial' | 'payAsYouGo' | 'payUpFront';\n\nexport type SubscriptionOffer = {\n displayPrice: string;\n id: string;\n paymentMode: PaymentMode;\n period: SubscriptionPeriod;\n periodCount: number;\n price: number;\n type: 'introductory' | 'promotional';\n};\n\nexport type SubscriptionInfo = {\n introductoryOffer?: SubscriptionOffer;\n promotionalOffers?: SubscriptionOffer[];\n subscriptionGroupID: string;\n subscriptionPeriod: SubscriptionPeriod;\n};\n\nexport type RefundRequestStatus = 'success' | 'userCancelled';\n\nexport type ProductSk2 = {\n description: string;\n displayName: string;\n displayPrice: string;\n id: number;\n isFamilyShareable: boolean;\n jsonRepresentation: string;\n price: number;\n subscription: SubscriptionInfo;\n type: 'autoRenewable' | 'consumable' | 'nonConsumable' | 'nonRenewable';\n};\nexport const productSk2Map = ({\n id,\n description,\n displayName,\n price,\n displayPrice,\n}: ProductSk2): ProductIOS => {\n const prod: ProductIOS = {\n title: displayName,\n productId: String(id),\n description,\n type: 'iap',\n price: String(price),\n localizedPrice: displayPrice,\n currency: '', // Not avaiable on new API, use localizedPrice instead\n };\n return prod;\n};\n\nexport const subscriptionSk2Map = ({\n id,\n description,\n displayName,\n price,\n displayPrice,\n subscription,\n}: ProductSk2): SubscriptionIOS => {\n const prod: SubscriptionIOS = {\n platform: SubscriptionPlatform.ios,\n title: displayName,\n productId: String(id),\n description,\n type: 'subs',\n price: String(price),\n localizedPrice: displayPrice,\n currency: '', // Not avaiable on new API, use localizedPrice instead\n subscriptionPeriodNumberIOS: `${subscription?.subscriptionPeriod?.value}`,\n subscriptionPeriodUnitIOS:\n subscription?.subscriptionPeriod?.unit.toUpperCase() as SubscriptionIosPeriod,\n };\n return prod;\n};\n\nexport type TransactionSk2 = {\n appAccountToken: string;\n appBundleID: string;\n debugDescription: string;\n deviceVerification: string;\n deviceVerificationNonce: string;\n expirationDate: number;\n id: number;\n isUpgraded: boolean;\n jsonRepresentation: string;\n offerID: string;\n offerType: string;\n originalID: string;\n originalPurchaseDate: number;\n ownershipType: string;\n productID: string;\n productType: string;\n purchaseDate: number;\n purchasedQuantity: number;\n revocationDate: number;\n revocationReason: string;\n signedDate: number;\n subscriptionGroupID: number;\n webOrderLineItemID: number;\n};\n\nexport type TransactionError = PurchaseError;\n\n/**\n * Only one of `transaction` and `error` is not undefined at the time\n */\nexport type TransactionEvent = {\n transaction?: TransactionSk2;\n error?: TransactionError;\n};\n\nexport type SubscriptionStatus =\n | 'expired'\n | 'inBillingRetryPeriod'\n | 'inGracePeriod'\n | 'revoked'\n | 'subscribed';\n\nexport type ProductStatus = {\n state: SubscriptionStatus;\n};\n\nexport const transactionSk2Map = ({\n id,\n originalPurchaseDate,\n productID,\n purchaseDate,\n purchasedQuantity,\n originalID,\n}: TransactionSk2): Purchase => {\n const purchase: Purchase = {\n productId: productID,\n transactionId: String(id),\n transactionDate: purchaseDate, //??\n transactionReceipt: '', // Not available\n purchaseToken: '', //Not avaiable\n quantityIOS: purchasedQuantity,\n originalTransactionDateIOS: String(originalPurchaseDate),\n originalTransactionIdentifierIOS: originalID,\n };\n return purchase;\n};\n\n/**\n * Payment discount interface @see https://developer.apple.com/documentation/storekit/skpaymentdiscount?language=objc\n */\nexport interface PaymentDiscountSk2 {\n /**\n * A string used to uniquely identify a discount offer for a product.\n */\n offerID: string;\n\n /**\n * A string that identifies the key used to generate the signature.\n */\n keyID: string;\n\n /**\n * A universally unique ID (UUID) value that you define.\n */\n nonce: string;\n\n /**\n * A UTF-8 string representing the properties of a specific discount offer, cryptographically signed.\n */\n signature: string;\n\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 const offerSk2Map = (\n offer: Apple.PaymentDiscount | undefined,\n): Record<keyof PaymentDiscountSk2, string> | undefined => {\n if (!offer) {\n return undefined;\n }\n return {\n offerID: offer.identifier,\n keyID: offer.keyIdentifier,\n nonce: offer.nonce,\n signature: offer.signature,\n timestamp: offer.timestamp.toString(),\n };\n};\n"],"mappings":"AASA,SAAQA,oBAAR,QAAmC,GAAnC;AAuCA,OAAO,MAAMC,aAAa,GAAG,QAMC;EAAA,IANA;IAC5BC,EAD4B;IAE5BC,WAF4B;IAG5BC,WAH4B;IAI5BC,KAJ4B;IAK5BC;EAL4B,CAMA;EAC5B,MAAMC,IAAgB,GAAG;IACvBC,KAAK,EAAEJ,WADgB;IAEvBK,SAAS,EAAEC,MAAM,CAACR,EAAD,CAFM;IAGvBC,WAHuB;IAIvBQ,IAAI,EAAE,KAJiB;IAKvBN,KAAK,EAAEK,MAAM,CAACL,KAAD,CALU;IAMvBO,cAAc,EAAEN,YANO;IAOvBO,QAAQ,EAAE,EAPa,CAOT;;EAPS,CAAzB;EASA,OAAON,IAAP;AACD,CAjBM;AAmBP,OAAO,MAAMO,kBAAkB,GAAG,SAOC;EAAA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AEgC;EACzD,IAAI,CAACA,KAAL,EAAY;IACV,OAAOC,SAAP;EACD;;EACD,OAAO;IACLC,OAAO,EAAEF,KAAK,CAACG,UADV;IAELC,KAAK,EAAEJ,KAAK,CAACK,aAFR;IAGLC,KAAK,EAAEN,KAAK,CAACM,KAHR;IAILC,SAAS,EAAEP,KAAK,CAACO,SAJZ;IAKLC,SAAS,EAAER,KAAK,CAACQ,SAAN,CAAgBC,QAAhB;EALN,CAAP;AAOD,CAbM"}
1
+ {"version":3,"names":["SubscriptionPlatform","productSk2Map","id","description","displayName","price","displayPrice","prod","title","productId","String","type","localizedPrice","currency","subscriptionSk2Map","subscription","platform","ios","subscriptionPeriodNumberIOS","subscriptionPeriod","value","subscriptionPeriodUnitIOS","unit","toUpperCase","transactionSk2Map","originalPurchaseDate","productID","purchaseDate","purchasedQuantity","originalID","purchase","transactionId","transactionDate","transactionReceipt","purchaseToken","quantityIOS","originalTransactionDateIOS","originalTransactionIdentifierIOS","offerSk2Map","offer","undefined","offerID","identifier","keyID","keyIdentifier","nonce","signature","timestamp","toString"],"sources":["appleSk2.ts"],"sourcesContent":["import type {PurchaseError} from '../purchaseError';\n\nimport type {\n ProductIOS,\n Purchase,\n SubscriptionIOS,\n SubscriptionIosPeriod,\n} from '.';\nimport type * as Apple from './apple';\nimport {SubscriptionPlatform} from '.';\n\nexport type SubscriptionPeriod = {\n unit: 'day' | 'week' | 'month' | 'year';\n value: number;\n};\n\nexport type PaymentMode = 'freeTrial' | 'payAsYouGo' | 'payUpFront';\n\nexport type SubscriptionOffer = {\n displayPrice: string;\n id: string;\n paymentMode: PaymentMode;\n period: SubscriptionPeriod;\n periodCount: number;\n price: number;\n type: 'introductory' | 'promotional';\n};\n\nexport type SubscriptionInfo = {\n introductoryOffer?: SubscriptionOffer;\n promotionalOffers?: SubscriptionOffer[];\n subscriptionGroupID: string;\n subscriptionPeriod: SubscriptionPeriod;\n};\n\nexport type RefundRequestStatus = 'success' | 'userCancelled';\n\nexport type ProductSk2 = {\n description: string;\n displayName: string;\n displayPrice: string;\n id: number;\n isFamilyShareable: boolean;\n jsonRepresentation: string;\n price: number;\n subscription: SubscriptionInfo;\n type: 'autoRenewable' | 'consumable' | 'nonConsumable' | 'nonRenewable';\n};\nexport const productSk2Map = ({\n id,\n description,\n displayName,\n price,\n displayPrice,\n}: ProductSk2): ProductIOS => {\n const prod: ProductIOS = {\n title: displayName,\n productId: String(id),\n description,\n type: 'iap',\n price: String(price),\n localizedPrice: displayPrice,\n currency: '', // Not avaiable on new API, use localizedPrice instead\n };\n return prod;\n};\n\nexport const subscriptionSk2Map = ({\n id,\n description,\n displayName,\n price,\n displayPrice,\n subscription,\n}: ProductSk2): SubscriptionIOS => {\n const prod: SubscriptionIOS = {\n platform: SubscriptionPlatform.ios,\n title: displayName,\n productId: String(id),\n description,\n type: 'subs',\n price: String(price),\n localizedPrice: displayPrice,\n currency: '', // Not avaiable on new API, use localizedPrice instead\n subscriptionPeriodNumberIOS: `${subscription?.subscriptionPeriod?.value}`,\n subscriptionPeriodUnitIOS:\n subscription?.subscriptionPeriod?.unit.toUpperCase() as SubscriptionIosPeriod,\n };\n return prod;\n};\n\nexport type TransactionSk2 = {\n appAccountToken: string;\n appBundleID: string;\n debugDescription: string;\n deviceVerification: string;\n deviceVerificationNonce: string;\n expirationDate: number;\n id: number;\n isUpgraded: boolean;\n jsonRepresentation: string;\n offerID: string;\n offerType: string;\n originalID: string;\n originalPurchaseDate: number;\n ownershipType: string;\n productID: string;\n productType: string;\n purchaseDate: number;\n purchasedQuantity: number;\n revocationDate: number;\n revocationReason: string;\n signedDate: number;\n subscriptionGroupID: number;\n webOrderLineItemID: number;\n};\n\nexport type TransactionError = PurchaseError;\n\n/**\n * Only one of `transaction` and `error` is not undefined at the time\n */\nexport type TransactionEvent = {\n transaction?: TransactionSk2;\n error?: TransactionError;\n};\n\nexport type SubscriptionStatus =\n | 'expired'\n | 'inBillingRetryPeriod'\n | 'inGracePeriod'\n | 'revoked'\n | 'subscribed';\n\nexport type ProductStatus = {\n state: SubscriptionStatus;\n};\n\nexport const transactionSk2Map = ({\n id,\n originalPurchaseDate,\n productID,\n purchaseDate,\n purchasedQuantity,\n originalID,\n}: TransactionSk2): Purchase => {\n const purchase: Purchase = {\n productId: productID,\n transactionId: String(id),\n transactionDate: purchaseDate, //??\n transactionReceipt: '', // Not available\n purchaseToken: '', //Not avaiable\n quantityIOS: purchasedQuantity,\n originalTransactionDateIOS: originalPurchaseDate,\n originalTransactionIdentifierIOS: originalID,\n };\n return purchase;\n};\n\n/**\n * Payment discount interface @see https://developer.apple.com/documentation/storekit/skpaymentdiscount?language=objc\n */\nexport interface PaymentDiscountSk2 {\n /**\n * A string used to uniquely identify a discount offer for a product.\n */\n offerID: string;\n\n /**\n * A string that identifies the key used to generate the signature.\n */\n keyID: string;\n\n /**\n * A universally unique ID (UUID) value that you define.\n */\n nonce: string;\n\n /**\n * A UTF-8 string representing the properties of a specific discount offer, cryptographically signed.\n */\n signature: string;\n\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 const offerSk2Map = (\n offer: Apple.PaymentDiscount | undefined,\n): Record<keyof PaymentDiscountSk2, string> | undefined => {\n if (!offer) {\n return undefined;\n }\n return {\n offerID: offer.identifier,\n keyID: offer.keyIdentifier,\n nonce: offer.nonce,\n signature: offer.signature,\n timestamp: offer.timestamp.toString(),\n };\n};\n"],"mappings":"AASA,SAAQA,oBAAR,QAAmC,GAAnC;AAuCA,OAAO,MAAMC,aAAa,GAAG,QAMC;EAAA,IANA;IAC5BC,EAD4B;IAE5BC,WAF4B;IAG5BC,WAH4B;IAI5BC,KAJ4B;IAK5BC;EAL4B,CAMA;EAC5B,MAAMC,IAAgB,GAAG;IACvBC,KAAK,EAAEJ,WADgB;IAEvBK,SAAS,EAAEC,MAAM,CAACR,EAAD,CAFM;IAGvBC,WAHuB;IAIvBQ,IAAI,EAAE,KAJiB;IAKvBN,KAAK,EAAEK,MAAM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0BAA0B,EAAEX,oBAPH;IAQzBY,gCAAgC,EAAER;EART,CAA3B;EAUA,OAAOC,QAAP;AACD,CAnBM;AAqBP;AACA;AACA;;AA4BA,OAAO,MAAMQ,WAAW,GACtBC,KADyB,IAEgC;EACzD,IAAI,CAACA,KAAL,EAAY;IACV,OAAOC,SAAP;EACD;;EACD,OAAO;IACLC,OAAO,EAAEF,KAAK,CAACG,UADV;IAELC,KAAK,EAAEJ,KAAK,CAACK,aAFR;IAGLC,KAAK,EAAEN,KAAK,CAACM,KAHR;IAILC,SAAS,EAAEP,KAAK,CAACO,SAJZ;IAKLC,SAAS,EAAER,KAAK,CAACQ,SAAN,CAAgBC,QAAhB;EALN,CAAP;AAOD,CAbM"}
@@ -1 +1 @@
1
- {"version":3,"names":["ProrationModesAndroid","PurchaseStateAndroid","PROMOTED_PRODUCT","InstallSourceAndroid","ProductType","SubscriptionPlatform"],"sources":["index.ts"],"sourcesContent":["import type {\n AmazonModuleProps,\n AndroidModuleProps,\n IosModuleProps,\n} from '../modules';\nimport type {IosModulePropsSk2} from '../modules/iosSk2';\n\nimport type * as Apple from './apple';\n\nexport type Sku = string;\n\nexport enum ProrationModesAndroid {\n IMMEDIATE_WITH_TIME_PRORATION = 1,\n IMMEDIATE_AND_CHARGE_PRORATED_PRICE = 2,\n IMMEDIATE_WITHOUT_PRORATION = 3,\n DEFERRED = 4,\n IMMEDIATE_AND_CHARGE_FULL_PRICE = 5,\n UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY = 0,\n}\n\nexport enum PurchaseStateAndroid {\n UNSPECIFIED_STATE = 0,\n PURCHASED = 1,\n PENDING = 2,\n}\n\nexport const PROMOTED_PRODUCT = 'iap-promoted-product';\n\nexport enum InstallSourceAndroid {\n NOT_SET = 0,\n GOOGLE_PLAY = 1,\n AMAZON = 2,\n}\n\nexport enum ProductType {\n /** Subscription */\n subs = 'subs',\n\n /** Subscription */\n sub = 'sub',\n\n /** Consumable */\n inapp = 'inapp',\n\n /** Consumable */\n iap = 'iap',\n}\n\nexport interface ProductCommon {\n type: 'subs' | 'sub' | 'inapp' | 'iap';\n productId: string; //iOS\n productIds?: string[];\n title: string;\n description: string;\n price: string;\n currency: string;\n localizedPrice: string;\n countryCode?: string;\n}\n\nexport interface ProductPurchase {\n productId: string;\n transactionId?: string;\n transactionDate: number;\n transactionReceipt: string;\n purchaseToken?: string;\n //iOS\n quantityIOS?: number;\n originalTransactionDateIOS?: string;\n originalTransactionIdentifierIOS?: string;\n //Android\n productIds?: 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 //Amazon\n userIdAmazon?: string;\n userMarketplaceAmazon?: string;\n userJsonAmazon?: string;\n isCanceledAmazon?: boolean;\n}\n\nexport interface PurchaseResult {\n responseCode?: number;\n debugMessage?: string;\n code?: string;\n message?: string;\n purchaseToken?: string;\n}\n\nexport interface SubscriptionPurchase extends ProductPurchase {\n autoRenewingAndroid?: boolean;\n originalTransactionDateIOS?: string;\n originalTransactionIdentifierIOS?: string;\n}\n\nexport type Purchase = ProductPurchase | SubscriptionPurchase;\n\nexport interface Discount {\n identifier: string;\n type: string;\n numberOfPeriods: string;\n price: string;\n localizedPrice: string;\n paymentMode: '' | 'FREETRIAL' | 'PAYASYOUGO' | 'PAYUPFRONT';\n subscriptionPeriod: string;\n}\n\nexport interface ProductAndroid extends ProductCommon {\n type: 'inapp' | 'iap';\n oneTimePurchaseOfferDetails?: {\n priceCurrencyCode: string;\n formattedPrice: string;\n priceAmountMicros: string;\n };\n}\nexport interface ProductIOS extends ProductCommon {\n type: 'inapp' | 'iap';\n}\n\nexport type Product = ProductAndroid & ProductIOS;\n\n/**\n * Can be used to distinguish the different platforms' subscription information\n */\nexport enum SubscriptionPlatform {\n android = 'android',\n amazon = 'amazon',\n ios = 'ios',\n}\n\n/** Android Billing v5 type */\nexport interface SubscriptionAndroid {\n platform: SubscriptionPlatform.android;\n productType: 'subs';\n name: string;\n title: string;\n description: string;\n productId: string;\n subscriptionOfferDetails: SubscriptionOfferAndroid[];\n}\n\nexport interface SubscriptionOfferAndroid {\n offerToken: string;\n pricingPhases: {\n pricingPhaseList: PricingPhaseAndroid[];\n };\n offerTags: string[];\n}\n\nexport interface PricingPhaseAndroid {\n formattedPrice: string;\n priceCurrencyCode: string;\n /**\n * P1W, P1M, P1Y\n */\n billingPeriod: string;\n billingCycleCount: number;\n priceAmountMicros: string;\n recurrenceMode: number;\n}\n\n/**\n * TODO: As of 2022-10-10, this typing is not verified against the real\n * Amazon API. Please update this if you have a more accurate type.\n */\nexport interface SubscriptionAmazon extends ProductCommon {\n platform: SubscriptionPlatform.amazon;\n type: 'subs';\n\n productType?: string;\n name?: string;\n}\n\nexport type SubscriptionIosPeriod = 'DAY' | 'WEEK' | 'MONTH' | 'YEAR' | '';\nexport interface SubscriptionIOS extends ProductCommon {\n platform: SubscriptionPlatform.ios;\n type: 'subs';\n discounts?: Discount[];\n introductoryPrice?: string;\n introductoryPriceAsAmountIOS?: string;\n introductoryPricePaymentModeIOS?:\n | ''\n | 'FREETRIAL'\n | 'PAYASYOUGO'\n | 'PAYUPFRONT';\n introductoryPriceNumberOfPeriodsIOS?: string;\n introductoryPriceSubscriptionPeriodIOS?: SubscriptionIosPeriod;\n\n subscriptionPeriodNumberIOS?: string;\n subscriptionPeriodUnitIOS?: SubscriptionIosPeriod;\n}\n\nexport type Subscription =\n | SubscriptionAndroid\n | SubscriptionAmazon\n | SubscriptionIOS;\n\nexport interface RequestPurchaseBaseAndroid {\n obfuscatedAccountIdAndroid?: string;\n obfuscatedProfileIdAndroid?: string;\n isOfferPersonalized?: boolean; // For AndroidBilling V5 https://developer.android.com/google/play/billing/integrate#personalized-price\n}\n\nexport interface RequestPurchaseAndroid extends RequestPurchaseBaseAndroid {\n skus: Sku[];\n}\n\nexport interface RequestPurchaseIOS {\n sku: Sku;\n andDangerouslyFinishTransactionAutomaticallyIOS?: boolean;\n /**\n * UUID representing user account\n */\n appAccountToken?: string;\n quantity?: number;\n withOffer?: Apple.PaymentDiscount;\n}\n\n/** As of 2022-10-12, we only use the `sku` field for Amazon purchases */\nexport type RequestPurchaseAmazon = RequestPurchaseIOS;\n\nexport type RequestPurchase =\n | RequestPurchaseAndroid\n | RequestPurchaseAmazon\n | RequestPurchaseIOS;\n\n/**\n * In order to purchase a new subscription, every sku must have a selected offerToken\n * @see SubscriptionAndroid.subscriptionOfferDetails.offerToken\n */\nexport interface SubscriptionOffer {\n sku: Sku;\n offerToken: string;\n}\n\nexport interface RequestSubscriptionAndroid extends RequestPurchaseBaseAndroid {\n purchaseTokenAndroid?: string;\n prorationModeAndroid?: ProrationModesAndroid;\n subscriptionOffers: SubscriptionOffer[];\n}\n\nexport type RequestSubscriptionIOS = RequestPurchaseIOS;\n\n/** As of 2022-10-12, we only use the `sku` field for Amazon subscriptions */\nexport type RequestSubscriptionAmazon = RequestSubscriptionIOS;\n\nexport type RequestSubscription =\n | RequestSubscriptionAndroid\n | RequestSubscriptionAmazon\n | RequestSubscriptionIOS;\n\ndeclare module 'react-native' {\n interface NativeModulesStatic {\n RNIapIos: IosModuleProps;\n RNIapIosSk2: IosModulePropsSk2;\n RNIapModule: AndroidModuleProps;\n RNIapAmazonModule: AmazonModuleProps;\n }\n}\n"],"mappings":"AAWA,WAAYA,qBAAZ;;WAAYA,qB;EAAAA,qB,CAAAA,qB;EAAAA,qB,CAAAA,qB;EAAAA,qB,CAAAA,qB;EAAAA,qB,CAAAA,qB;EAAAA,qB,CAAAA,qB;EAAAA,qB,CAAAA,qB;GAAAA,qB,KAAAA,qB;;AASZ,WAAYC,oBAAZ;;WAAYA,oB;EAAAA,oB,CAAAA,oB;EAAAA,oB,CAAAA,oB;EAAAA,oB,CAAAA,oB;GAAAA,oB,KAAAA,oB;;AAMZ,OAAO,MAAMC,gBAAgB,GAAG,sBAAzB;AAEP,WAAYC,oBAAZ;;WAAYA,oB;EAAAA,oB,CAAAA,oB;EAAAA,oB,CAAAA,oB;EAAAA,oB,CAAAA,oB;GAAAA,oB,KAAAA,oB;;AAMZ,WAAYC,WAAZ;;WAAYA,W;EAAAA,W;EAAAA,W;EAAAA,W;EAAAA,W;GAAAA,W,KAAAA,W;;AA8FZ;AACA;AACA;AACA,WAAYC,oBAAZ;AAMA;;WANYA,oB;EAAAA,oB;EAAAA,oB;EAAAA,oB;GAAAA,oB,KAAAA,oB"}
1
+ {"version":3,"names":["ProrationModesAndroid","PurchaseStateAndroid","PROMOTED_PRODUCT","InstallSourceAndroid","ProductType","SubscriptionPlatform"],"sources":["index.ts"],"sourcesContent":["import type {\n AmazonModuleProps,\n AndroidModuleProps,\n IosModuleProps,\n} from '../modules';\nimport type {IosModulePropsSk2} from '../modules/iosSk2';\n\nimport type * as Apple from './apple';\n\nexport type Sku = string;\n\nexport enum ProrationModesAndroid {\n IMMEDIATE_WITH_TIME_PRORATION = 1,\n IMMEDIATE_AND_CHARGE_PRORATED_PRICE = 2,\n IMMEDIATE_WITHOUT_PRORATION = 3,\n DEFERRED = 4,\n IMMEDIATE_AND_CHARGE_FULL_PRICE = 5,\n UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY = 0,\n}\n\nexport enum PurchaseStateAndroid {\n UNSPECIFIED_STATE = 0,\n PURCHASED = 1,\n PENDING = 2,\n}\n\nexport const PROMOTED_PRODUCT = 'iap-promoted-product';\n\nexport enum InstallSourceAndroid {\n NOT_SET = 0,\n GOOGLE_PLAY = 1,\n AMAZON = 2,\n}\n\nexport enum ProductType {\n /** Subscription */\n subs = 'subs',\n\n /** Subscription */\n sub = 'sub',\n\n /** Consumable */\n inapp = 'inapp',\n\n /** Consumable */\n iap = 'iap',\n}\n\nexport interface ProductCommon {\n type: 'subs' | 'sub' | 'inapp' | 'iap';\n productId: string; //iOS\n productIds?: string[];\n title: string;\n description: string;\n price: string;\n currency: string;\n localizedPrice: string;\n countryCode?: string;\n}\n\nexport interface ProductPurchase {\n productId: string;\n transactionId?: string;\n transactionDate: number;\n transactionReceipt: string;\n purchaseToken?: string;\n //iOS\n quantityIOS?: number;\n originalTransactionDateIOS?: number;\n originalTransactionIdentifierIOS?: string;\n //Android\n productIds?: 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 //Amazon\n userIdAmazon?: string;\n userMarketplaceAmazon?: string;\n userJsonAmazon?: string;\n isCanceledAmazon?: boolean;\n}\n\nexport interface PurchaseResult {\n responseCode?: number;\n debugMessage?: string;\n code?: string;\n message?: string;\n purchaseToken?: string;\n}\n\nexport interface SubscriptionPurchase extends ProductPurchase {\n autoRenewingAndroid?: boolean;\n originalTransactionDateIOS?: number;\n originalTransactionIdentifierIOS?: string;\n}\n\nexport type Purchase = ProductPurchase | SubscriptionPurchase;\n\nexport interface Discount {\n identifier: string;\n type: string;\n numberOfPeriods: string;\n price: string;\n localizedPrice: string;\n paymentMode: '' | 'FREETRIAL' | 'PAYASYOUGO' | 'PAYUPFRONT';\n subscriptionPeriod: string;\n}\n\nexport interface ProductAndroid extends ProductCommon {\n type: 'inapp' | 'iap';\n oneTimePurchaseOfferDetails?: {\n priceCurrencyCode: string;\n formattedPrice: string;\n priceAmountMicros: string;\n };\n}\nexport interface ProductIOS extends ProductCommon {\n type: 'inapp' | 'iap';\n}\n\nexport type Product = ProductAndroid & ProductIOS;\n\n/**\n * Can be used to distinguish the different platforms' subscription information\n */\nexport enum SubscriptionPlatform {\n android = 'android',\n amazon = 'amazon',\n ios = 'ios',\n}\n\n/** Android Billing v5 type */\nexport interface SubscriptionAndroid {\n platform: SubscriptionPlatform.android;\n productType: 'subs';\n name: string;\n title: string;\n description: string;\n productId: string;\n subscriptionOfferDetails: SubscriptionOfferAndroid[];\n}\n\nexport interface SubscriptionOfferAndroid {\n offerToken: string;\n pricingPhases: {\n pricingPhaseList: PricingPhaseAndroid[];\n };\n offerTags: string[];\n}\n\nexport interface PricingPhaseAndroid {\n formattedPrice: string;\n priceCurrencyCode: string;\n /**\n * P1W, P1M, P1Y\n */\n billingPeriod: string;\n billingCycleCount: number;\n priceAmountMicros: string;\n recurrenceMode: number;\n}\n\n/**\n * TODO: As of 2022-10-10, this typing is not verified against the real\n * Amazon API. Please update this if you have a more accurate type.\n */\nexport interface SubscriptionAmazon extends ProductCommon {\n platform: SubscriptionPlatform.amazon;\n type: 'subs';\n\n productType?: string;\n name?: string;\n}\n\nexport type SubscriptionIosPeriod = 'DAY' | 'WEEK' | 'MONTH' | 'YEAR' | '';\nexport interface SubscriptionIOS extends ProductCommon {\n platform: SubscriptionPlatform.ios;\n type: 'subs';\n discounts?: Discount[];\n introductoryPrice?: string;\n introductoryPriceAsAmountIOS?: string;\n introductoryPricePaymentModeIOS?:\n | ''\n | 'FREETRIAL'\n | 'PAYASYOUGO'\n | 'PAYUPFRONT';\n introductoryPriceNumberOfPeriodsIOS?: string;\n introductoryPriceSubscriptionPeriodIOS?: SubscriptionIosPeriod;\n\n subscriptionPeriodNumberIOS?: string;\n subscriptionPeriodUnitIOS?: SubscriptionIosPeriod;\n}\n\nexport type Subscription =\n | SubscriptionAndroid\n | SubscriptionAmazon\n | SubscriptionIOS;\n\nexport interface RequestPurchaseBaseAndroid {\n obfuscatedAccountIdAndroid?: string;\n obfuscatedProfileIdAndroid?: string;\n isOfferPersonalized?: boolean; // For AndroidBilling V5 https://developer.android.com/google/play/billing/integrate#personalized-price\n}\n\nexport interface RequestPurchaseAndroid extends RequestPurchaseBaseAndroid {\n skus: Sku[];\n}\n\nexport interface RequestPurchaseIOS {\n sku: Sku;\n andDangerouslyFinishTransactionAutomaticallyIOS?: boolean;\n /**\n * UUID representing user account\n */\n appAccountToken?: string;\n quantity?: number;\n withOffer?: Apple.PaymentDiscount;\n}\n\n/** As of 2022-10-12, we only use the `sku` field for Amazon purchases */\nexport type RequestPurchaseAmazon = RequestPurchaseIOS;\n\nexport type RequestPurchase =\n | RequestPurchaseAndroid\n | RequestPurchaseAmazon\n | RequestPurchaseIOS;\n\n/**\n * In order to purchase a new subscription, every sku must have a selected offerToken\n * @see SubscriptionAndroid.subscriptionOfferDetails.offerToken\n */\nexport interface SubscriptionOffer {\n sku: Sku;\n offerToken: string;\n}\n\nexport interface RequestSubscriptionAndroid extends RequestPurchaseBaseAndroid {\n purchaseTokenAndroid?: string;\n prorationModeAndroid?: ProrationModesAndroid;\n subscriptionOffers: SubscriptionOffer[];\n}\n\nexport type RequestSubscriptionIOS = RequestPurchaseIOS;\n\n/** As of 2022-10-12, we only use the `sku` field for Amazon subscriptions */\nexport type RequestSubscriptionAmazon = RequestSubscriptionIOS;\n\nexport type RequestSubscription =\n | RequestSubscriptionAndroid\n | RequestSubscriptionAmazon\n | RequestSubscriptionIOS;\n\ndeclare module 'react-native' {\n interface NativeModulesStatic {\n RNIapIos: IosModuleProps;\n RNIapIosSk2: IosModulePropsSk2;\n RNIapModule: AndroidModuleProps;\n RNIapAmazonModule: AmazonModuleProps;\n }\n}\n"],"mappings":"AAWA,WAAYA,qBAAZ;;WAAYA,qB;EAAAA,qB,CAAAA,qB;EAAAA,qB,CAAAA,qB;EAAAA,qB,CAAAA,qB;EAAAA,qB,CAAAA,qB;EAAAA,qB,CAAAA,qB;EAAAA,qB,CAAAA,qB;GAAAA,qB,KAAAA,qB;;AASZ,WAAYC,oBAAZ;;WAAYA,oB;EAAAA,oB,CAAAA,oB;EAAAA,oB,CAAAA,oB;EAAAA,oB,CAAAA,oB;GAAAA,oB,KAAAA,oB;;AAMZ,OAAO,MAAMC,gBAAgB,GAAG,sBAAzB;AAEP,WAAYC,oBAAZ;;WAAYA,oB;EAAAA,oB,CAAAA,oB;EAAAA,oB,CAAAA,oB;EAAAA,oB,CAAAA,oB;GAAAA,oB,KAAAA,oB;;AAMZ,WAAYC,WAAZ;;WAAYA,W;EAAAA,W;EAAAA,W;EAAAA,W;EAAAA,W;GAAAA,W,KAAAA,W;;AA8FZ;AACA;AACA;AACA,WAAYC,oBAAZ;AAMA;;WANYA,oB;EAAAA,oB;EAAAA,oB;EAAAA,oB;GAAAA,oB,KAAAA,oB"}
@@ -49,7 +49,7 @@ export interface ProductPurchase {
49
49
  transactionReceipt: string;
50
50
  purchaseToken?: string;
51
51
  quantityIOS?: number;
52
- originalTransactionDateIOS?: string;
52
+ originalTransactionDateIOS?: number;
53
53
  originalTransactionIdentifierIOS?: string;
54
54
  productIds?: string[];
55
55
  dataAndroid?: string;
@@ -75,7 +75,7 @@ export interface PurchaseResult {
75
75
  }
76
76
  export interface SubscriptionPurchase extends ProductPurchase {
77
77
  autoRenewingAndroid?: boolean;
78
- originalTransactionDateIOS?: string;
78
+ originalTransactionDateIOS?: number;
79
79
  originalTransactionIdentifierIOS?: string;
80
80
  }
81
81
  export declare type Purchase = ProductPurchase | SubscriptionPurchase;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-iap",
3
- "version": "12.4.4",
3
+ "version": "12.4.5",
4
4
  "description": "React Native In App Purchase Module.",
5
5
  "repository": "https://github.com/dooboolab/react-native-iap",
6
6
  "author": "dooboolab <support@dooboolab.com> (https://github.com/dooboolab)",
@@ -151,7 +151,7 @@ export const transactionSk2Map = ({
151
151
  transactionReceipt: '', // Not available
152
152
  purchaseToken: '', //Not avaiable
153
153
  quantityIOS: purchasedQuantity,
154
- originalTransactionDateIOS: String(originalPurchaseDate),
154
+ originalTransactionDateIOS: originalPurchaseDate,
155
155
  originalTransactionIdentifierIOS: originalID,
156
156
  };
157
157
  return purchase;
@@ -66,7 +66,7 @@ export interface ProductPurchase {
66
66
  purchaseToken?: string;
67
67
  //iOS
68
68
  quantityIOS?: number;
69
- originalTransactionDateIOS?: string;
69
+ originalTransactionDateIOS?: number;
70
70
  originalTransactionIdentifierIOS?: string;
71
71
  //Android
72
72
  productIds?: string[];
@@ -96,7 +96,7 @@ export interface PurchaseResult {
96
96
 
97
97
  export interface SubscriptionPurchase extends ProductPurchase {
98
98
  autoRenewingAndroid?: boolean;
99
- originalTransactionDateIOS?: string;
99
+ originalTransactionDateIOS?: number;
100
100
  originalTransactionIdentifierIOS?: string;
101
101
  }
102
102