# emi-indo-cordova-plugin-iap

> Cordova Plugin cordova plugin In App Purchase

Latest version **0.2.9-beta.4** (published 2025-08-20) · ISC license · 0 weekly downloads

## Install

```sh
npm install emi-indo-cordova-plugin-iap
pnpm add emi-indo-cordova-plugin-iap
yarn add emi-indo-cordova-plugin-iap
bun add emi-indo-cordova-plugin-iap
```

## Health

**Score 25/100 (F)** — status: maintenance-mode.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.9-beta.4 |
| Published | 2025-08-20 |
| First published | 2023-06-06 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 38.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | EMI INDO |
| Maintainers | emi-indo |
| Keywords | ecosystem:cordova, cordova-android, javascript, emi-indo-cordova-plugin-iap, cordova-plugin-purchase, awesome-cordova-plugins, in-app-purchase-2, cordova-purchase, construct 3 |

## Links

- npm: https://www.npmjs.com/package/emi-indo-cordova-plugin-iap
- Repository: https://github.com/EMI-INDO/emi-indo-cordova-plugin-iap
- Homepage: https://github.com/EMI-INDO/emi-indo-cordova-plugin-iap#readme
- Issues: https://github.com/EMI-INDO/emi-indo-cordova-plugin-iap/issues
- npm.io page: https://npm.io/package/emi-indo-cordova-plugin-iap

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 0.2.9-beta.4 (latest) — 2025-08-20
- 0.2.9-beta.3 — 2025-08-20
- 0.2.9-beta.2 — 2025-08-19
- 0.2.9-beta.1 — 2025-08-19
- 0.1.9 — 2025-08-16
- 0.0.9 — 2024-10-29
- 0.0.8 — 2024-07-21
- 0.0.7 — 2023-07-01
- 0.0.6 — 2023-06-26
- 0.0.5 — 2023-06-06

## README

# emi-indo-cordova-plugin-iap
 Cordova Plugin cordova plugin In App Purchase
 
 ## Support ( Consumable | Non-consumable | Subscriptions )

### SDK (billing_version = 8.0.0) [Release Notes:](https://developer.android.com/google/play/billing/release-notes)

 > __Note__
> - ## It's Not a fork, it's purely rewritten, clean of 3rd party code.

> - [Code source:](https://developer.android.com/google/play/billing/integrate)

## 💰Sponsor this project
  [![PayPal](https://img.shields.io/badge/PayPal-00457C?style=for-the-badge&logo=paypal&logoColor=white)](https://paypal.me/emiindo)  
  
  
  ## Features
  
 ###  [As per original sample:](https://developer.android.com/google/play/billing/integrate)
 
- SDK Initialize a BillingClient
- Show products available to buy
- Launch the purchase flow
- Processing purchases
- Fetching purchases
- Fetching purchase history


## Plugin Installation 

```sh
cordova plugin add emi-indo-cordova-plugin-iap
```
### Or
```sh
cordova plugin add https://github.com/EMI-INDO/emi-indo-cordova-plugin-iap
```
## Remove
```sh
cordova plugin rm emi-indo-cordova-plugin-iap
```

## Tabel Response Code = number

| Code | Description |
| :------- | :-------------------------------- |
| 0 | OK |
| 1 | USER_CANCELED |
| 2 | SERVICE_UNAVAILABLE |
| 3 | BILLING_UNAVAILABLE |
| 4 | ITEM_UNAVAILABLE |
| 5 | DEVELOPER_ERROR |
| 6 | ERROR |
| 7 | ITEM_ALREADY_OWNED |
| 8 | ITEM_NOT_OWNED |
| -1 | SERVICE_DISCONNECTED |
| -2 | FEATURE_NOT_SUPPORTED |
| 12 | NETWORK_ERROR |

## Initialize
```sh
cordova.plugins.emiInAppPurchase.initialize(

(result) => { 

  alert(result) // = 0
  
},
 (error) => { 
 
 alert(error) // = Check the table

)

```

## purchase Products
> __Note__
> - isConsumable = boolean
- if true (consumable) Products can be bought back, productType must be Non-consumable
- if false Product cannot be repurchased, productType: Non-consumable | Subscriptions

```sh
    cordova.plugins.emiInAppPurchase.purchaseProducts(
    
    productType = "Non-consumable", // string (Non-consumable | Subscriptions)
    productId = "id",
    isConsumable = true, // boolean
    title = "title",
    description = "description",
    
    (result) => { 
    
    if (result === 0){
    console.log("Give content to the user.")
    }
    alert(result) // = 0
    }
    },
    (error) => { 
    // 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -1 | -2 | 12 
   
     switch (error) {
      case 1:
      console.log("Check the table Description")
      break
      case 2:
      console.log("Check the table Description")
      break
      case 7:
      console.log("Call Restore purchase")
      break
      // and so on
     }
    // alert(error)
    
    })
   ```



##  Get Product Detail

> __Note__
> - position = String
- value = ProductId | Title | Description | Item_Price | Any 

```sh
cordova.plugins.emiInAppPurchase.getProductDetail(

    productType = "Non-consumable", // string (Non-consumable | Subscriptions)
    productId = "id",
    position = "ProductId", 
    (result) => { alert(result) },
    (error) => { alert(error)

    });
```

##  Get Purchase History

> __Note__
> - position = String
- value = Purchase_Token | Original_Json | Quantity | Signature | Developer_Payload | Products | Purchase_Time | Any

```sh
cordova.plugins.emiInAppPurchase.getPurchaseHistory(

    productType = "Non-consumable", // string (Non-consumable | Subscriptions)
    position = "Purchase_Token", 
    (result) => { alert(result) },
    (error) => { alert(error)

    });
```


##  Restore Purchases

> __Note__
> - position = String
- value = OrderId | Purchase_Token | Package_Name | Purchase_Time | Purchase_State | Quantity | Signature | Original_Json | ProductId | Any

```sh
cordova.plugins.emiInAppPurchase.restorePurchases(

    productType = "Non-consumable", // string (Non-consumable | Subscriptions)
    position = "OrderId", 
    (result) => { alert(result) },
    (error) => { alert(error)

    });
```

### Support Platform ( Android )

## Coming soon Plugin ( Store user purchase data )

- Firebase Authentication
- Firebase Realtime Database

## 💰Sponsor this project
  [![PayPal](https://img.shields.io/badge/PayPal-00457C?style=for-the-badge&logo=paypal&logoColor=white)](https://paypal.me/emiindo)

---
_Source: https://npm.io/package/emi-indo-cordova-plugin-iap · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
