iaptic-js
v1.0.4
Published
Iaptic JS integration library for the browser
Downloads
24
Maintainers
Readme
Iaptic JS
A modern TypeScript/JavaScript library for seamless integration with Iaptic's payment and subscription services, powered by Stripe. Handle one-time purchases, subscriptions, and payment management with developer-friendly APIs.
Installation
NPM (recommended)
npm install --save iaptic-js
CDN
<!-- UMD version (for direct browser use) -->
<script src="https://cdn.jsdelivr.net/npm/iaptic-js@1.0.4/dist/iaptic-js.js"></script>
<!-- ES Module version (for modern browsers) -->
<script type="module">
import { IapticJS } from 'https://cdn.jsdelivr.net/npm/iaptic-js@1.0.4/dist/iaptic-js.esm.js';
</script>
Features ✨
- ✅ Stripe integration out-of-the-box
- ✅ Type-safe TypeScript API
- ✅ Unified interface for payments & subscriptions
- ✅ Cross-platform support (Web, React Native, Node.js)
- ✅ Automatic purchase verification
Quick Start 🚀
import { IapticJS } from 'iaptic-js';
// Initialize with your Stripe credentials
const iaptic = IapticJS.createAdapter({
type: 'stripe',
appName: 'my-app', // Your application identifier
apiKey: '1234567890', // Get from Iaptic dashboard
stripePublicKey: 'pk_test_1234567890'
});
// Fetch available products
const { products, subscriptions } = await iaptic.getCatalog();
// Handle purchase flow
async function purchaseProduct(productId: string) {
try {
const result = await iaptic.order({
offerId: productId,
applicationUsername: 'user-123',
successUrl: window.location.href + '/success',
cancelUrl: window.location.href + '/cancel'
});
console.log('Purchase completed:', result);
} catch (error) {
console.error('Payment failed:', error);
}
}
Documentation 📚
Explore our comprehensive guides:
License
MIT © Iaptic