Skip to content

Commit 8dd7ad9

Browse files
committed
Added missing types on updates in 3.3.0
1 parent 4b7cd41 commit 8dd7ad9

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

index.d.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,10 @@ export function buyProduct(sku: string) : Promise<ProductPurchase>;
133133
* Request a purchase
134134
*
135135
* @param {string} sku The product's sku/ID
136+
* @param {boolean} andDangerouslyFinishTransactionAutomatically 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.
136137
* @returns {Promise<string>}
137138
*/
138-
export function requestPurchase(sku: string) : Promise<string>;
139+
export function requestPurchase(sku: string, andDangerouslyFinishTransactionAutomatically?: boolean) : Promise<string>;
139140

140141
/**
141142
* Create a subscription to a sku
@@ -186,6 +187,16 @@ export function buyProductWithQuantityIOS(sku: string, quantity: number) : Promi
186187
*/
187188
export function requestPurchaseWithQuantityIOS(sku: string, quantity: number) : Promise<string>;
188189

190+
/**
191+
* Finish Transaction (iOS only)
192+
* Similar to `consumePurchaseAndroid`. Tells StoreKit that you have delivered the purchase to the user and StoreKit can now let go of the transaction.
193+
* Call this after you have persisted the purchased state to your server or local data in your app.
194+
* `react-native-iap` will continue to deliver the purchase updated events with the successful purchase until you finish the transaction. **Even after the app has relaunched.**
195+
* @param {string} transactionId The transactionId of the function that you would like to finish.
196+
* @returns {null}
197+
*/
198+
export function finishTransactionIOS(transactionId: string): void;
199+
189200
/**
190201
* Clear Transaction (iOS only)
191202
* Finish remaining transactions. Related to issue #257

index.js.flow

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,10 @@ declare module.exports: {
7676
getPurchaseHistory(): Promise<Purchase[]>,
7777
getAvailablePurchases(): Promise<Purchase[]>,
7878
buyProduct: string => Promise<ProductPurchase>,
79-
requestPurchase: string => Promise<string>,
79+
requestPurchase(
80+
sku: string,
81+
andDangerouslyFinishTransactionAutomatically: boolean,
82+
): Promise<string>,
8083
buySubscription(
8184
sku: string,
8285
oldSku?: string,
@@ -91,6 +94,7 @@ declare module.exports: {
9194
sku: string,
9295
quantity: number,
9396
): Promise<string>,
97+
finishTransactionIOS(transactionId: string): void,
9498
clearTransactionIOS(): void,
9599
clearProductsIOS(): void,
96100
acknowledgePurchaseAndroid(token: string, developerPayload?: string): Promise<PurchaseResult>,

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-iap",
3-
"version": "3.3.1",
3+
"version": "3.3.2",
44
"description": "React Native In App Purchase Module.",
55
"main": "index.js",
66
"types": "index.d.ts",

0 commit comments

Comments
 (0)