forked from pedaling/react-native-in-app-purchase
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.d.ts
48 lines (36 loc) · 1.1 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
declare module "@class101/react-native-in-app-purchase" {
interface Product {
productId: string;
price: string;
currency: string;
title: string;
description: string;
iconUrl: string;
}
interface Purchase {
productIds: string[];
transactionId: string;
transactionDate: string;
receipt: string;
purchaseToken: string;
}
interface IAPError {
type: {
FETCH_PRODUCTS: "FETCH_PRODUCTS";
PURCHASE: "PURCHASE";
CONNECTION: "CONNECTION";
};
code?: number;
message: string;
}
function onFetchProducts(listener: (products: Product[]) => void): void;
function onPurchase(listener: (purchase: Purchase) => void): void;
function onError(listener: (error: IAPError) => void): void;
function clear(): void;
function configure(): Promise<boolean>;
function fetchProducts(productIds: string[]): void;
function purchase(productId: string, originalPurchaseToken?: string): void;
function restore(): void;
function finalize(purchase: Purchase, isConsumable: boolean): Promise<void>;
function flush(): Promise<Purchase[]>;
}