Skip to content

lucienbl/react-native-app-gallery-iap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

react-native-app-gallery-iap

Installation

$ yarn add react-native-app-gallery-iap

Additional steps

Make sure to read the AppGallery Documentation. The following steps are the most important ones :

  1. Configure the app
  2. Add the configuration file in android/app/agconnect-services.json
  3. Add the huawei maven repo to your project level build.gradle file :
allprojects {
    repositories {
        maven {
          url 'https://developer.huawei.com/repo/'
        }
    }
}
  1. Add the huawei maven repo to your project level build.gradle file (buildscript) :
buildscript {
    repositories {
        maven {
          url 'https://developer.huawei.com/repo/'
        }
    }
}
  1. Add the huawei classpath to the project level build.gradle file :
buildscript {
    dependencies {
        classpath('com.huawei.agconnect:agcp:1.3.1.300')
    }
}
  1. Add the following into your app level build.gradle implementations :
implementation 'com.huawei.hms:iap:4.0.4.300'
  1. Apply the plugin at the bottom of your app level build.gradle file :
apply plugin: 'com.huawei.agconnect'

Example

import AppGalleryIap, { PriceType } from "react-native-app-gallery-iap";

try {
  await AppGalleryIap.initialize(); // Initializes, if throws error AppGallery IAP is probably not supported
  await AppGalleryIap.fetchProducts(PriceType.CONSUMABLE, ["product_id_1"])); // Returns Promise<Product[]>
  await AppGalleryIap.fetchOwnedPurchases(PriceType.CONSUMABLE); // Returns Promise<any>
} catch (e) {
  throw e;
}

See index.d.ts for detailed method documentation with types.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published