@salarizadi/capacitor-cafebazaar-poolakey
v1.1.0
Published
A Capacitor plugin for implementing Cafebazaar in-app billing using the Poolakey library.
Downloads
7
Maintainers
Readme
@salarizadi/capacitor-cafebazaar-poolakey
A Capacitor plugin for implementing Cafebazaar (Iranian Android App Store) in-app billing using the Poolakey library.
Features
- 🔒 Secure payment integration with Cafebazaar
- 💰 Support for in-app purchases and consumables
- 🔄 Purchase verification and consumption
- 📦 Easy integration with Capacitor projects
- ⚡ Built on Poolakey library
- 🛡️ RSA signature verification support
Installation
npm install @salarizadi/capacitor-cafebazaar-poolakey
npx cap syncBasic Usage
import { CafebazaarPoolakey } from '@salarizadi/capacitor-cafebazaar-poolakey';
// OR
// const { CafebazaarPoolakey } = window.Capacitor.Plugins;
// Initialize connection
await CafebazaarPoolakey.initialize({
rsaPublicKey: 'YOUR_RSA_PUBLIC_KEY'
});
// Listen to purchase state changes
CafebazaarPoolakey.addListener('purchaseStateChanged', (state) => {
console.log('Purchase state:', state);
// state.state can be: 'PURCHASE_BEGAN', 'PURCHASED', 'CANCELLED', 'FAILED'
});
// Get products
const products = await CafebazaarPoolakey.getProducts({
skus: ['product_id_1', 'product_id_2']
});
// Make a purchase
const result = await CafebazaarPoolakey.purchaseProduct({
productId: 'product_id_1',
payload: 'developer_payload' // optional
});
// Consume the purchase
if (result.state === 'PURCHASED') {
await CafebazaarPoolakey.consumeProduct({
token: result.purchase.purchaseToken
});
}API Overview
initialize()- Connect to Cafebazaar servicegetProducts()- Get product details by SKUspurchaseProduct()- Start purchase flowconsumeProduct()- Consume purchased itemgetPurchaseInfo()- Get purchase historygetConnectionState()- Check connection statusdisconnect()- Disconnect from service
Documentation
For detailed documentation, examples, and best practices, please visit our Wiki.
Platform Support
- ✅ Android
- ❌ iOS
- ❌ Web
License
MIT License © 2025 Salar Izadi
Acknowledgments
This plugin is built using Cafebazaar's Poolakey library.
