react-native-iap 9.0.0-beta → 9.0.0-beta4
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/.yarn/install-state.gz +0 -0
- package/android/src/play/java/com/dooboolab/RNIap/RNIapModule.kt +9 -7
- package/android/src/play/java/com/dooboolab/RNIap/RNIapModuleInterface.kt +2 -2
- package/android/src/play/java/com/dooboolab/RNIap/RNIapModuleV4.kt +5 -3
- package/ios/RNIapIos.m +1 -0
- package/ios/RNIapIos.swift +6 -8
- package/package.json +1 -1
- package/src/iap.d.ts +6 -4
- package/src/iap.js +24 -26
- package/src/types/index.d.ts +36 -22
- package/ios/RNIapQueue.swift +0 -36
package/.yarn/install-state.gz
CHANGED
|
Binary file
|
|
@@ -201,10 +201,12 @@ class RNIapModule(
|
|
|
201
201
|
for (i in 0 until skuArr.size()) {
|
|
202
202
|
if (skuArr.getType(i) == ReadableType.String) {
|
|
203
203
|
val sku = skuArr.getString(i)
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
.
|
|
207
|
-
|
|
204
|
+
sku?.let {
|
|
205
|
+
skuList.add(
|
|
206
|
+
QueryProductDetailsParams.Product.newBuilder().setProductId(sku)
|
|
207
|
+
.setProductType(type).build()
|
|
208
|
+
)
|
|
209
|
+
}
|
|
208
210
|
}
|
|
209
211
|
}
|
|
210
212
|
val params = QueryProductDetailsParams.newBuilder().setProductList(skuList)
|
|
@@ -386,10 +388,10 @@ class RNIapModule(
|
|
|
386
388
|
type: String,
|
|
387
389
|
sku: String, // TODO: should this now be an array?
|
|
388
390
|
purchaseToken: String?,
|
|
389
|
-
prorationMode: Int
|
|
391
|
+
prorationMode: Int,
|
|
390
392
|
obfuscatedAccountId: String?,
|
|
391
393
|
obfuscatedProfileId: String?,
|
|
392
|
-
selectedOfferIndex: Int
|
|
394
|
+
selectedOfferIndex: Int, // New optional parameter in V5, TODO: should it be an array?
|
|
393
395
|
promise: Promise
|
|
394
396
|
) {
|
|
395
397
|
val activity = currentActivity
|
|
@@ -419,7 +421,7 @@ class RNIapModule(
|
|
|
419
421
|
return@ensureConnection
|
|
420
422
|
}
|
|
421
423
|
var productParams = BillingFlowParams.ProductDetailsParams.newBuilder().setProductDetails(selectedSku)
|
|
422
|
-
if (selectedOfferIndex
|
|
424
|
+
if (selectedOfferIndex > -1 && (
|
|
423
425
|
selectedSku.subscriptionOfferDetails?.size
|
|
424
426
|
?: 0
|
|
425
427
|
) > selectedOfferIndex
|
|
@@ -20,10 +20,10 @@ interface RNIapModuleInterface {
|
|
|
20
20
|
type: String,
|
|
21
21
|
sku: String,
|
|
22
22
|
purchaseToken: String?,
|
|
23
|
-
prorationMode: Int
|
|
23
|
+
prorationMode: Int,
|
|
24
24
|
obfuscatedAccountId: String?,
|
|
25
25
|
obfuscatedProfileId: String?,
|
|
26
|
-
selectedOfferIndex: Int
|
|
26
|
+
selectedOfferIndex: Int, // New optional parameter in V5 (added to maintain interface consistency)
|
|
27
27
|
promise: Promise
|
|
28
28
|
)
|
|
29
29
|
fun acknowledgePurchase(
|
|
@@ -197,7 +197,9 @@ class RNIapModuleV4(
|
|
|
197
197
|
for (i in 0 until skuArr.size()) {
|
|
198
198
|
if (skuArr.getType(i) == ReadableType.String) {
|
|
199
199
|
val sku = skuArr.getString(i)
|
|
200
|
-
|
|
200
|
+
sku?.let {
|
|
201
|
+
skuList.add(sku)
|
|
202
|
+
}
|
|
201
203
|
}
|
|
202
204
|
}
|
|
203
205
|
val params = SkuDetailsParams.newBuilder()
|
|
@@ -361,10 +363,10 @@ class RNIapModuleV4(
|
|
|
361
363
|
type: String,
|
|
362
364
|
sku: String,
|
|
363
365
|
purchaseToken: String?,
|
|
364
|
-
prorationMode: Int
|
|
366
|
+
prorationMode: Int,
|
|
365
367
|
obfuscatedAccountId: String?,
|
|
366
368
|
obfuscatedProfileId: String?,
|
|
367
|
-
selectedOfferIndex: Int
|
|
369
|
+
selectedOfferIndex: Int, // New optional parameter in V5 (added to maintain interface consistency)
|
|
368
370
|
promise: Promise
|
|
369
371
|
) {
|
|
370
372
|
val activity = currentActivity
|
package/ios/RNIapIos.m
CHANGED
|
@@ -20,6 +20,7 @@ RCT_EXTERN_METHOD(buyProduct:
|
|
|
20
20
|
(NSString*)sku
|
|
21
21
|
appAccountToken:(NSString*)appAccountToken
|
|
22
22
|
andDangerouslyFinishTransactionAutomatically:(BOOL)andDangerouslyFinishTransactionAutomatically
|
|
23
|
+
applicationUsername:(NSString)applicationUsername
|
|
23
24
|
resolve:(RCTPromiseResolveBlock)resolve
|
|
24
25
|
reject:(RCTPromiseRejectBlock)reject)
|
|
25
26
|
RCT_EXTERN_METHOD(buyProductWithOffer:
|
package/ios/RNIapIos.swift
CHANGED
|
@@ -47,6 +47,7 @@ class RNIapIos: RCTEventEmitter, SKRequestDelegate, SKPaymentTransactionObserver
|
|
|
47
47
|
myQueue = DispatchQueue(label: "reject")
|
|
48
48
|
validProducts = [SKProduct]()
|
|
49
49
|
super.init()
|
|
50
|
+
SKPaymentQueue.default().add(self)
|
|
50
51
|
}
|
|
51
52
|
|
|
52
53
|
deinit {
|
|
@@ -132,12 +133,6 @@ class RNIapIos: RCTEventEmitter, SKRequestDelegate, SKPaymentTransactionObserver
|
|
|
132
133
|
_ resolve: @escaping RCTPromiseResolveBlock = { _ in },
|
|
133
134
|
reject: @escaping RCTPromiseRejectBlock = { _, _, _ in }
|
|
134
135
|
) {
|
|
135
|
-
SKPaymentQueue.default().remove(RNIapQueue.shared)
|
|
136
|
-
if let queue = RNIapQueue.shared.queue, let payment = RNIapQueue.shared.payment, let product = RNIapQueue.shared.product {
|
|
137
|
-
let val = paymentQueue(queue, shouldAddStorePayment: payment,for: product)
|
|
138
|
-
print("Promoted product response \(val)")
|
|
139
|
-
}
|
|
140
|
-
SKPaymentQueue.default().add(self)
|
|
141
136
|
let canMakePayments = SKPaymentQueue.canMakePayments()
|
|
142
137
|
resolve(NSNumber(value: canMakePayments))
|
|
143
138
|
}
|
|
@@ -178,8 +173,8 @@ class RNIapIos: RCTEventEmitter, SKRequestDelegate, SKPaymentTransactionObserver
|
|
|
178
173
|
|
|
179
174
|
@objc public func buyProduct(
|
|
180
175
|
_ sku:String,
|
|
181
|
-
appAccountToken:String,
|
|
182
176
|
andDangerouslyFinishTransactionAutomatically: Bool,
|
|
177
|
+
applicationUsername:String?,
|
|
183
178
|
resolve: @escaping RCTPromiseResolveBlock = { _ in },
|
|
184
179
|
reject: @escaping RCTPromiseRejectBlock = { _, _, _ in }
|
|
185
180
|
) {
|
|
@@ -198,7 +193,10 @@ class RNIapIos: RCTEventEmitter, SKRequestDelegate, SKPaymentTransactionObserver
|
|
|
198
193
|
addPromise(forKey: prod.productIdentifier, resolve: resolve, reject: reject)
|
|
199
194
|
|
|
200
195
|
let payment = SKMutablePayment(product: prod)
|
|
201
|
-
|
|
196
|
+
|
|
197
|
+
if (applicationUsername != nil) {
|
|
198
|
+
payment.applicationUsername = applicationUsername
|
|
199
|
+
}
|
|
202
200
|
SKPaymentQueue.default().add(payment)
|
|
203
201
|
} else{
|
|
204
202
|
if hasListeners {
|
package/package.json
CHANGED
package/src/iap.d.ts
CHANGED
|
@@ -2,8 +2,9 @@ import * as Amazon from './types/amazon';
|
|
|
2
2
|
import * as Android from './types/android';
|
|
3
3
|
import * as Apple from './types/apple';
|
|
4
4
|
import { EmitterSubscription } from 'react-native';
|
|
5
|
-
import { InAppPurchase, InstallSourceAndroid, Product, ProductPurchase,
|
|
5
|
+
import { InAppPurchase, InstallSourceAndroid, Product, ProductPurchase, PurchaseError, PurchaseResult, RequestPurchase, RequestSubscription, Subscription, SubscriptionPurchase } from './types';
|
|
6
6
|
export declare const getInstallSourceAndroid: () => InstallSourceAndroid;
|
|
7
|
+
export declare const setAndroidNativeModule: (nativeModule: any) => void;
|
|
7
8
|
/**
|
|
8
9
|
* Init module for purchase flow. Required on Android. In ios it will check whether user canMakePayment.
|
|
9
10
|
* @returns {Promise<boolean>}
|
|
@@ -44,13 +45,13 @@ export declare const getAvailablePurchases: () => Promise<(InAppPurchase | Subsc
|
|
|
44
45
|
/**
|
|
45
46
|
* Request a purchase for product. This will be received in `PurchaseUpdatedListener`.
|
|
46
47
|
* @param {string} sku The product's sku/ID
|
|
47
|
-
* @param {string} [
|
|
48
|
+
* @param {string} [applicationUsername] The purchaser's user ID
|
|
48
49
|
* @param {boolean} [andDangerouslyFinishTransactionAutomaticallyIOS] You should set this to false and call finishTransaction manually when you have delivered the purchased goods to the user. It defaults to true to provide backwards compatibility. Will default to false in version 4.0.0.
|
|
49
50
|
* @param {string} [obfuscatedAccountIdAndroid] Specifies an optional obfuscated string that is uniquely associated with the user's account in your app.
|
|
50
51
|
* @param {string} [obfuscatedProfileIdAndroid] Specifies an optional obfuscated string that is uniquely associated with the user's profile in your app.
|
|
51
52
|
* @returns {Promise<InAppPurchase>}
|
|
52
53
|
*/
|
|
53
|
-
export declare const requestPurchase: (sku
|
|
54
|
+
export declare const requestPurchase: ({ sku, andDangerouslyFinishTransactionAutomaticallyIOS, applicationUsername, obfuscatedAccountIdAndroid, obfuscatedProfileIdAndroid, }: RequestPurchase) => Promise<InAppPurchase>;
|
|
54
55
|
/**
|
|
55
56
|
* Request a purchase for product. This will be received in `PurchaseUpdatedListener`.
|
|
56
57
|
* @param {string} [sku] The product's sku/ID
|
|
@@ -59,9 +60,10 @@ export declare const requestPurchase: (sku: string, appAccountToken: string, and
|
|
|
59
60
|
* @param {ProrationModesAndroid} [prorationModeAndroid] UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY, IMMEDIATE_WITH_TIME_PRORATION, IMMEDIATE_AND_CHARGE_PRORATED_PRICE, IMMEDIATE_WITHOUT_PRORATION, DEFERRED
|
|
60
61
|
* @param {string} [obfuscatedAccountIdAndroid] Specifies an optional obfuscated string that is uniquely associated with the user's account in your app.
|
|
61
62
|
* @param {string} [obfuscatedProfileIdAndroid] Specifies an optional obfuscated string that is uniquely associated with the user's profile in your app.
|
|
63
|
+
* @param {string} [selectedOfferIndex] Selected Offer index from the list returned by get products
|
|
62
64
|
* @returns {Promise<SubscriptionPurchase | null>} Promise resolves to null when using proratioModesAndroid=DEFERRED, and to a SubscriptionPurchase otherwise
|
|
63
65
|
*/
|
|
64
|
-
export declare const requestSubscription: (sku
|
|
66
|
+
export declare const requestSubscription: ({ sku, andDangerouslyFinishTransactionAutomaticallyIOS, purchaseTokenAndroid, prorationModeAndroid, obfuscatedAccountIdAndroid, obfuscatedProfileIdAndroid, selectedOfferIndex, }: RequestSubscription) => Promise<SubscriptionPurchase | null>;
|
|
65
67
|
/**
|
|
66
68
|
* Request a purchase for product. This will be received in `PurchaseUpdatedListener`.
|
|
67
69
|
* @param {string} sku The product's sku/ID
|
package/src/iap.js
CHANGED
|
@@ -49,7 +49,7 @@ export var getInstallSourceAndroid = function () {
|
|
|
49
49
|
* Defaulting to V4 to minimize migration, it'll eventually be changed to default to V5
|
|
50
50
|
*/
|
|
51
51
|
var androidNativeModule = RNIapModuleV4;
|
|
52
|
-
var setAndroidNativeModule = function (nativeModule) {
|
|
52
|
+
export var setAndroidNativeModule = function (nativeModule) {
|
|
53
53
|
androidNativeModule = nativeModule;
|
|
54
54
|
};
|
|
55
55
|
var checkNativeAndroidAvailable = function () {
|
|
@@ -148,13 +148,15 @@ var fillProductsAdditionalData = function (products) { return __awaiter(void 0,
|
|
|
148
148
|
export var getProducts = function (skus) {
|
|
149
149
|
return (Platform.select({
|
|
150
150
|
ios: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
151
|
+
var products;
|
|
151
152
|
return __generator(this, function (_a) {
|
|
152
153
|
switch (_a.label) {
|
|
153
|
-
case 0: return [4 /*yield*/, getIosModule()
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
154
|
+
case 0: return [4 /*yield*/, getIosModule().getItems(skus)];
|
|
155
|
+
case 1:
|
|
156
|
+
products = _a.sent();
|
|
157
|
+
return [2 /*return*/, products.filter(function (item) {
|
|
158
|
+
return skus.includes(item.productId) && item.type === 'iap';
|
|
159
|
+
})];
|
|
158
160
|
}
|
|
159
161
|
});
|
|
160
162
|
}); },
|
|
@@ -179,13 +181,15 @@ export var getProducts = function (skus) {
|
|
|
179
181
|
export var getSubscriptions = function (skus) {
|
|
180
182
|
return (Platform.select({
|
|
181
183
|
ios: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
184
|
+
var subscriptions;
|
|
182
185
|
return __generator(this, function (_a) {
|
|
183
186
|
switch (_a.label) {
|
|
184
|
-
case 0: return [4 /*yield*/, getIosModule()
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
187
|
+
case 0: return [4 /*yield*/, getIosModule().getItems(skus)];
|
|
188
|
+
case 1:
|
|
189
|
+
subscriptions = _a.sent();
|
|
190
|
+
return [2 /*return*/, subscriptions.filter(function (item) {
|
|
191
|
+
return skus.includes(item.productId) && item.type === 'subs';
|
|
192
|
+
})];
|
|
189
193
|
}
|
|
190
194
|
});
|
|
191
195
|
}); },
|
|
@@ -267,17 +271,14 @@ export var getAvailablePurchases = function () {
|
|
|
267
271
|
/**
|
|
268
272
|
* Request a purchase for product. This will be received in `PurchaseUpdatedListener`.
|
|
269
273
|
* @param {string} sku The product's sku/ID
|
|
270
|
-
* @param {string} [
|
|
274
|
+
* @param {string} [applicationUsername] The purchaser's user ID
|
|
271
275
|
* @param {boolean} [andDangerouslyFinishTransactionAutomaticallyIOS] You should set this to false and call finishTransaction manually when you have delivered the purchased goods to the user. It defaults to true to provide backwards compatibility. Will default to false in version 4.0.0.
|
|
272
276
|
* @param {string} [obfuscatedAccountIdAndroid] Specifies an optional obfuscated string that is uniquely associated with the user's account in your app.
|
|
273
277
|
* @param {string} [obfuscatedProfileIdAndroid] Specifies an optional obfuscated string that is uniquely associated with the user's profile in your app.
|
|
274
278
|
* @returns {Promise<InAppPurchase>}
|
|
275
279
|
*/
|
|
276
|
-
export var requestPurchase = function (
|
|
277
|
-
|
|
278
|
-
if (obfuscatedAccountIdAndroid === void 0) { obfuscatedAccountIdAndroid = undefined; }
|
|
279
|
-
if (obfuscatedProfileIdAndroid === void 0) { obfuscatedProfileIdAndroid = undefined; }
|
|
280
|
-
if (selectedOfferIndex === void 0) { selectedOfferIndex = undefined; }
|
|
280
|
+
export var requestPurchase = function (_a) {
|
|
281
|
+
var sku = _a.sku, _b = _a.andDangerouslyFinishTransactionAutomaticallyIOS, andDangerouslyFinishTransactionAutomaticallyIOS = _b === void 0 ? false : _b, applicationUsername = _a.applicationUsername, _c = _a.obfuscatedAccountIdAndroid, obfuscatedAccountIdAndroid = _c === void 0 ? undefined : _c, _d = _a.obfuscatedProfileIdAndroid, obfuscatedProfileIdAndroid = _d === void 0 ? undefined : _d;
|
|
281
282
|
return (Platform.select({
|
|
282
283
|
ios: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
283
284
|
return __generator(this, function (_a) {
|
|
@@ -287,12 +288,12 @@ export var requestPurchase = function (sku, appAccountToken, andDangerouslyFinis
|
|
|
287
288
|
// eslint-disable-next-line max-len
|
|
288
289
|
'You are dangerously allowing react-native-iap to finish your transaction automatically. You should set andDangerouslyFinishTransactionAutomatically to false when calling requestPurchase and call finishTransaction manually when you have delivered the purchased goods to the user. It defaults to true to provide backwards compatibility. Will default to false in version 4.0.0.');
|
|
289
290
|
}
|
|
290
|
-
return [2 /*return*/, getIosModule().buyProduct(sku,
|
|
291
|
+
return [2 /*return*/, getIosModule().buyProduct(sku, andDangerouslyFinishTransactionAutomaticallyIOS, applicationUsername)];
|
|
291
292
|
});
|
|
292
293
|
}); },
|
|
293
294
|
android: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
294
295
|
return __generator(this, function (_a) {
|
|
295
|
-
return [2 /*return*/, getAndroidModule().buyItemByType(ANDROID_ITEM_TYPE_IAP, sku, null, 0, obfuscatedAccountIdAndroid, obfuscatedProfileIdAndroid,
|
|
296
|
+
return [2 /*return*/, getAndroidModule().buyItemByType(ANDROID_ITEM_TYPE_IAP, sku, null, 0, obfuscatedAccountIdAndroid, obfuscatedProfileIdAndroid, undefined)];
|
|
296
297
|
});
|
|
297
298
|
}); },
|
|
298
299
|
}) || Promise.resolve)();
|
|
@@ -305,14 +306,11 @@ export var requestPurchase = function (sku, appAccountToken, andDangerouslyFinis
|
|
|
305
306
|
* @param {ProrationModesAndroid} [prorationModeAndroid] UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY, IMMEDIATE_WITH_TIME_PRORATION, IMMEDIATE_AND_CHARGE_PRORATED_PRICE, IMMEDIATE_WITHOUT_PRORATION, DEFERRED
|
|
306
307
|
* @param {string} [obfuscatedAccountIdAndroid] Specifies an optional obfuscated string that is uniquely associated with the user's account in your app.
|
|
307
308
|
* @param {string} [obfuscatedProfileIdAndroid] Specifies an optional obfuscated string that is uniquely associated with the user's profile in your app.
|
|
309
|
+
* @param {string} [selectedOfferIndex] Selected Offer index from the list returned by get products
|
|
308
310
|
* @returns {Promise<SubscriptionPurchase | null>} Promise resolves to null when using proratioModesAndroid=DEFERRED, and to a SubscriptionPurchase otherwise
|
|
309
311
|
*/
|
|
310
|
-
export var requestSubscription = function (
|
|
311
|
-
|
|
312
|
-
if (purchaseTokenAndroid === void 0) { purchaseTokenAndroid = undefined; }
|
|
313
|
-
if (prorationModeAndroid === void 0) { prorationModeAndroid = -1; }
|
|
314
|
-
if (obfuscatedAccountIdAndroid === void 0) { obfuscatedAccountIdAndroid = undefined; }
|
|
315
|
-
if (obfuscatedProfileIdAndroid === void 0) { obfuscatedProfileIdAndroid = undefined; }
|
|
312
|
+
export var requestSubscription = function (_a) {
|
|
313
|
+
var sku = _a.sku, _b = _a.andDangerouslyFinishTransactionAutomaticallyIOS, andDangerouslyFinishTransactionAutomaticallyIOS = _b === void 0 ? false : _b, _c = _a.purchaseTokenAndroid, purchaseTokenAndroid = _c === void 0 ? undefined : _c, _d = _a.prorationModeAndroid, prorationModeAndroid = _d === void 0 ? -1 : _d, _e = _a.obfuscatedAccountIdAndroid, obfuscatedAccountIdAndroid = _e === void 0 ? undefined : _e, _f = _a.obfuscatedProfileIdAndroid, obfuscatedProfileIdAndroid = _f === void 0 ? undefined : _f, _g = _a.selectedOfferIndex, selectedOfferIndex = _g === void 0 ? -1 : _g;
|
|
316
314
|
return (Platform.select({
|
|
317
315
|
ios: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
318
316
|
return __generator(this, function (_a) {
|
|
@@ -327,7 +325,7 @@ export var requestSubscription = function (sku, andDangerouslyFinishTransactionA
|
|
|
327
325
|
}); },
|
|
328
326
|
android: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
329
327
|
return __generator(this, function (_a) {
|
|
330
|
-
return [2 /*return*/, getAndroidModule().buyItemByType(ANDROID_ITEM_TYPE_SUBSCRIPTION, sku, purchaseTokenAndroid, prorationModeAndroid, obfuscatedAccountIdAndroid, obfuscatedProfileIdAndroid)];
|
|
328
|
+
return [2 /*return*/, getAndroidModule().buyItemByType(ANDROID_ITEM_TYPE_SUBSCRIPTION, sku, purchaseTokenAndroid, prorationModeAndroid, obfuscatedAccountIdAndroid, obfuscatedProfileIdAndroid, selectedOfferIndex)];
|
|
331
329
|
});
|
|
332
330
|
}); },
|
|
333
331
|
}) || Promise.resolve)();
|
package/src/types/index.d.ts
CHANGED
|
@@ -62,28 +62,6 @@ export interface ProductPurchase {
|
|
|
62
62
|
developerPayloadAndroid?: string;
|
|
63
63
|
obfuscatedAccountIdAndroid?: string;
|
|
64
64
|
obfuscatedProfileIdAndroid?: string;
|
|
65
|
-
title?: string;
|
|
66
|
-
description?: string;
|
|
67
|
-
productType?: string;
|
|
68
|
-
name?: string;
|
|
69
|
-
oneTimePurchaseOfferDetails?: {
|
|
70
|
-
priceCurrencyCode?: string;
|
|
71
|
-
formattedPrice?: string;
|
|
72
|
-
priceAmountMicros?: string;
|
|
73
|
-
}[];
|
|
74
|
-
subscriptionOfferDetails?: {
|
|
75
|
-
offerToken?: string[];
|
|
76
|
-
pricingPhases: {
|
|
77
|
-
pricingPhaseList: {
|
|
78
|
-
formattedPrice?: string;
|
|
79
|
-
priceCurrencyCode?: string;
|
|
80
|
-
billingPeriod?: string;
|
|
81
|
-
billingCycleCount?: number;
|
|
82
|
-
priceAmountMicros?: string;
|
|
83
|
-
recurrenceMode?: number;
|
|
84
|
-
};
|
|
85
|
-
};
|
|
86
|
-
}[];
|
|
87
65
|
userIdAmazon?: string;
|
|
88
66
|
userMarketplaceAmazon?: string;
|
|
89
67
|
userJsonAmazon?: string;
|
|
@@ -136,4 +114,40 @@ export interface Subscription extends ProductCommon {
|
|
|
136
114
|
introductoryPricePeriodAndroid?: string;
|
|
137
115
|
subscriptionPeriodAndroid?: string;
|
|
138
116
|
freeTrialPeriodAndroid?: string;
|
|
117
|
+
productType?: string;
|
|
118
|
+
name?: string;
|
|
119
|
+
oneTimePurchaseOfferDetails?: {
|
|
120
|
+
priceCurrencyCode?: string;
|
|
121
|
+
formattedPrice?: string;
|
|
122
|
+
priceAmountMicros?: string;
|
|
123
|
+
}[];
|
|
124
|
+
subscriptionOfferDetails?: {
|
|
125
|
+
offerToken?: string[];
|
|
126
|
+
pricingPhases: {
|
|
127
|
+
pricingPhaseList: {
|
|
128
|
+
formattedPrice?: string;
|
|
129
|
+
priceCurrencyCode?: string;
|
|
130
|
+
billingPeriod?: string;
|
|
131
|
+
billingCycleCount?: number;
|
|
132
|
+
priceAmountMicros?: string;
|
|
133
|
+
recurrenceMode?: number;
|
|
134
|
+
};
|
|
135
|
+
};
|
|
136
|
+
}[];
|
|
137
|
+
}
|
|
138
|
+
export interface RequestPurchase {
|
|
139
|
+
sku: string;
|
|
140
|
+
andDangerouslyFinishTransactionAutomaticallyIOS: boolean;
|
|
141
|
+
applicationUsername?: string;
|
|
142
|
+
obfuscatedAccountIdAndroid: string | undefined;
|
|
143
|
+
obfuscatedProfileIdAndroid: string | undefined;
|
|
144
|
+
}
|
|
145
|
+
export interface RequestSubscription {
|
|
146
|
+
sku: string;
|
|
147
|
+
andDangerouslyFinishTransactionAutomaticallyIOS: boolean;
|
|
148
|
+
purchaseTokenAndroid: string | undefined;
|
|
149
|
+
prorationModeAndroid: ProrationModesAndroid;
|
|
150
|
+
obfuscatedAccountIdAndroid: string | undefined;
|
|
151
|
+
obfuscatedProfileIdAndroid: string | undefined;
|
|
152
|
+
selectedOfferIndex?: number | undefined;
|
|
139
153
|
}
|
package/ios/RNIapQueue.swift
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// RNIapQueue.swift
|
|
3
|
-
//
|
|
4
|
-
//
|
|
5
|
-
// Created by Andres Aguilar on 9/8/21.
|
|
6
|
-
//
|
|
7
|
-
|
|
8
|
-
import Foundation
|
|
9
|
-
import StoreKit
|
|
10
|
-
|
|
11
|
-
// Temporarily stores payment information since it is sent by the OS before RN instantiates the RNModule
|
|
12
|
-
@objc(RNIapQueue)
|
|
13
|
-
public class RNIapQueue: NSObject, SKPaymentTransactionObserver {
|
|
14
|
-
public func paymentQueue(_ queue: SKPaymentQueue, updatedTransactions transactions: [SKPaymentTransaction]) {
|
|
15
|
-
//No-op
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
@objc
|
|
19
|
-
public static let shared = RNIapQueue()
|
|
20
|
-
|
|
21
|
-
var queue: SKPaymentQueue? = nil;
|
|
22
|
-
var payment: SKPayment? = nil;
|
|
23
|
-
var product: SKProduct? = nil;
|
|
24
|
-
|
|
25
|
-
private override init(){}
|
|
26
|
-
|
|
27
|
-
// Sent when a user initiates an IAP buy from the App Store
|
|
28
|
-
@available(iOS 11.0, *)
|
|
29
|
-
func paymentQueue(_ queue: SKPaymentQueue, shouldAddStorePayment payment: SKPayment, for product: SKProduct) -> Bool{
|
|
30
|
-
RNIapQueue.shared.queue = queue
|
|
31
|
-
RNIapQueue.shared.payment = payment
|
|
32
|
-
RNIapQueue.shared.product = product
|
|
33
|
-
return false
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
}
|