capacitor-purchase-plugin
v0.0.5
Published
Capacitor In-App Purchases plugin
Readme
capacitor-purchase-plugin
Capacitor In-App Purchases plugin
Install
npm install capacitor-purchase-plugin
npx cap syncAPI
initialize()getProducts()purchase(...)registerProducts(...)canSubscribe(...)addListener('ANDROID-PURCHASE-RESPONSE', ...)removeAllListeners()- Interfaces
- Enums
initialize()
initialize() => Promise<void>getProducts()
getProducts() => Promise<void>purchase(...)
purchase(request: InAppPurchaseRequest) => Promise<InAppPurchaseResult | AppleTransactionResult>| Param | Type |
| ------------- | --------------------------------------------------------------------- |
| request | InAppPurchaseRequest |
Returns: Promise<InAppPurchaseResult | AppleTransactionResult>
registerProducts(...)
registerProducts(products: { products: string[]; }) => Promise<void>| Param | Type |
| -------------- | ------------------------------------ |
| products | { products: string[]; } |
canSubscribe(...)
canSubscribe(product: { productId: string; }) => Promise<void>| Param | Type |
| ------------- | ----------------------------------- |
| product | { productId: string; } |
addListener('ANDROID-PURCHASE-RESPONSE', ...)
addListener(eventName: 'ANDROID-PURCHASE-RESPONSE', listenerFunc: (response: PurchaseEvent) => void) => Promise<PluginListenerHandle>| Param | Type |
| ------------------ | ------------------------------------------------------------------------------ |
| eventName | 'ANDROID-PURCHASE-RESPONSE' |
| listenerFunc | (response: PurchaseEvent) => void |
Returns: Promise<PluginListenerHandle>
removeAllListeners()
removeAllListeners() => Promise<void>Interfaces
InAppPurchaseResult
| Prop | Type |
| ------------------ | ------------------- |
| id | string |
| originalID | string |
| productID | string |
| price | number |
| purchaseDate | number |
| currency | string |
AppleTransactionResult
| Prop | Type |
| -------------------------- | -------------------- |
| originalPurchaseDate | number |
| expirationDate | number |
| isUpgraded | boolean |
| offerID | string |
| revocationDate | number |
| revocationReason | number |
InAppPurchaseRequest
| Prop | Type |
| ---------------------- | -------------------------------------------------------- |
| productId | string |
| productType | ProductType |
| developerPayload | { serviceType: string; serviceId: string; } |
PluginListenerHandle
| Prop | Type |
| ------------ | ----------------------------------------- |
| remove | () => Promise<void> |
PurchaseEvent
| Prop | Type |
| ----------------- | ------------------- |
| id | string |
| serviceType | string |
| serviceId | string |
| productId | string |
| payload | string |
| token | string |
Enums
ProductType
| Members | Value |
| ------------------ | --------------------------- |
| ONE_TIME | 'ONE_TIME' |
| SUBSCRIPTION | 'SUBSCRIPTION' |
