capacitor-poolakey
TypeScript icon, indicating that this package has built-in type declarations

6.0.0 • Public • Published

capacitor-poolakey NPM Version

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(...)

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

Readme

Keywords

Package Sidebar

Install

npm i capacitor-poolakey

Weekly Downloads

5

Version

6.0.0

License

MIT

Unpacked Size

73.1 kB

Total Files

27

Last publish

Collaborators

  • mhzendehpey