Skip to content

TypeScript/JavaScript library for integrating Iaptic's payments and subscription service, using Stripe as a payment provider

License

Notifications You must be signed in to change notification settings

iaptic/iaptic-js

Repository files navigation

Iaptic JS

License: MIT

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

About

TypeScript/JavaScript library for integrating Iaptic's payments and subscription service, using Stripe as a payment provider

Resources

License

Stars

Watchers

Forks

Packages

No packages published