import { inAppPurchase } from "webtonative/InAppPurchase"
inAppPurchase({
productId : ‘Product Id of IAP’,
productType : ‘Product Type of IAP’,
isConsumable : true or false,
callback : function(data){
var receiptData = data.receiptData;
if(data.isSuccess){
}
}
})
Use the productId, the one you have used while creating a product via play console.
productType will be “INAPP” for one time purchases and “SUBS” for subscriptions.
If the product is consumable you’ll need to pass isConsumable ‘true’ else ‘false’.
For one-time consumable products,
isConsumable would be ‘true’. By passing true you make sure that the user can purchase again and again.
For one-time non-consumable products, isConsumable would be ‘false’. By passing false you make sure that the user can purchase only once.
Subscription can be treated as a non-consumable product i.e. isConsumable would be ‘false’.
To query purchases made by user call following method from javascript
You can get all the purchases made by the user with active subscriptions and non-consumed one-time purchases.