npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

react-native-aptoide-billing

v0.1.1

Published

React Native wrapper for the Aptoide Android Billing SDK

Downloads

43

Readme

react-native-aptoide-billing

React Native wrapper for the Aptoide Android Billing SDK (v1.3.0).

Android only. The Aptoide Billing SDK is an Android-specific library.


Installation

npm install react-native-aptoide-billing
# or
yarn add react-native-aptoide-billing

Android setup

The library's build.gradle already adds the Aptoide SDK dependency from Maven Central and JitPack. Make sure your root build.gradle includes:

allprojects {
  repositories {
    google()
    mavenCentral()
    maven { url "https://jitpack.io" }
  }
}

No additional AndroidManifest.xml permissions are required beyond what the Aptoide SDK itself declares.


Quick start

1. Initialize and connect (in your app entry point)

import { AptoideBilling, BillingResponseCode, ProductType } from 'react-native-aptoide-billing';

// Initialize once (e.g. in App.tsx or a service file)
AptoideBilling.initialize('YOUR_PUBLIC_KEY_FROM_APTOIDE_CONNECT');

// Start the connection
const result = await AptoideBilling.startConnection();
if (result.responseCode === BillingResponseCode.OK) {
  // Connection ready – query products and check pending purchases
  await checkPendingPurchases();
}

2. Listen for events

import { AptoideBilling } from 'react-native-aptoide-billing';
import { useEffect } from 'react';

useEffect(() => {
  const setupSub = AptoideBilling.addListener('onBillingSetupFinished', ({ billingResult }) => {
    console.log('Billing setup:', billingResult.responseCode);
  });

  const disconnectSub = AptoideBilling.addListener('onBillingServiceDisconnected', () => {
    console.warn('Billing service disconnected');
  });

  const purchasesSub = AptoideBilling.addListener('onPurchasesUpdated', ({ billingResult, purchases }) => {
    if (billingResult.responseCode === BillingResponseCode.OK) {
      for (const purchase of purchases) {
        // 1. Validate server-side
        // 2. Deliver item
        // 3. Consume
        AptoideBilling.consumePurchase(purchase.purchaseToken);
      }
    }
  });

  return () => {
    setupSub.remove();
    disconnectSub.remove();
    purchasesSub.remove();
    AptoideBilling.endConnection();
  };
}, []);

3. Query products

import { AptoideBilling, ProductType } from 'react-native-aptoide-billing';

const result = await AptoideBilling.queryProductDetails(
  ['coins_100', 'gems_500'],
  ProductType.INAPP
);

for (const product of result.productDetailsList) {
  console.log(product.title, product.oneTimePurchaseOfferDetails?.formattedPrice);
}

4. Launch a purchase

await AptoideBilling.launchBillingFlow('coins_100', ProductType.INAPP, {
  obfuscatedAccountId: 'user_abc123',   // optional, links purchase to a user
  developerPayload: 'order_xyz',         // optional, your custom payload
});
// Purchase result arrives via the 'onPurchasesUpdated' event

5. Consume a purchase

const { billingResult } = await AptoideBilling.consumePurchase(purchase.purchaseToken);
if (billingResult.responseCode === BillingResponseCode.OK) {
  // Delivery confirmed, item consumed
}

6. Query pending purchases

const { purchases } = await AptoideBilling.queryPurchases(ProductType.INAPP);
// Validate and consume any unconsumed purchases

const { purchases: subs } = await AptoideBilling.queryPurchases(ProductType.SUBS);
// Revoke access for subscriptions absent from this list

Free trials (subscriptions)

import { AptoideBilling, FeatureType, ProductType } from 'react-native-aptoide-billing';

async function startWithFreeTrial(productId: string, userId: string) {
  const freeTrialsSupported = await AptoideBilling.isFeatureSupported(FeatureType.FREE_TRIALS);
  const accountIdSupported = await AptoideBilling.isFeatureSupported(FeatureType.OBFUSCATED_ACCOUNT_ID);

  const isFreeTrial = freeTrialsSupported === 0 && accountIdSupported === 0;

  await AptoideBilling.launchBillingFlow(productId, ProductType.SUBS, {
    obfuscatedAccountId: userId,
    isFreeTrial,
  });
}

API Reference

AptoideBilling.initialize(publicKey: string): void

Initialize the billing client. Call once before startConnection().

AptoideBilling.startConnection(): Promise<BillingResult>

Connect to the Aptoide Billing service.

AptoideBilling.endConnection(): void

Disconnect and release resources.

AptoideBilling.isReady(): Promise<boolean>

Returns true when the client is connected and ready.

AptoideBilling.queryProductDetails(productIds: string[], productType: ProductType): Promise<QueryProductDetailsResult>

Fetch pricing and metadata for a list of products.

AptoideBilling.queryPurchases(productType: ProductType): Promise<QueryPurchasesResult>

Returns currently owned / active purchases.

AptoideBilling.launchBillingFlow(productId: string, productType: ProductType, options?: BillingFlowOptions): Promise<BillingResult>

Open the Aptoide purchase UI. Purchase result arrives via onPurchasesUpdated event.

| Option | Type | Description | |---|---|---| | obfuscatedAccountId | string | Links the purchase to a user. Required for free trials. | | developerPayload | string | Custom payload stored with the purchase. | | isFreeTrial | boolean | Start a free trial for a subscription. |

AptoideBilling.consumePurchase(purchaseToken: string): Promise<ConsumeResult>

Consume a purchase after validating and delivering the item.

AptoideBilling.isFeatureSupported(feature: FeatureType): Promise<number>

Returns 0 if the feature is supported.

AptoideBilling.addListener(event, listener): EmitterSubscription

Subscribe to billing events: onBillingSetupFinished, onBillingServiceDisconnected, onPurchasesUpdated.

AptoideBilling.removeAllListeners(): void

Unsubscribe all billing event listeners.


Response codes

| Code | Value | Meaning | |---|---|---| | OK | 0 | Success | | USER_CANCELED | 1 | User cancelled the purchase | | SERVICE_UNAVAILABLE | 2 | Network unavailable | | BILLING_UNAVAILABLE | 3 | Billing API version not supported | | ITEM_UNAVAILABLE | 4 | Product not available | | DEVELOPER_ERROR | 5 | Invalid arguments | | ERROR | 6 | Fatal error | | ITEM_ALREADY_OWNED | 7 | Item already purchased and not consumed | | ITEM_NOT_OWNED | 8 | Item not owned | | SERVICE_DISCONNECTED | -1 | Client not connected | | FEATURE_NOT_SUPPORTED | -2 | Feature not supported | | TOO_MANY_REQUESTS | 1429 | Rate limit exceeded – use exponential backoff |


License

MIT