expo-iap 1.0.3 → 2.0.0-rc.1
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/.eslintrc.js +9 -0
- package/.prettierrc.js +9 -0
- package/.swiftlint.yml +10 -0
- package/README.md +28 -21
- package/android/build.gradle +34 -72
- package/android/src/main/AndroidManifest.xml +1 -4
- package/android/src/main/java/expo/modules/iap/ExpoIapModule.kt +535 -0
- package/android/src/main/java/expo/modules/iap/MissingCurrentActivityException.kt +6 -0
- package/android/src/main/java/expo/modules/iap/PlayUtils.kt +124 -0
- package/build/ExpoIap.types.d.ts +89 -0
- package/build/ExpoIap.types.d.ts.map +1 -0
- package/build/ExpoIap.types.js +59 -0
- package/build/ExpoIap.types.js.map +1 -0
- package/build/ExpoIapModule.d.ts +3 -0
- package/build/ExpoIapModule.d.ts.map +1 -0
- package/build/ExpoIapModule.js +5 -0
- package/build/ExpoIapModule.js.map +1 -0
- package/build/index.d.ts +38 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +202 -0
- package/build/index.js.map +1 -0
- package/build/modules/android.d.ts +40 -0
- package/build/modules/android.d.ts.map +1 -0
- package/build/modules/android.js +54 -0
- package/build/modules/android.js.map +1 -0
- package/build/modules/ios.d.ts +41 -0
- package/build/modules/ios.d.ts.map +1 -0
- package/build/modules/ios.js +44 -0
- package/build/modules/ios.js.map +1 -0
- package/build/types/ExpoIapAndroid.types.d.ts +113 -0
- package/build/types/ExpoIapAndroid.types.d.ts.map +1 -0
- package/build/types/ExpoIapAndroid.types.js +23 -0
- package/build/types/ExpoIapAndroid.types.js.map +1 -0
- package/build/types/ExpoIapIos.types.d.ts +122 -0
- package/build/types/ExpoIapIos.types.d.ts.map +1 -0
- package/build/types/ExpoIapIos.types.js +2 -0
- package/build/types/ExpoIapIos.types.js.map +1 -0
- package/bun.lockb +0 -0
- package/expo-module.config.json +4 -8
- package/ios/ExpoIap.podspec +27 -0
- package/ios/ExpoIapModule.swift +498 -0
- package/ios/ProductStore.swift +27 -0
- package/ios/Types.swift +54 -0
- package/package.json +33 -62
- package/src/ExpoIap.types.ts +125 -0
- package/src/ExpoIapModule.ts +5 -0
- package/src/index.ts +397 -0
- package/src/modules/android.ts +89 -0
- package/src/modules/ios.ts +81 -0
- package/src/types/ExpoIapAndroid.types.ts +123 -0
- package/src/types/ExpoIapIos.types.ts +141 -0
- package/tsconfig.json +9 -0
- package/.editorconfig +0 -10
- package/.flowconfig +0 -11
- package/.monolinterrc +0 -3
- package/.yarn/install-state.gz +0 -0
- package/.yarn/releases/yarn-3.1.1.cjs +0 -768
- package/.yarnrc.yml +0 -3
- package/LICENSE +0 -21
- package/RNIap.podspec +0 -18
- package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/android/gradle/wrapper/gradle-wrapper.properties +0 -6
- package/android/gradle.properties +0 -2
- package/android/gradlew +0 -160
- package/android/gradlew.bat +0 -90
- package/android/libs/in-app-purchasing-2.0.76.jar +0 -0
- package/android/src/amazon/AndroidManifest.xml +0 -12
- package/android/src/amazon/java/com/dooboolab/RNIap/RNIapAmazonListener.kt +0 -356
- package/android/src/amazon/java/com/dooboolab/RNIap/RNIapAmazonModule.kt +0 -128
- package/android/src/amazon/java/com/dooboolab/RNIap/RNIapPackage.kt +0 -20
- package/android/src/main/java/com/dooboolab/RNIap/DoobooUtils.kt +0 -180
- package/android/src/play/java/com/dooboolab/RNIap/PlayUtils.kt +0 -77
- package/android/src/play/java/com/dooboolab/RNIap/RNIapModule.kt +0 -698
- package/android/src/play/java/com/dooboolab/RNIap/RNIapPackage.kt +0 -20
- package/babel.config.js +0 -10
- package/index.d.ts +0 -3
- package/index.js +0 -3
- package/index.js.flow +0 -9
- package/ios/RNIap.xcodeproj/project.pbxproj +0 -370
- package/ios/RNIap.xcodeproj/xcshareddata/xcschemes/RNIap.xcscheme +0 -80
- package/ios/RNIapIos.m +0 -60
- package/ios/RNIapIos.swift +0 -932
- package/ios/RNIapQueue.swift +0 -35
- package/jest.config.js +0 -194
- package/src/__test__/iap.test.d.ts +0 -1
- package/src/__test__/iap.test.js +0 -59
- package/src/hooks/useIAP.d.ts +0 -21
- package/src/hooks/useIAP.js +0 -140
- package/src/hooks/withIAPContext.d.ts +0 -21
- package/src/hooks/withIAPContext.js +0 -142
- package/src/iap.d.ts +0 -197
- package/src/iap.js +0 -625
- package/src/index.d.ts +0 -4
- package/src/index.js +0 -4
- package/src/types/amazon.d.ts +0 -23
- package/src/types/amazon.js +0 -1
- package/src/types/android.d.ts +0 -47
- package/src/types/android.js +0 -22
- package/src/types/apple.d.ts +0 -424
- package/src/types/apple.js +0 -165
- package/src/types/index.d.ts +0 -117
- package/src/types/index.js +0 -40
- package/test/mocks/react-native-modules.js +0 -14
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { ProductAndroid, RequestPurchaseAndroidProps, RequestSubscriptionAndroidProps, SubscriptionProductAndroid } from './types/ExpoIapAndroid.types';
|
|
2
|
+
import { ProductIos, RequestPurchaseIosProps, RequestSubscriptionIosProps, SubscriptionProductIos } from './types/ExpoIapIos.types';
|
|
3
|
+
export type ChangeEventPayload = {
|
|
4
|
+
value: string;
|
|
5
|
+
};
|
|
6
|
+
export type Product = ProductAndroid | ProductIos;
|
|
7
|
+
export declare enum ProductType {
|
|
8
|
+
InAppPurchase = "inapp",
|
|
9
|
+
Subscription = "subs"
|
|
10
|
+
}
|
|
11
|
+
export type SubscriptionProduct = SubscriptionProductAndroid | SubscriptionProductIos;
|
|
12
|
+
export type RequestPurchaseProps = RequestPurchaseIosProps | RequestPurchaseAndroidProps;
|
|
13
|
+
declare enum PurchaseStateAndroid {
|
|
14
|
+
UNSPECIFIED_STATE = 0,
|
|
15
|
+
PURCHASED = 1,
|
|
16
|
+
PENDING = 2
|
|
17
|
+
}
|
|
18
|
+
export type ProductPurchase = {
|
|
19
|
+
productId: string;
|
|
20
|
+
transactionId?: string;
|
|
21
|
+
transactionDate: number;
|
|
22
|
+
transactionReceipt: string;
|
|
23
|
+
purchaseToken?: string;
|
|
24
|
+
quantityIOS?: number;
|
|
25
|
+
originalTransactionDateIOS?: number;
|
|
26
|
+
originalTransactionIdentifierIOS?: string;
|
|
27
|
+
verificationResultIOS?: string;
|
|
28
|
+
appAccountToken?: string;
|
|
29
|
+
productIds?: string[];
|
|
30
|
+
dataAndroid?: string;
|
|
31
|
+
signatureAndroid?: string;
|
|
32
|
+
autoRenewingAndroid?: boolean;
|
|
33
|
+
purchaseStateAndroid?: PurchaseStateAndroid;
|
|
34
|
+
isAcknowledgedAndroid?: boolean;
|
|
35
|
+
packageNameAndroid?: string;
|
|
36
|
+
developerPayloadAndroid?: string;
|
|
37
|
+
obfuscatedAccountIdAndroid?: string;
|
|
38
|
+
obfuscatedProfileIdAndroid?: string;
|
|
39
|
+
};
|
|
40
|
+
export type RequestSubscriptionProps = RequestSubscriptionAndroidProps | RequestSubscriptionIosProps;
|
|
41
|
+
declare enum TransactionReason {
|
|
42
|
+
PURCHASE = "PURCHASE",
|
|
43
|
+
RENEWAL = "RENEWAL"
|
|
44
|
+
}
|
|
45
|
+
export type SubscriptionPurchase = {
|
|
46
|
+
autoRenewingAndroid?: boolean;
|
|
47
|
+
originalTransactionDateIOS?: number;
|
|
48
|
+
originalTransactionIdentifierIOS?: string;
|
|
49
|
+
verificationResultIOS?: string;
|
|
50
|
+
transactionReasonIOS?: TransactionReason | string;
|
|
51
|
+
} & ProductPurchase;
|
|
52
|
+
export type Purchase = ProductPurchase | SubscriptionPurchase;
|
|
53
|
+
export type PurchaseResult = {
|
|
54
|
+
responseCode?: number;
|
|
55
|
+
debugMessage?: string;
|
|
56
|
+
code?: string;
|
|
57
|
+
message?: string;
|
|
58
|
+
purchaseToken?: string;
|
|
59
|
+
};
|
|
60
|
+
export declare enum ErrorCode {
|
|
61
|
+
E_UNKNOWN = "E_UNKNOWN",
|
|
62
|
+
E_USER_CANCELLED = "E_USER_CANCELLED",
|
|
63
|
+
E_USER_ERROR = "E_USER_ERROR",
|
|
64
|
+
E_ITEM_UNAVAILABLE = "E_ITEM_UNAVAILABLE",
|
|
65
|
+
E_REMOTE_ERROR = "E_REMOTE_ERROR",
|
|
66
|
+
E_NETWORK_ERROR = "E_NETWORK_ERROR",
|
|
67
|
+
E_SERVICE_ERROR = "E_SERVICE_ERROR",
|
|
68
|
+
E_RECEIPT_FAILED = "E_RECEIPT_FAILED",
|
|
69
|
+
E_RECEIPT_FINISHED_FAILED = "E_RECEIPT_FINISHED_FAILED",
|
|
70
|
+
E_NOT_PREPARED = "E_NOT_PREPARED",
|
|
71
|
+
E_NOT_ENDED = "E_NOT_ENDED",
|
|
72
|
+
E_ALREADY_OWNED = "E_ALREADY_OWNED",
|
|
73
|
+
E_DEVELOPER_ERROR = "E_DEVELOPER_ERROR",
|
|
74
|
+
E_BILLING_RESPONSE_JSON_PARSE_ERROR = "E_BILLING_RESPONSE_JSON_PARSE_ERROR",
|
|
75
|
+
E_DEFERRED_PAYMENT = "E_DEFERRED_PAYMENT",
|
|
76
|
+
E_INTERRUPTED = "E_INTERRUPTED",
|
|
77
|
+
E_IAP_NOT_AVAILABLE = "E_IAP_NOT_AVAILABLE"
|
|
78
|
+
}
|
|
79
|
+
export declare class PurchaseError implements Error {
|
|
80
|
+
name: string;
|
|
81
|
+
message: string;
|
|
82
|
+
responseCode?: number | undefined;
|
|
83
|
+
debugMessage?: string | undefined;
|
|
84
|
+
code?: ErrorCode | undefined;
|
|
85
|
+
productId?: string | undefined;
|
|
86
|
+
constructor(name: string, message: string, responseCode?: number | undefined, debugMessage?: string | undefined, code?: ErrorCode | undefined, productId?: string | undefined);
|
|
87
|
+
}
|
|
88
|
+
export {};
|
|
89
|
+
//# sourceMappingURL=ExpoIap.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExpoIap.types.d.ts","sourceRoot":"","sources":["../src/ExpoIap.types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,2BAA2B,EAC3B,+BAA+B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OAAO,EAAE,MAAM;IACf,YAAY,CAAC;IACb,YAAY,CAAC;IACb,IAAI,CAAC;IACL,SAAS,CAAC;gBALV,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,YAAY,CAAC,oBAAQ,EACrB,YAAY,CAAC,oBAAQ,EACrB,IAAI,CAAC,uBAAW,EAChB,SAAS,CAAC,oBAAQ;CAS5B"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
export var ProductType;
|
|
2
|
+
(function (ProductType) {
|
|
3
|
+
ProductType["InAppPurchase"] = "inapp";
|
|
4
|
+
ProductType["Subscription"] = "subs";
|
|
5
|
+
})(ProductType || (ProductType = {}));
|
|
6
|
+
var PurchaseStateAndroid;
|
|
7
|
+
(function (PurchaseStateAndroid) {
|
|
8
|
+
PurchaseStateAndroid[PurchaseStateAndroid["UNSPECIFIED_STATE"] = 0] = "UNSPECIFIED_STATE";
|
|
9
|
+
PurchaseStateAndroid[PurchaseStateAndroid["PURCHASED"] = 1] = "PURCHASED";
|
|
10
|
+
PurchaseStateAndroid[PurchaseStateAndroid["PENDING"] = 2] = "PENDING";
|
|
11
|
+
})(PurchaseStateAndroid || (PurchaseStateAndroid = {}));
|
|
12
|
+
var TransactionReason;
|
|
13
|
+
(function (TransactionReason) {
|
|
14
|
+
TransactionReason["PURCHASE"] = "PURCHASE";
|
|
15
|
+
TransactionReason["RENEWAL"] = "RENEWAL";
|
|
16
|
+
})(TransactionReason || (TransactionReason = {}));
|
|
17
|
+
export var ErrorCode;
|
|
18
|
+
(function (ErrorCode) {
|
|
19
|
+
ErrorCode["E_UNKNOWN"] = "E_UNKNOWN";
|
|
20
|
+
ErrorCode["E_USER_CANCELLED"] = "E_USER_CANCELLED";
|
|
21
|
+
ErrorCode["E_USER_ERROR"] = "E_USER_ERROR";
|
|
22
|
+
ErrorCode["E_ITEM_UNAVAILABLE"] = "E_ITEM_UNAVAILABLE";
|
|
23
|
+
ErrorCode["E_REMOTE_ERROR"] = "E_REMOTE_ERROR";
|
|
24
|
+
ErrorCode["E_NETWORK_ERROR"] = "E_NETWORK_ERROR";
|
|
25
|
+
ErrorCode["E_SERVICE_ERROR"] = "E_SERVICE_ERROR";
|
|
26
|
+
ErrorCode["E_RECEIPT_FAILED"] = "E_RECEIPT_FAILED";
|
|
27
|
+
ErrorCode["E_RECEIPT_FINISHED_FAILED"] = "E_RECEIPT_FINISHED_FAILED";
|
|
28
|
+
ErrorCode["E_NOT_PREPARED"] = "E_NOT_PREPARED";
|
|
29
|
+
ErrorCode["E_NOT_ENDED"] = "E_NOT_ENDED";
|
|
30
|
+
ErrorCode["E_ALREADY_OWNED"] = "E_ALREADY_OWNED";
|
|
31
|
+
ErrorCode["E_DEVELOPER_ERROR"] = "E_DEVELOPER_ERROR";
|
|
32
|
+
ErrorCode["E_BILLING_RESPONSE_JSON_PARSE_ERROR"] = "E_BILLING_RESPONSE_JSON_PARSE_ERROR";
|
|
33
|
+
ErrorCode["E_DEFERRED_PAYMENT"] = "E_DEFERRED_PAYMENT";
|
|
34
|
+
ErrorCode["E_INTERRUPTED"] = "E_INTERRUPTED";
|
|
35
|
+
ErrorCode["E_IAP_NOT_AVAILABLE"] = "E_IAP_NOT_AVAILABLE";
|
|
36
|
+
})(ErrorCode || (ErrorCode = {}));
|
|
37
|
+
export class PurchaseError {
|
|
38
|
+
name;
|
|
39
|
+
message;
|
|
40
|
+
responseCode;
|
|
41
|
+
debugMessage;
|
|
42
|
+
code;
|
|
43
|
+
productId;
|
|
44
|
+
constructor(name, message, responseCode, debugMessage, code, productId) {
|
|
45
|
+
this.name = name;
|
|
46
|
+
this.message = message;
|
|
47
|
+
this.responseCode = responseCode;
|
|
48
|
+
this.debugMessage = debugMessage;
|
|
49
|
+
this.code = code;
|
|
50
|
+
this.productId = productId;
|
|
51
|
+
this.name = '[react-native-iap]: PurchaseError';
|
|
52
|
+
this.message = message;
|
|
53
|
+
this.responseCode = responseCode;
|
|
54
|
+
this.debugMessage = debugMessage;
|
|
55
|
+
this.code = code;
|
|
56
|
+
this.productId = productId;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=ExpoIap.types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExpoIap.types.js","sourceRoot":"","sources":["../src/ExpoIap.types.ts"],"names":[],"mappings":"AAiBA,MAAM,CAAN,IAAY,WAGX;AAHD,WAAY,WAAW;IACrB,sCAAuB,CAAA;IACvB,oCAAqB,CAAA;AACvB,CAAC,EAHW,WAAW,KAAX,WAAW,QAGtB;AAUD,IAAK,oBAIJ;AAJD,WAAK,oBAAoB;IACvB,yFAAqB,CAAA;IACrB,yEAAa,CAAA;IACb,qEAAW,CAAA;AACb,CAAC,EAJI,oBAAoB,KAApB,oBAAoB,QAIxB;AA+BD,IAAK,iBAGJ;AAHD,WAAK,iBAAiB;IACpB,0CAAqB,CAAA;IACrB,wCAAmB,CAAA;AACrB,CAAC,EAHI,iBAAiB,KAAjB,iBAAiB,QAGrB;AAoBD,MAAM,CAAN,IAAY,SAkBX;AAlBD,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;AAC7C,CAAC,EAlBW,SAAS,KAAT,SAAS,QAkBpB;AAED,MAAM,OAAO,aAAa;IAEf;IACA;IACA;IACA;IACA;IACA;IANT,YACS,IAAY,EACZ,OAAe,EACf,YAAqB,EACrB,YAAqB,EACrB,IAAgB,EAChB,SAAkB;QALlB,SAAI,GAAJ,IAAI,CAAQ;QACZ,YAAO,GAAP,OAAO,CAAQ;QACf,iBAAY,GAAZ,YAAY,CAAS;QACrB,iBAAY,GAAZ,YAAY,CAAS;QACrB,SAAI,GAAJ,IAAI,CAAY;QAChB,cAAS,GAAT,SAAS,CAAS;QAEzB,IAAI,CAAC,IAAI,GAAG,mCAAmC,CAAC;QAChD,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC7B,CAAC;CACF","sourcesContent":["import {\n ProductAndroid,\n RequestPurchaseAndroidProps,\n RequestSubscriptionAndroidProps,\n SubscriptionProductAndroid,\n} from './types/ExpoIapAndroid.types';\nimport {\n ProductIos,\n RequestPurchaseIosProps,\n RequestSubscriptionIosProps,\n SubscriptionProductIos,\n} from './types/ExpoIapIos.types';\nexport type ChangeEventPayload = {\n value: string;\n};\n\nexport type Product = ProductAndroid | ProductIos;\nexport enum ProductType {\n InAppPurchase = 'inapp',\n Subscription = 'subs',\n}\n\nexport type SubscriptionProduct =\n | SubscriptionProductAndroid\n | SubscriptionProductIos;\n\nexport type RequestPurchaseProps =\n | RequestPurchaseIosProps\n | RequestPurchaseAndroidProps;\n\nenum PurchaseStateAndroid {\n UNSPECIFIED_STATE = 0,\n PURCHASED = 1,\n PENDING = 2,\n}\n\nexport type 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 verificationResultIOS?: string;\n appAccountToken?: 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};\n\nexport type RequestSubscriptionProps =\n | RequestSubscriptionAndroidProps\n | RequestSubscriptionIosProps;\n\nenum TransactionReason {\n PURCHASE = 'PURCHASE',\n RENEWAL = 'RENEWAL',\n}\n\nexport type SubscriptionPurchase = {\n autoRenewingAndroid?: boolean;\n originalTransactionDateIOS?: number;\n originalTransactionIdentifierIOS?: string;\n verificationResultIOS?: string;\n transactionReasonIOS?: TransactionReason | string;\n} & ProductPurchase;\n\nexport type Purchase = ProductPurchase | SubscriptionPurchase;\n\nexport type PurchaseResult = {\n responseCode?: number;\n debugMessage?: string;\n code?: string;\n message?: string;\n purchaseToken?: string;\n};\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}\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 ) {\n this.name = '[react-native-iap]: PurchaseError';\n this.message = message;\n this.responseCode = responseCode;\n this.debugMessage = debugMessage;\n this.code = code;\n this.productId = productId;\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExpoIapModule.d.ts","sourceRoot":"","sources":["../src/ExpoIapModule.ts"],"names":[],"mappings":";AAIA,wBAA8C"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { requireNativeModule } from 'expo-modules-core';
|
|
2
|
+
// It loads the native module object from the JSI or falls back to
|
|
3
|
+
// the bridge module (from NativeModulesProxy) if the remote debugger is on.
|
|
4
|
+
export default requireNativeModule('ExpoIap');
|
|
5
|
+
//# sourceMappingURL=ExpoIapModule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExpoIapModule.js","sourceRoot":"","sources":["../src/ExpoIapModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,mBAAmB,EAAC,MAAM,mBAAmB,CAAC;AAEtD,kEAAkE;AAClE,4EAA4E;AAC5E,eAAe,mBAAmB,CAAC,SAAS,CAAC,CAAC","sourcesContent":["import {requireNativeModule} from 'expo-modules-core';\n\n// It loads the native module object from the JSI or falls back to\n// the bridge module (from NativeModulesProxy) if the remote debugger is on.\nexport default requireNativeModule('ExpoIap');\n"]}
|
package/build/index.d.ts
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { EventEmitter } from 'expo-modules-core';
|
|
2
|
+
import { Product, ProductPurchase, Purchase, PurchaseError, PurchaseResult, RequestSubscriptionProps, SubscriptionProduct, SubscriptionPurchase } from './ExpoIap.types';
|
|
3
|
+
import { RequestPurchaseAndroidProps } from './types/ExpoIapAndroid.types';
|
|
4
|
+
import { RequestPurchaseIosProps } from './types/ExpoIapIos.types';
|
|
5
|
+
export * from './modules/android';
|
|
6
|
+
export * from './modules/ios';
|
|
7
|
+
export declare const PI: any;
|
|
8
|
+
export declare enum IapEvent {
|
|
9
|
+
PurchaseUpdated = "purchase-updated",
|
|
10
|
+
PurchaseError = "purchase-error",
|
|
11
|
+
TransactionIapUpdated = "iap-transaction-updated"
|
|
12
|
+
}
|
|
13
|
+
export declare function setValueAsync(value: string): Promise<any>;
|
|
14
|
+
export declare const emitter: EventEmitter;
|
|
15
|
+
export declare const purchaseUpdatedListener: (listener: (event: Purchase) => void) => import("expo-modules-core").Subscription;
|
|
16
|
+
export declare const purchaseErrorListener: (listener: (error: PurchaseError) => void) => import("expo-modules-core").Subscription;
|
|
17
|
+
export declare function initConnection(): any;
|
|
18
|
+
export declare const getProducts: (skus: string[]) => Promise<Product[]>;
|
|
19
|
+
export declare const getSubscriptions: (skus: string[]) => Promise<SubscriptionProduct[]>;
|
|
20
|
+
export declare function endConnection(): Promise<boolean>;
|
|
21
|
+
export declare const getPurchaseHistory: ({ alsoPublishToEventListener, automaticallyFinishRestoredTransactions, onlyIncludeActiveItems, }?: {
|
|
22
|
+
alsoPublishToEventListener?: boolean;
|
|
23
|
+
automaticallyFinishRestoredTransactions?: boolean;
|
|
24
|
+
onlyIncludeActiveItems?: boolean;
|
|
25
|
+
}) => Promise<ProductPurchase[]>;
|
|
26
|
+
export declare const getAvailablePurchases: ({ alsoPublishToEventListener, automaticallyFinishRestoredTransactions, onlyIncludeActiveItems, }?: {
|
|
27
|
+
alsoPublishToEventListener?: boolean;
|
|
28
|
+
automaticallyFinishRestoredTransactions?: boolean;
|
|
29
|
+
onlyIncludeActiveItems?: boolean;
|
|
30
|
+
}) => Promise<ProductPurchase[]>;
|
|
31
|
+
export declare const requestPurchase: (request: RequestPurchaseIosProps | RequestPurchaseAndroidProps) => Promise<ProductPurchase | ProductPurchase[] | void>;
|
|
32
|
+
export declare const requestSubscription: (request: RequestSubscriptionProps) => Promise<SubscriptionPurchase | SubscriptionPurchase[] | null | void>;
|
|
33
|
+
export declare const finishTransaction: ({ purchase, isConsumable, developerPayloadAndroid, }: {
|
|
34
|
+
purchase: Purchase;
|
|
35
|
+
isConsumable?: boolean;
|
|
36
|
+
developerPayloadAndroid?: string;
|
|
37
|
+
}) => Promise<PurchaseResult | boolean>;
|
|
38
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAqB,YAAY,EAAC,MAAM,mBAAmB,CAAC;AAGnE,OAAO,EACL,OAAO,EACP,eAAe,EAEf,QAAQ,EACR,aAAa,EACb,cAAc,EACd,wBAAwB,EACxB,mBAAmB,EACnB,oBAAoB,EACrB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAC,2BAA2B,EAAkC,MAAM,8BAA8B,CAAC;AAC1G,OAAO,EAGL,uBAAuB,EAIxB,MAAM,0BAA0B,CAAC;AAGlC,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAG9B,eAAO,MAAM,EAAE,KAAmB,CAAC;AAEnC,oBAAY,QAAQ;IAClB,eAAe,qBAAqB;IACpC,aAAa,mBAAmB;IAChC,qBAAqB,4BAA4B;CAClD;AAED,wBAAsB,aAAa,CAAC,KAAK,EAAE,MAAM,gBAEhD;AAED,eAAO,MAAM,OAAO,cAEnB,CAAC;AAEF,eAAO,MAAM,uBAAuB,aACxB,CAAC,KAAK,EAAE,QAAQ,KAAK,IAAI,6CAOpC,CAAC;AAEF,eAAO,MAAM,qBAAqB,aACtB,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,6CAGzC,CAAC;AAEF,wBAAgB,cAAc,QAE7B;AAED,eAAO,MAAM,WAAW,SAAgB,MAAM,EAAE,KAAG,QAAQ,OAAO,EAAE,CAoBnE,CAAC;AAEF,eAAO,MAAM,gBAAgB,SACrB,MAAM,EAAE,KACb,QAAQ,mBAAmB,EAAE,CAkB/B,CAAC;AAEF,wBAAsB,aAAa,IAAI,OAAO,CAAC,OAAO,CAAC,CAEtD;AAED,eAAO,MAAM,kBAAkB,sGAI5B;IACD,0BAA0B,CAAC,EAAE,OAAO,CAAC;IACrC,uCAAuC,CAAC,EAAE,OAAO,CAAC;IAClD,sBAAsB,CAAC,EAAE,OAAO,CAAC;CAClC,KAAQ,QAAQ,eAAe,EAAE,CAqB7B,CAAC;AAEN,eAAO,MAAM,qBAAqB,sGAI/B;IACD,0BAA0B,CAAC,EAAE,OAAO,CAAC;IACrC,uCAAuC,CAAC,EAAE,OAAO,CAAC;IAClD,sBAAsB,CAAC,EAAE,OAAO,CAAC;CAClC,KAAQ,QAAQ,eAAe,EAAE,CAoB7B,CAAC;AAsDN,eAAO,MAAM,eAAe,YACjB,uBAAuB,GAAG,2BAA2B,KAC7D,QAAQ,eAAe,GAAG,eAAe,EAAE,GAAG,IAAI,CA2DhD,CAAC;AAEN,eAAO,MAAM,mBAAmB,YACrB,wBAAwB,KAChC,QAAQ,oBAAoB,GAAG,oBAAoB,EAAE,GAAG,IAAI,GAAG,IAAI,CA2DjE,CAAC;AAEN,eAAO,MAAM,iBAAiB,yDAI3B;IACD,QAAQ,EAAE,QAAQ,CAAC;IACnB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,uBAAuB,CAAC,EAAE,MAAM,CAAC;CAClC,KAAG,QAAQ,cAAc,GAAG,OAAO,CAiCnC,CAAC"}
|
package/build/index.js
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
// Import the native module. On web, it will be resolved to ExpoIap.web.ts
|
|
2
|
+
// and on native platforms to ExpoIap.ts
|
|
3
|
+
import { NativeModulesProxy, EventEmitter } from 'expo-modules-core';
|
|
4
|
+
import { Platform } from 'react-native';
|
|
5
|
+
import { ProductType, } from './ExpoIap.types';
|
|
6
|
+
import ExpoIapModule from './ExpoIapModule';
|
|
7
|
+
import { isProductIos } from './modules/ios';
|
|
8
|
+
export * from './modules/android';
|
|
9
|
+
export * from './modules/ios';
|
|
10
|
+
// Get the native constant value.
|
|
11
|
+
export const PI = ExpoIapModule.PI;
|
|
12
|
+
export var IapEvent;
|
|
13
|
+
(function (IapEvent) {
|
|
14
|
+
IapEvent["PurchaseUpdated"] = "purchase-updated";
|
|
15
|
+
IapEvent["PurchaseError"] = "purchase-error";
|
|
16
|
+
IapEvent["TransactionIapUpdated"] = "iap-transaction-updated";
|
|
17
|
+
})(IapEvent || (IapEvent = {}));
|
|
18
|
+
export async function setValueAsync(value) {
|
|
19
|
+
return await ExpoIapModule.setValueAsync(value);
|
|
20
|
+
}
|
|
21
|
+
export const emitter = new EventEmitter(ExpoIapModule ?? NativeModulesProxy.ExpoIap);
|
|
22
|
+
export const purchaseUpdatedListener = (listener) => {
|
|
23
|
+
const emitterSubscription = emitter.addListener(IapEvent.PurchaseUpdated, listener);
|
|
24
|
+
return emitterSubscription;
|
|
25
|
+
};
|
|
26
|
+
export const purchaseErrorListener = (listener) => {
|
|
27
|
+
return emitter.addListener(IapEvent.PurchaseError, listener);
|
|
28
|
+
};
|
|
29
|
+
export function initConnection() {
|
|
30
|
+
return ExpoIapModule.initConnection();
|
|
31
|
+
}
|
|
32
|
+
export const getProducts = async (skus) => {
|
|
33
|
+
if (!skus?.length) {
|
|
34
|
+
return Promise.reject(new Error('"skus" is required'));
|
|
35
|
+
}
|
|
36
|
+
return Platform.select({
|
|
37
|
+
ios: async () => {
|
|
38
|
+
const items = (await ExpoIapModule.getItems(skus));
|
|
39
|
+
return items.filter((item) => isProductIos(item));
|
|
40
|
+
},
|
|
41
|
+
android: async () => {
|
|
42
|
+
const products = await ExpoIapModule.getItemsByType(ProductType.InAppPurchase, skus);
|
|
43
|
+
return products;
|
|
44
|
+
},
|
|
45
|
+
default: () => Promise.reject(new Error('Unsupported Platform')),
|
|
46
|
+
})();
|
|
47
|
+
};
|
|
48
|
+
export const getSubscriptions = async (skus) => {
|
|
49
|
+
if (!skus?.length) {
|
|
50
|
+
return Promise.reject(new Error('"skus" is required'));
|
|
51
|
+
}
|
|
52
|
+
return Platform.select({
|
|
53
|
+
ios: async () => {
|
|
54
|
+
const items = (await ExpoIapModule.getItems(skus)).filter((item) => skus.includes(item.id));
|
|
55
|
+
return items;
|
|
56
|
+
},
|
|
57
|
+
android: async () => {
|
|
58
|
+
return ExpoIapModule.getItemsByType('subs', skus);
|
|
59
|
+
},
|
|
60
|
+
default: () => Promise.reject(new Error('Unsupported Platform')),
|
|
61
|
+
})();
|
|
62
|
+
};
|
|
63
|
+
export async function endConnection() {
|
|
64
|
+
return ExpoIapModule.endConnection();
|
|
65
|
+
}
|
|
66
|
+
export const getPurchaseHistory = ({ alsoPublishToEventListener = false, automaticallyFinishRestoredTransactions = true, onlyIncludeActiveItems = false, } = {}) => (Platform.select({
|
|
67
|
+
ios: async () => {
|
|
68
|
+
return ExpoIapModule.getAvailableItems(alsoPublishToEventListener, onlyIncludeActiveItems);
|
|
69
|
+
},
|
|
70
|
+
android: async () => {
|
|
71
|
+
const products = await ExpoIapModule.getPurchaseHistoryByType(ProductType.InAppPurchase);
|
|
72
|
+
const subscriptions = await ExpoIapModule.getPurchaseHistoryByType(ProductType.Subscription);
|
|
73
|
+
return products.concat(subscriptions);
|
|
74
|
+
},
|
|
75
|
+
}) || (() => Promise.resolve([])))();
|
|
76
|
+
export const getAvailablePurchases = ({ alsoPublishToEventListener = false, automaticallyFinishRestoredTransactions = false, onlyIncludeActiveItems = true, } = {}) => (Platform.select({
|
|
77
|
+
ios: () => ExpoIapModule.getAvailableItems(alsoPublishToEventListener, onlyIncludeActiveItems),
|
|
78
|
+
android: async () => {
|
|
79
|
+
const products = await ExpoIapModule.getAvailableItemsByType(ProductType.InAppPurchase);
|
|
80
|
+
const subscriptions = await ExpoIapModule.getAvailableItemsByType(ProductType.Subscription);
|
|
81
|
+
return products.concat(subscriptions);
|
|
82
|
+
},
|
|
83
|
+
}) || (() => Promise.resolve([])))();
|
|
84
|
+
const offerToRecordIos = (offer) => {
|
|
85
|
+
if (!offer) {
|
|
86
|
+
return undefined;
|
|
87
|
+
}
|
|
88
|
+
return {
|
|
89
|
+
identifier: offer.identifier,
|
|
90
|
+
keyIdentifier: offer.keyIdentifier,
|
|
91
|
+
nonce: offer.nonce,
|
|
92
|
+
signature: offer.signature,
|
|
93
|
+
timestamp: offer.timestamp.toString(),
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
const iosTransactionToPurchaseMap = ({ id, originalPurchaseDate, productID, purchaseDate, purchasedQuantity, originalID, verificationResult, appAccountToken, jsonRepresentation, }) => {
|
|
97
|
+
let transactionReasonIOS;
|
|
98
|
+
try {
|
|
99
|
+
if (jsonRepresentation) {
|
|
100
|
+
const transactionData = JSON.parse(jsonRepresentation);
|
|
101
|
+
transactionReasonIOS = transactionData.transactionReason;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
catch (e) {
|
|
105
|
+
console.log('SK2 Error parsing jsonRepresentation', e);
|
|
106
|
+
}
|
|
107
|
+
const purchase = {
|
|
108
|
+
productId: productID,
|
|
109
|
+
transactionId: String(id),
|
|
110
|
+
transactionDate: purchaseDate, //??
|
|
111
|
+
transactionReceipt: '', // Not available
|
|
112
|
+
purchaseToken: '', //Not available
|
|
113
|
+
quantityIOS: purchasedQuantity,
|
|
114
|
+
originalTransactionDateIOS: originalPurchaseDate,
|
|
115
|
+
originalTransactionIdentifierIOS: originalID,
|
|
116
|
+
verificationResultIOS: verificationResult ?? '',
|
|
117
|
+
appAccountToken: appAccountToken ?? '',
|
|
118
|
+
transactionReasonIOS: transactionReasonIOS ?? '',
|
|
119
|
+
};
|
|
120
|
+
return purchase;
|
|
121
|
+
};
|
|
122
|
+
export const requestPurchase = (request) => (Platform.select({
|
|
123
|
+
ios: async () => {
|
|
124
|
+
if (!('sku' in request)) {
|
|
125
|
+
throw new Error('sku is required for iOS purchase');
|
|
126
|
+
}
|
|
127
|
+
const { sku, andDangerouslyFinishTransactionAutomaticallyIOS = false, appAccountToken, quantity, withOffer, } = request;
|
|
128
|
+
if (andDangerouslyFinishTransactionAutomaticallyIOS) {
|
|
129
|
+
console.warn('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.');
|
|
130
|
+
}
|
|
131
|
+
const offer = offerToRecordIos(withOffer);
|
|
132
|
+
const result = await ExpoIapModule.buyProduct(sku, andDangerouslyFinishTransactionAutomaticallyIOS, appAccountToken, quantity ?? -1, offer);
|
|
133
|
+
const purchase = iosTransactionToPurchaseMap(result);
|
|
134
|
+
return Promise.resolve(purchase);
|
|
135
|
+
},
|
|
136
|
+
android: async () => {
|
|
137
|
+
if (!('skus' in request) || !request.skus.length) {
|
|
138
|
+
throw new Error('skus is required for Android purchase');
|
|
139
|
+
}
|
|
140
|
+
const { skus, obfuscatedAccountIdAndroid, obfuscatedProfileIdAndroid, isOfferPersonalized, } = request;
|
|
141
|
+
return ExpoIapModule.buyItemByType({
|
|
142
|
+
type: ProductType.InAppPurchase,
|
|
143
|
+
skuArr: skus,
|
|
144
|
+
purchaseToken: undefined,
|
|
145
|
+
replacementMode: -1,
|
|
146
|
+
obfuscatedAccountId: obfuscatedAccountIdAndroid,
|
|
147
|
+
obfuscatedProfileId: obfuscatedProfileIdAndroid,
|
|
148
|
+
offerTokenArr: [],
|
|
149
|
+
isOfferPersonalized: isOfferPersonalized ?? false,
|
|
150
|
+
});
|
|
151
|
+
},
|
|
152
|
+
}) || Promise.resolve)();
|
|
153
|
+
export const requestSubscription = (request) => (Platform.select({
|
|
154
|
+
ios: async () => {
|
|
155
|
+
if (!('sku' in request)) {
|
|
156
|
+
throw new Error('sku is required for iOS subscriptions');
|
|
157
|
+
}
|
|
158
|
+
const { sku, andDangerouslyFinishTransactionAutomaticallyIOS = false, appAccountToken, quantity, withOffer, } = request;
|
|
159
|
+
if (andDangerouslyFinishTransactionAutomaticallyIOS) {
|
|
160
|
+
console.warn('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.');
|
|
161
|
+
}
|
|
162
|
+
const offer = offerToRecordIos(withOffer);
|
|
163
|
+
const purchase = iosTransactionToPurchaseMap(await ExpoIapModule.buyProduct(sku, andDangerouslyFinishTransactionAutomaticallyIOS, appAccountToken, quantity ?? -1, offer));
|
|
164
|
+
return Promise.resolve(purchase);
|
|
165
|
+
},
|
|
166
|
+
android: async () => {
|
|
167
|
+
console.log('requestSubscription', request);
|
|
168
|
+
const { skus, isOfferPersonalized, obfuscatedAccountIdAndroid, obfuscatedProfileIdAndroid, subscriptionOffers, replacementModeAndroid, purchaseTokenAndroid, } = request;
|
|
169
|
+
return ExpoIapModule.buyItemByType({
|
|
170
|
+
type: ProductType.Subscription,
|
|
171
|
+
skuArr: skus.map((so) => so),
|
|
172
|
+
purchaseToken: purchaseTokenAndroid,
|
|
173
|
+
replacementMode: replacementModeAndroid,
|
|
174
|
+
obfuscatedAccountId: obfuscatedAccountIdAndroid,
|
|
175
|
+
obfuscatedProfileId: obfuscatedProfileIdAndroid,
|
|
176
|
+
offerTokenArr: subscriptionOffers.map((so) => so.offerToken),
|
|
177
|
+
isOfferPersonalized: isOfferPersonalized ?? false,
|
|
178
|
+
});
|
|
179
|
+
},
|
|
180
|
+
}) || (() => Promise.resolve(null)))();
|
|
181
|
+
export const finishTransaction = ({ purchase, isConsumable, developerPayloadAndroid, }) => {
|
|
182
|
+
return (Platform.select({
|
|
183
|
+
ios: async () => {
|
|
184
|
+
const transactionId = purchase.transactionId;
|
|
185
|
+
if (!transactionId) {
|
|
186
|
+
return Promise.reject(new Error('transactionId required to finish iOS transaction'));
|
|
187
|
+
}
|
|
188
|
+
await ExpoIapModule.finishTransaction(transactionId);
|
|
189
|
+
return Promise.resolve(true);
|
|
190
|
+
},
|
|
191
|
+
android: async () => {
|
|
192
|
+
if (purchase?.purchaseToken) {
|
|
193
|
+
if (!isConsumable) {
|
|
194
|
+
return Promise.reject(new Error('purchase is not suitable to be purchased'));
|
|
195
|
+
}
|
|
196
|
+
return ExpoIapModule.consumeProduct(purchase.purchaseToken, developerPayloadAndroid);
|
|
197
|
+
}
|
|
198
|
+
return Promise.reject(new Error('purchase is not suitable to be purchased'));
|
|
199
|
+
},
|
|
200
|
+
}) || (() => Promise.reject(new Error('Unsupported Platform'))))();
|
|
201
|
+
};
|
|
202
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,wCAAwC;AACxC,OAAO,EAAC,kBAAkB,EAAE,YAAY,EAAC,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAC,QAAQ,EAAC,MAAM,cAAc,CAAC;AAEtC,OAAO,EAGL,WAAW,GAOZ,MAAM,iBAAiB,CAAC;AACzB,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAU5C,OAAO,EAAC,YAAY,EAAC,MAAM,eAAe,CAAC;AAE3C,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAE9B,iCAAiC;AACjC,MAAM,CAAC,MAAM,EAAE,GAAG,aAAa,CAAC,EAAE,CAAC;AAEnC,MAAM,CAAN,IAAY,QAIX;AAJD,WAAY,QAAQ;IAClB,gDAAoC,CAAA;IACpC,4CAAgC,CAAA;IAChC,6DAAiD,CAAA;AACnD,CAAC,EAJW,QAAQ,KAAR,QAAQ,QAInB;AAED,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,KAAa;IAC/C,OAAO,MAAM,aAAa,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;AAClD,CAAC;AAED,MAAM,CAAC,MAAM,OAAO,GAAG,IAAI,YAAY,CACrC,aAAa,IAAI,kBAAkB,CAAC,OAAO,CAC5C,CAAC;AAEF,MAAM,CAAC,MA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AAK,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAChE,EAAE,CAAC;AACN,CAAC,CAAC","sourcesContent":["// Import the native module. On web, it will be resolved to ExpoIap.web.ts\n// and on native platforms to ExpoIap.ts\nimport {NativeModulesProxy, EventEmitter} from 'expo-modules-core';\nimport {Platform} from 'react-native';\n\nimport {\n Product,\n ProductPurchase,\n ProductType,\n Purchase,\n PurchaseError,\n PurchaseResult,\n RequestSubscriptionProps,\n SubscriptionProduct,\n SubscriptionPurchase,\n} from './ExpoIap.types';\nimport ExpoIapModule from './ExpoIapModule';\nimport {RequestPurchaseAndroidProps, RequestSubscriptionAndroidProps} from './types/ExpoIapAndroid.types';\nimport {\n PaymentDiscount,\n ProductIos,\n RequestPurchaseIosProps,\n RequestSubscriptionIosProps,\n SubscriptionProductIos,\n TransactionSk2,\n} from './types/ExpoIapIos.types';\nimport {isProductIos} from './modules/ios';\n\nexport * from './modules/android';\nexport * from './modules/ios';\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 TransactionIapUpdated = 'iap-transaction-updated',\n}\n\nexport async function setValueAsync(value: string) {\n return await ExpoIapModule.setValueAsync(value);\n}\n\nexport const emitter = new EventEmitter(\n ExpoIapModule ?? NativeModulesProxy.ExpoIap,\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<PurchaseError>(IapEvent.PurchaseError, listener);\n};\n\nexport function initConnection() {\n return ExpoIapModule.initConnection();\n}\n\nexport const getProducts = async (skus: string[]): Promise<Product[]> => {\n if (!skus?.length) {\n return Promise.reject(new Error('\"skus\" is required'));\n }\n\n return Platform.select({\n ios: async () => {\n const items = (await ExpoIapModule.getItems(skus)) as ProductIos[];\n return items.filter((item: ProductIos) => isProductIos(item));\n },\n android: async () => {\n const products = await ExpoIapModule.getItemsByType(\n ProductType.InAppPurchase,\n skus,\n );\n\n return products;\n },\n default: () => Promise.reject(new Error('Unsupported Platform')),\n })();\n};\n\nexport const getSubscriptions = async (\n skus: string[],\n): Promise<SubscriptionProduct[]> => {\n if (!skus?.length) {\n return Promise.reject(new Error('\"skus\" is required'));\n }\n\n return Platform.select({\n ios: async (): Promise<SubscriptionProductIos[]> => {\n const items: SubscriptionProductIos[] = (\n (await ExpoIapModule.getItems(skus)) as SubscriptionProductIos[]\n ).filter((item: SubscriptionProductIos) => skus.includes(item.id));\n\n return items;\n },\n android: async () => {\n return ExpoIapModule.getItemsByType('subs', skus);\n },\n default: () => Promise.reject(new Error('Unsupported Platform')),\n })();\n};\n\nexport async function endConnection(): Promise<boolean> {\n return ExpoIapModule.endConnection();\n}\n\nexport const getPurchaseHistory = ({\n alsoPublishToEventListener = false,\n automaticallyFinishRestoredTransactions = true,\n onlyIncludeActiveItems = false,\n}: {\n alsoPublishToEventListener?: boolean;\n automaticallyFinishRestoredTransactions?: 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 const products = await ExpoIapModule.getPurchaseHistoryByType(\n ProductType.InAppPurchase,\n );\n\n const subscriptions = await ExpoIapModule.getPurchaseHistoryByType(\n ProductType.Subscription,\n );\n\n return products.concat(subscriptions);\n },\n }) || (() => Promise.resolve([]))\n )();\n\nexport const getAvailablePurchases = ({\n alsoPublishToEventListener = false,\n automaticallyFinishRestoredTransactions = false,\n onlyIncludeActiveItems = true,\n}: {\n alsoPublishToEventListener?: boolean;\n automaticallyFinishRestoredTransactions?: 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(\n ProductType.InAppPurchase,\n );\n\n const subscriptions = await ExpoIapModule.getAvailableItemsByType(\n ProductType.Subscription,\n );\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) {\n return undefined;\n }\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\nconst iosTransactionToPurchaseMap = ({\n id,\n originalPurchaseDate,\n productID,\n purchaseDate,\n purchasedQuantity,\n originalID,\n verificationResult,\n appAccountToken,\n jsonRepresentation,\n}: TransactionSk2): Purchase => {\n let transactionReasonIOS;\n\n try {\n if (jsonRepresentation) {\n const transactionData = JSON.parse(jsonRepresentation);\n transactionReasonIOS = transactionData.transactionReason;\n }\n } catch (e) {\n console.log('SK2 Error parsing jsonRepresentation', e);\n }\n const purchase: Purchase = {\n productId: productID,\n transactionId: String(id),\n transactionDate: purchaseDate, //??\n transactionReceipt: '', // Not available\n purchaseToken: '', //Not available\n quantityIOS: purchasedQuantity,\n originalTransactionDateIOS: originalPurchaseDate,\n originalTransactionIdentifierIOS: originalID,\n verificationResultIOS: verificationResult ?? '',\n appAccountToken: appAccountToken ?? '',\n transactionReasonIOS: transactionReasonIOS ?? '',\n };\n return purchase;\n};\n\nexport const requestPurchase = (\n request: RequestPurchaseIosProps | RequestPurchaseAndroidProps,\n): Promise<ProductPurchase | ProductPurchase[] | void> =>\n (\n Platform.select({\n ios: async () => {\n if (!('sku' in request)) {\n throw new Error('sku is required for iOS purchase');\n }\n\n const {\n sku,\n andDangerouslyFinishTransactionAutomaticallyIOS = false,\n appAccountToken,\n quantity,\n withOffer,\n } = request;\n\n if (andDangerouslyFinishTransactionAutomaticallyIOS) {\n console.warn(\n '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.',\n );\n }\n\n const offer = offerToRecordIos(withOffer);\n\n const result = await ExpoIapModule.buyProduct(\n sku,\n andDangerouslyFinishTransactionAutomaticallyIOS,\n appAccountToken,\n quantity ?? -1,\n offer,\n );\n\n const purchase = iosTransactionToPurchaseMap(result);\n return Promise.resolve(purchase);\n },\n android: async () => {\n if (!('skus' in request) || !request.skus.length) {\n throw new Error('skus is required for Android purchase');\n }\n\n const {\n skus,\n obfuscatedAccountIdAndroid,\n obfuscatedProfileIdAndroid,\n isOfferPersonalized,\n } = request;\n\n return ExpoIapModule.buyItemByType({\n type: ProductType.InAppPurchase,\n skuArr: skus,\n purchaseToken: undefined,\n replacementMode: -1,\n obfuscatedAccountId: obfuscatedAccountIdAndroid,\n obfuscatedProfileId: obfuscatedProfileIdAndroid,\n offerTokenArr: [],\n isOfferPersonalized: isOfferPersonalized ?? false,\n });\n },\n }) || Promise.resolve\n )();\n\nexport const requestSubscription = (\n request: RequestSubscriptionProps,\n): Promise<SubscriptionPurchase | SubscriptionPurchase[] | null | void> =>\n (\n Platform.select({\n ios: async () => {\n if (!('sku' in request)) {\n throw new Error('sku is required for iOS subscriptions');\n }\n\n const {\n sku,\n andDangerouslyFinishTransactionAutomaticallyIOS = false,\n appAccountToken,\n quantity,\n withOffer,\n } = request as RequestSubscriptionIosProps;\n\n if (andDangerouslyFinishTransactionAutomaticallyIOS) {\n console.warn(\n '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.',\n );\n }\n\n const offer = offerToRecordIos(withOffer);\n\n const purchase = iosTransactionToPurchaseMap(\n await ExpoIapModule.buyProduct(\n sku,\n andDangerouslyFinishTransactionAutomaticallyIOS,\n appAccountToken,\n quantity ?? -1,\n offer,\n ),\n );\n return Promise.resolve(purchase);\n },\n android: async () => {\n console.log('requestSubscription', request);\n const {\n skus,\n isOfferPersonalized,\n obfuscatedAccountIdAndroid,\n obfuscatedProfileIdAndroid,\n subscriptionOffers,\n replacementModeAndroid,\n purchaseTokenAndroid,\n } = request as RequestSubscriptionAndroidProps;\n\n return ExpoIapModule.buyItemByType({\n type: ProductType.Subscription,\n skuArr: skus.map((so) => so),\n purchaseToken: purchaseTokenAndroid,\n replacementMode: replacementModeAndroid,\n obfuscatedAccountId: obfuscatedAccountIdAndroid,\n obfuscatedProfileId: obfuscatedProfileIdAndroid,\n offerTokenArr: subscriptionOffers.map((so) => so.offerToken),\n isOfferPersonalized: isOfferPersonalized ?? false,\n });\n },\n }) || (() => Promise.resolve(null))\n )();\n\nexport const finishTransaction = ({\n purchase,\n isConsumable,\n developerPayloadAndroid,\n}: {\n purchase: Purchase;\n isConsumable?: boolean;\n developerPayloadAndroid?: string;\n}): Promise<PurchaseResult | boolean> => {\n return (\n Platform.select({\n ios: async () => {\n const transactionId = purchase.transactionId;\n\n if (!transactionId) {\n return Promise.reject(\n new Error('transactionId required to finish iOS transaction'),\n );\n }\n await ExpoIapModule.finishTransaction(transactionId);\n return Promise.resolve(true);\n },\n android: async () => {\n if (purchase?.purchaseToken) {\n if (!isConsumable) {\n return Promise.reject(\n new Error('purchase is not suitable to be purchased'),\n );\n }\n\n return ExpoIapModule.consumeProduct(\n purchase.purchaseToken,\n developerPayloadAndroid,\n );\n }\n return Promise.reject(\n new Error('purchase is not suitable to be purchased'),\n );\n },\n }) || (() => Promise.reject(new Error('Unsupported Platform')))\n )();\n};\n"]}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Product, PurchaseResult, SubscriptionProduct } from '../ExpoIap.types';
|
|
2
|
+
import { ProductAndroid, ReceiptAndroid, SubscriptionProductAndroid } from '../types/ExpoIapAndroid.types';
|
|
3
|
+
export declare function isProductAndroid(product: Product): product is ProductAndroid;
|
|
4
|
+
export declare function isSubscriptionProductAndroid(product: SubscriptionProduct): product is SubscriptionProductAndroid;
|
|
5
|
+
/**
|
|
6
|
+
* Deep link to subscriptions screen on Android.
|
|
7
|
+
* @param {string} sku The product's SKU (on Android)
|
|
8
|
+
* @returns {Promise<void>}
|
|
9
|
+
*/
|
|
10
|
+
export declare const deepLinkToSubscriptionsAndroid: ({ sku, }: {
|
|
11
|
+
sku: string;
|
|
12
|
+
}) => Promise<void>;
|
|
13
|
+
/**
|
|
14
|
+
* Validate receipt for Android. NOTE: This method is here for debugging purposes only. Including
|
|
15
|
+
* your access token in the binary you ship to users is potentially dangerous.
|
|
16
|
+
* Use server side validation instead for your production builds
|
|
17
|
+
* @param {string} packageName package name of your app.
|
|
18
|
+
* @param {string} productId product id for your in app product.
|
|
19
|
+
* @param {string} productToken token for your purchase.
|
|
20
|
+
* @param {string} accessToken accessToken from googleApis.
|
|
21
|
+
* @param {boolean} isSub whether this is subscription or inapp. `true` for subscription.
|
|
22
|
+
* @returns {Promise<object>}
|
|
23
|
+
*/
|
|
24
|
+
export declare const validateReceiptAndroid: ({ packageName, productId, productToken, accessToken, isSub, }: {
|
|
25
|
+
packageName: string;
|
|
26
|
+
productId: string;
|
|
27
|
+
productToken: string;
|
|
28
|
+
accessToken: string;
|
|
29
|
+
isSub?: boolean;
|
|
30
|
+
}) => Promise<ReceiptAndroid>;
|
|
31
|
+
/**
|
|
32
|
+
* Acknowledge a product (on Android.) No-op on iOS.
|
|
33
|
+
* @param {string} token The product's token (on Android)
|
|
34
|
+
* @returns {Promise<PurchaseResult | void>}
|
|
35
|
+
*/
|
|
36
|
+
export declare const acknowledgePurchaseAndroid: ({ token, developerPayload, }: {
|
|
37
|
+
token: string;
|
|
38
|
+
developerPayload?: string;
|
|
39
|
+
}) => Promise<PurchaseResult | boolean | void>;
|
|
40
|
+
//# sourceMappingURL=android.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"android.d.ts","sourceRoot":"","sources":["../../src/modules/android.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAC,MAAM,kBAAkB,CAAC;AAC9E,OAAO,EAAC,cAAc,EAAE,cAAc,EAAE,0BAA0B,EAAC,MAAM,+BAA+B,CAAC;AAGzG,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,IAAI,cAAc,CAE5E;AAED,wBAAgB,4BAA4B,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,IAAI,0BAA0B,CAEhH;AAED;;;;GAIG;AACH,eAAO,MAAM,8BAA8B,aAExC;IACD,GAAG,EAAE,MAAM,CAAC;CACb,KAAG,QAAQ,IAAI,CAIf,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,sBAAsB,kEAMhC;IACD,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,KAAG,QAAQ,cAAc,CAsBzB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,iCAGpC;IACD,KAAK,EAAE,MAAM,CAAC;IACd,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B,KAAG,QAAQ,cAAc,GAAG,OAAO,GAAG,IAAI,CAE1C,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { Linking } from 'react-native';
|
|
2
|
+
import ExpoIapModule from '../ExpoIapModule';
|
|
3
|
+
export function isProductAndroid(product) {
|
|
4
|
+
return product?.title !== undefined;
|
|
5
|
+
}
|
|
6
|
+
export function isSubscriptionProductAndroid(product) {
|
|
7
|
+
return product?.title !== undefined;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Deep link to subscriptions screen on Android.
|
|
11
|
+
* @param {string} sku The product's SKU (on Android)
|
|
12
|
+
* @returns {Promise<void>}
|
|
13
|
+
*/
|
|
14
|
+
export const deepLinkToSubscriptionsAndroid = async ({ sku, }) => {
|
|
15
|
+
return Linking.openURL(`https://play.google.com/store/account/subscriptions?package=${await ExpoIapModule.getPackageName()}&sku=${sku}`);
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Validate receipt for Android. NOTE: This method is here for debugging purposes only. Including
|
|
19
|
+
* your access token in the binary you ship to users is potentially dangerous.
|
|
20
|
+
* Use server side validation instead for your production builds
|
|
21
|
+
* @param {string} packageName package name of your app.
|
|
22
|
+
* @param {string} productId product id for your in app product.
|
|
23
|
+
* @param {string} productToken token for your purchase.
|
|
24
|
+
* @param {string} accessToken accessToken from googleApis.
|
|
25
|
+
* @param {boolean} isSub whether this is subscription or inapp. `true` for subscription.
|
|
26
|
+
* @returns {Promise<object>}
|
|
27
|
+
*/
|
|
28
|
+
export const validateReceiptAndroid = async ({ packageName, productId, productToken, accessToken, isSub, }) => {
|
|
29
|
+
const type = isSub ? 'subscriptions' : 'products';
|
|
30
|
+
const url = 'https://androidpublisher.googleapis.com/androidpublisher/v3/applications' +
|
|
31
|
+
`/${packageName}/purchases/${type}/${productId}` +
|
|
32
|
+
`/tokens/${productToken}?access_token=${accessToken}`;
|
|
33
|
+
const response = await fetch(url, {
|
|
34
|
+
method: 'GET',
|
|
35
|
+
headers: {
|
|
36
|
+
'Content-Type': 'application/json',
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
if (!response.ok) {
|
|
40
|
+
throw Object.assign(new Error(response.statusText), {
|
|
41
|
+
statusCode: response.status,
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
return response.json();
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* Acknowledge a product (on Android.) No-op on iOS.
|
|
48
|
+
* @param {string} token The product's token (on Android)
|
|
49
|
+
* @returns {Promise<PurchaseResult | void>}
|
|
50
|
+
*/
|
|
51
|
+
export const acknowledgePurchaseAndroid = ({ token, developerPayload, }) => {
|
|
52
|
+
return ExpoIapModule.acknowledgePurchase(token, developerPayload);
|
|
53
|
+
};
|
|
54
|
+
//# sourceMappingURL=android.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"android.js","sourceRoot":"","sources":["../../src/modules/android.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,cAAc,CAAC;AAGrC,OAAO,aAAa,MAAM,kBAAkB,CAAC;AAE7C,MAAM,UAAU,gBAAgB,CAAC,OAAgB;IAC/C,OAAQ,OAA0B,EAAE,KAAK,KAAK,SAAS,CAAC;AAC1D,CAAC;AAED,MAAM,UAAU,4BAA4B,CAAC,OAA4B;IACvE,OAAQ,OAAsC,EAAE,KAAK,KAAK,SAAS,CAAC;AACtE,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG,KAAK,EAAE,EACnD,GAAG,GAGJ,EAAiB,EAAE;IAClB,OAAO,OAAO,CAAC,OAAO,CACpB,+DAA+D,MAAM,aAAa,CAAC,cAAc,EAAE,QAAQ,GAAG,EAAE,CACjH,CAAC;AACJ,CAAC,CAAC;AAEF;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,KAAK,EAAE,EAC3C,WAAW,EACX,SAAS,EACT,YAAY,EACZ,WAAW,EACX,KAAK,GAON,EAA2B,EAAE;IAC5B,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,UAAU,CAAC;IAElD,MAAM,GAAG,GACP,0EAA0E;QAC1E,IAAI,WAAW,cAAc,IAAI,IAAI,SAAS,EAAE;QAChD,WAAW,YAAY,iBAAiB,WAAW,EAAE,CAAC;IAExD,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE;QAChC,MAAM,EAAE,KAAK;QACb,OAAO,EAAE;YACP,cAAc,EAAE,kBAAkB;SACnC;KACF,CAAC,CAAC;IAEH,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;QACjB,MAAM,MAAM,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE;YAClD,UAAU,EAAE,QAAQ,CAAC,MAAM;SAC5B,CAAC,CAAC;IACL,CAAC;IAED,OAAO,QAAQ,CAAC,IAAI,EAAE,CAAC;AACzB,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,EACzC,KAAK,EACL,gBAAgB,GAIjB,EAA4C,EAAE;IAC7C,OAAO,aAAa,CAAC,mBAAmB,CAAC,KAAK,EAAE,gBAAgB,CAAC,CAAC;AACpE,CAAC,CAAC","sourcesContent":["import {Linking} from 'react-native';\nimport {Product, PurchaseResult, SubscriptionProduct} from '../ExpoIap.types';\nimport {ProductAndroid, ReceiptAndroid, SubscriptionProductAndroid} from '../types/ExpoIapAndroid.types';\nimport ExpoIapModule from '../ExpoIapModule';\n\nexport function isProductAndroid(product: Product): product is ProductAndroid {\n return (product as ProductAndroid)?.title !== undefined;\n}\n\nexport function isSubscriptionProductAndroid(product: SubscriptionProduct): product is SubscriptionProductAndroid {\n return (product as SubscriptionProductAndroid)?.title !== undefined;\n}\n\n/**\n * Deep link to subscriptions screen on Android.\n * @param {string} sku The product's SKU (on Android)\n * @returns {Promise<void>}\n */\nexport const deepLinkToSubscriptionsAndroid = async ({\n sku,\n}: {\n sku: string;\n}): Promise<void> => {\n return Linking.openURL(\n `https://play.google.com/store/account/subscriptions?package=${await ExpoIapModule.getPackageName()}&sku=${sku}`,\n );\n};\n\n/**\n * Validate receipt for Android. NOTE: This method is here for debugging purposes only. Including\n * your access token in the binary you ship to users is potentially dangerous.\n * Use server side validation instead for your production builds\n * @param {string} packageName package name of your app.\n * @param {string} productId product id for your in app product.\n * @param {string} productToken token for your purchase.\n * @param {string} accessToken accessToken from googleApis.\n * @param {boolean} isSub whether this is subscription or inapp. `true` for subscription.\n * @returns {Promise<object>}\n */\nexport const validateReceiptAndroid = async ({\n packageName,\n productId,\n productToken,\n accessToken,\n isSub,\n}: {\n packageName: string;\n productId: string;\n productToken: string;\n accessToken: string;\n isSub?: boolean;\n}): Promise<ReceiptAndroid> => {\n const type = isSub ? 'subscriptions' : 'products';\n\n const url =\n 'https://androidpublisher.googleapis.com/androidpublisher/v3/applications' +\n `/${packageName}/purchases/${type}/${productId}` +\n `/tokens/${productToken}?access_token=${accessToken}`;\n\n const response = await fetch(url, {\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json',\n },\n });\n\n if (!response.ok) {\n throw Object.assign(new Error(response.statusText), {\n statusCode: response.status,\n });\n }\n\n return response.json();\n};\n\n/**\n * Acknowledge a product (on Android.) No-op on iOS.\n * @param {string} token The product's token (on Android)\n * @returns {Promise<PurchaseResult | void>}\n */\nexport const acknowledgePurchaseAndroid = ({\n token,\n developerPayload,\n}: {\n token: string;\n developerPayload?: string;\n}): Promise<PurchaseResult | boolean | void> => {\n return ExpoIapModule.acknowledgePurchase(token, developerPayload);\n};\n"]}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Product, PurchaseError, SubscriptionProduct } from '../ExpoIap.types';
|
|
2
|
+
import type { ProductIos, ProductStatusIos, SubscriptionProductIos, TransactionSk2 } from '../types/ExpoIapIos.types';
|
|
3
|
+
type TransactionEvent = {
|
|
4
|
+
transaction?: TransactionSk2;
|
|
5
|
+
error?: PurchaseError;
|
|
6
|
+
};
|
|
7
|
+
export declare const transactionUpdatedIos: (listener: (event: TransactionEvent) => void) => import("expo-modules-core").Subscription;
|
|
8
|
+
export declare function isProductIos(product: Product): product is ProductIos;
|
|
9
|
+
export declare function isSubscriptionProductIos(product: SubscriptionProduct): product is SubscriptionProductIos;
|
|
10
|
+
/**
|
|
11
|
+
* Sync state with Appstore (iOS only)
|
|
12
|
+
* https://developer.apple.com/documentation/storekit/appstore/3791906-sync
|
|
13
|
+
*/
|
|
14
|
+
export declare const sync: () => Promise<null>;
|
|
15
|
+
/**
|
|
16
|
+
*
|
|
17
|
+
*/
|
|
18
|
+
export declare const isEligibleForIntroOffer: (groupID: string) => Promise<boolean>;
|
|
19
|
+
/**
|
|
20
|
+
*
|
|
21
|
+
*/
|
|
22
|
+
export declare const subscriptionStatus: (sku: string) => Promise<ProductStatusIos[]>;
|
|
23
|
+
/**
|
|
24
|
+
*
|
|
25
|
+
*/
|
|
26
|
+
export declare const currentEntitlement: (sku: string) => Promise<TransactionSk2>;
|
|
27
|
+
/**
|
|
28
|
+
*
|
|
29
|
+
*/
|
|
30
|
+
export declare const latestTransaction: (sku: string) => Promise<TransactionSk2>;
|
|
31
|
+
/**
|
|
32
|
+
*
|
|
33
|
+
*/
|
|
34
|
+
type RefundRequestStatus = 'success' | 'userCancelled';
|
|
35
|
+
export declare const beginRefundRequest: (sku: string) => Promise<RefundRequestStatus>;
|
|
36
|
+
/**
|
|
37
|
+
*
|
|
38
|
+
*/
|
|
39
|
+
export declare const showManageSubscriptions: () => Promise<null>;
|
|
40
|
+
export {};
|
|
41
|
+
//# sourceMappingURL=ios.d.ts.map
|