0.2.0 • Published 12 months ago
capacitor-poolakey v0.2.0
capacitor-poolakey
A bridge for CafeBazaar (Android App Store) in-app-billing SDK (Poolakey) in CapacitorJs
Install
npm install capacitor-poolakey
npx cap sync
or
yarn add capacitor-poolakey
npx cap sync
Usage
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}`)
})
}
}
API
connectPayment(...)
disconnectPayment()
purchaseProduct(...)
subscribeProduct(...)
consumeProduct(...)
getPurchasedProducts()
getSubscribedProducts()
queryPurchaseProduct(...)
querySubscribeProduct(...)
getInAppSkuDetails(...)
getSubscriptionSkuDetails(...)
- Interfaces
connectPayment(...)
connectPayment(rsaPublicKey: string) => Promise<void>
Param | Type |
---|---|
rsaPublicKey | string |
disconnectPayment()
disconnectPayment() => Promise<void>
purchaseProduct(...)
purchaseProduct(productId: string, payload?: string | undefined, dynamicPriceToken?: string | undefined) => Promise<PurchaseInfo>
Param | Type |
---|---|
productId | string |
payload | string |
dynamicPriceToken | string |
Returns: Promise<PurchaseInfo>
subscribeProduct(...)
subscribeProduct(productId: string, payload?: string | undefined, dynamicPriceToken?: string | undefined) => Promise<PurchaseInfo>
Param | Type |
---|---|
productId | string |
payload | string |
dynamicPriceToken | string |
Returns: Promise<PurchaseInfo>
consumeProduct(...)
consumeProduct(purchaseToken: string) => Promise<void>
Param | Type |
---|---|
purchaseToken | string |
getPurchasedProducts()
getPurchasedProducts() => Promise<PurchaseInfoList>
Returns: Promise<PurchaseInfoList>
getSubscribedProducts()
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(...)
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>
Interfaces
PurchaseInfo
Prop | Type |
---|---|
orderId | string |
purchaseToken | string |
developerPayload | string |
packageName | string |
purchaseState | number |
purchaseTime | number |
productId | string |
dataSignature | string |
PurchaseInfoList
Prop | Type |
---|---|
list | PurchaseInfo[] |
SkuDetails
Prop | Type |
---|---|
sku | string |
title | string |
type | string |
price | string |
description | string |