6 min read

Capacitor & Cordova Plugin

Native In-App Purchases for Capacitor and Cordova Apps

A battle-tested solution for implementing in-app purchases across iOS, Android, and Windows using Capacitor, Apache Cordova, and Ionic.

Why Choose This Plugin?

🌐 Multi-Platform

  • iOS App Store
  • Google Play
  • Windows Store
  • Braintree Payments

🔒 Secure Validation

  • Iaptic server integration
  • Local receipt caching

⚡ Unified API

  • Single codebase for all platforms
  • Consistent error handling

💰 Payment Flexibility

  • Consumables & Non-consumables
  • Subscriptions
  • Custom payment amounts

🔄 Purchase Flow

sequenceDiagram
    participant App
    participant CdvPlugin
    participant AppStore
    participant IapticServer
    
    App->>CdvPlugin: Initialize products
    CdvPlugin->>AppStore: Fetch product info
    App->>CdvPlugin: Start purchase
    CdvPlugin->>AppStore: Process payment
    AppStore-->>CdvPlugin: Transaction update
    CdvPlugin->>IapticServer: Validate receipt
    IapticServer-->>CdvPlugin: Validation result
    CdvPlugin->>App: Purchase callback

⚡️ Basic Implementation

// Capacitor:
import { store, ProductType, Platform } from 'capacitor-plugin-cdv-purchase';
// Cordova:
// const { store, ProductType, Platform } = CdvPurchase;

// 1. Register products
store.register([{
  id: 'premium_monthly',
  type: ProductType.PAID_SUBSCRIPTION,
  platform: Platform.APPLE_APPSTORE
}]);

// 2. Handle purchases
store.when()
  .approved(transaction => transaction.verify())
  .verified(receipt => receipt.finish());

// 3. Initialize
store.initialize([Platform.APPLE_APPSTORE]);

// 4. Start purchase
function purchasePremium() {
  const product = store.get('premium_monthly');
  product.getOffer()?.order();
}

🚀 Getting Started

Setup with Iaptic:

Essential Resources:

Professional Support Available
Need enterprise-grade support? Contact our team for customized integration assistance.