capacitor-poolakey
A bridge for CafeBazaar (Android App Store) in-app-billing SDK (Poolakey) in CapacitorJs
npm install capacitor-poolakey
npx cap sync
or
yarn add capacitor-poolakey
npx cap sync
import {Poolakey} from "capacitor-poolakey";
class myClassComponent extends React.Component {
getPurchasedProducts() {
Poolakey.getPurchasedProducts().then((res) => {
console.log("Poolakey: getPurchasedProducts succeed")
console.log(res?.list)
}).catch(err => {
console.log(`Poolakey: getPurchasedProducts failed: ${err}`)
})
}
componentDidMount() {
Poolakey.connectPayment(rsaPublicKey).then(() => {
console.log("Poolakey: connected")
this.getPurchasedProducts()
}).catch(err => {
console.log(`Poolakey: failed to connect: ${err}`)
})
}
componentWillUnmount() {
Poolakey.disconnectPayment().then(() => {
console.log("Poolakey: disconnected on unmount")
}).catch(err => {
console.log(`Poolakey: failed to disconnect on unmount: ${err}`)
})
}
}
connectPayment(rsaPublicKey: string) => Promise<void>
Param |
Type |
rsaPublicKey |
string |
disconnectPayment() => Promise<void>
purchaseProduct(productId: string, payload?: string | undefined, dynamicPriceToken?: string | undefined) => Promise<PurchaseInfo>
Param |
Type |
productId |
string |
payload |
string |
dynamicPriceToken |
string |
Returns: Promise<PurchaseInfo>
subscribeProduct(productId: string, payload?: string | undefined, dynamicPriceToken?: string | undefined) => Promise<PurchaseInfo>
Param |
Type |
productId |
string |
payload |
string |
dynamicPriceToken |
string |
Returns: Promise<PurchaseInfo>
consumeProduct(purchaseToken: string) => Promise<void>
Param |
Type |
purchaseToken |
string |
getPurchasedProducts() => Promise<PurchaseInfoList>
Returns: Promise<PurchaseInfoList>
getSubscribedProducts() => Promise<PurchaseInfoList>
Returns: Promise<PurchaseInfoList>
queryPurchaseProduct(...)
queryPurchaseProduct(productId: string) => Promise<PurchaseInfo>
Param |
Type |
productId |
string |
Returns: Promise<PurchaseInfo>
querySubscribeProduct(...)
querySubscribeProduct(productId: string) => Promise<PurchaseInfo>
Param |
Type |
productId |
string |
Returns: Promise<PurchaseInfo>
getInAppSkuDetails(productIdsJson: string) => Promise<SkuDetails>
Param |
Type |
productIdsJson |
string |
Returns: Promise<SkuDetails>
getSubscriptionSkuDetails(...)
getSubscriptionSkuDetails(productIdsJson: string) => Promise<SkuDetails>
Param |
Type |
productIdsJson |
string |
Returns: Promise<SkuDetails>
Prop |
Type |
orderId |
string |
purchaseToken |
string |
developerPayload |
string |
packageName |
string |
purchaseState |
number |
purchaseTime |
number |
productId |
string |
dataSignature |
string |
Prop |
Type |
list |
PurchaseInfo[] |
Prop |
Type |
sku |
string |
title |
string |
type |
string |
price |
string |
description |
string |