GithubHelp home page GithubHelp logo

dooboolab-community / react-native-iap Goto Github PK

View Code? Open in Web Editor NEW
2.7K 32.0 618.0 51.92 MB

react-native native module for In App Purchase.

Home Page: https://react-native-iap.dooboolab.com

License: MIT License

Java 2.20% JavaScript 1.97% Objective-C 2.70% Ruby 1.10% TypeScript 39.51% Swift 25.44% Kotlin 26.84% Objective-C++ 0.23%
react-native amazon android appstore billing iap in-app-purchase ios playstore react-native-iap

react-native-iap's Introduction

image


Version Next Version Download Backers and Sponsors FOSSA Status


Documentation

Read the documentation. See the troubleshooting for the common issues to avoid.

Announcement

  • Version 12.0.0: Implements Amazon 3.x SDK including the new DRM verification.

  • Version 11.0.0: The module migrates OS sdk to storekit2. andresesfm is working hard on this.

    yarn add react-native-iap@next
    
  • Version 10.0.0 is a maintenance build. Many internal refactorings and clean up of the code. Special thanks to jeremybarbet for his contributions. Most notably all methods now take an object parameter instead of separate parameters. Please help us test

  • Version 9.0.0 The module migrates android sdk to play billing library v5. Our core maintainers andresesfm and jeremybarbet worked hard on this.

  • Version 8.0.0 has finally landed in Jan 28th. Since this is early release, please use it with caution ๐Ÿšง. We recommend user to use >=8.0.0 with react-native >=0.65.1. The next package is no longer updated until we organize the roadmap for 9.0.0.

  • Version 8.0.0 is currently in release candidate. The module is completely rewritten with Kotlin and Swift for maintenenance issue by andresesfm ๐Ÿ”†. You may install this for early preview.

  • React Native IAP hook is out. You can see medium post on how to use it.

  • The react-native-iap module hasn't been maintained well recently. We are thinking of participating again and make the module healthier. Please refer to 2021 Maintenance plan and share with us how you or your organization is using it. Happy new year ๐ŸŽ‰

    • The sample code is out in Sponsor page in dooboolab.com repository which sadly is rejected by Apple because of lacking product features. I will work on another example project to support this module. More information in #1241 commment.

Configuration of Play Store & App Store Connect

Example

Follow this guide to get the example running.

Sponsors

Gold Tier

NAMI

Past Sponsors

Support this project by becoming a sponsor. Your logo will show up here with a link to your website. Buy me a coffee or Become a sponsor.

Backers

Please be our Backers.

Contributing

Please make sure to read the Contributing Guide before making a pull request. Thank you to all the people who helped to maintain and upgrade this project!


FOSSA Status

react-native-iap's People

Contributors

13arturbruno avatar andresesfm avatar bang9 avatar cervebar avatar dependabot[bot] avatar doomsower avatar emilioicai avatar froelund avatar greenkeeper[bot] avatar hyochan avatar iaphub avatar ifsnow avatar jenni-divvito avatar jeremybarbet avatar jjmoon avatar jvandenaardweg avatar kjellconnelly avatar lefoy avatar linusu avatar lwansbrough avatar mars-lan avatar mkolakoglu avatar mmajk55 avatar neilco avatar renatoalencar avatar renovate[bot] avatar rinku-k avatar simontreny avatar vshab avatar wasedaigo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

react-native-iap's Issues

InAppPurchase response always is "invalid items"

Hi guys,

I have a big problem, when a test on my iphone with my variable itemSkus initialized, always get the next message:

"InAppPurchase ### didReceiveResponse :: Valid Product Count :: 0"

Never get a "valid items", even with a double checking list:

  1. Check the "Id Pack" from Itunes Connect is the same from Xcode's bundle identifier.
  2. Check the list of "Products ID" from Itunes Connect is the same from variable itemSkus = {
    ios: [ ....]}

Version of react-native-iap

0.2.17

Expected behavior

A list of valid items from itemSkus array, with the correct format JSON, by example : {price: ? , productId: ?}

Actual behavior

A list empty and a next log
"InAppPurchase ### didReceiveResponse :: Valid Product Count :: 0"

Steps to reprodue the behabior

  1. import * as RNIap from 'react-native-iap';

  2. initialized a const itemSkus = {
    ios: ['id1', 'id2' ,'id3']};

  3. Put the next snippet on componentDidMount()
    items = RNIap.getItems(itemSkus)
    3.a. Put the next snippet on custom method onPress:
    items = RNIap.getItems(itemSkus)

Implement canMakePayments for iOS

Hello.

According to Apple guidline https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/StoreKitGuide/Chapters/ShowUI.html

Display a store only if the user can make payments. To determine whether the user can make payments, call the canMakePayments class method of the SKPaymentQueue class. If the user canโ€™t make payments (for example, because of parental restrictions), either display UI indicating that that the store isnโ€™t available or omit the store portion of your UI entirely.

It would be really nice to have canMakePayments(https://developer.apple.com/documentation/storekit/skpaymentqueue/1506139-canmakepayments?language=objc) exposed to JS.

Thanks.

Cancel purchase

Hi @dooboolab!

When the user cancel the purchase i don't receive any callback. So i opened the RNIapModule.java file and checked the onPurchasesUpdated method.

public void onPurchasesUpdated(int responseCode, @Nullable List<Purchase> purchases) {
      Log.d(TAG, "Purchase Updated Listener");
      Log.d(TAG, "responseCode: " + responseCode);

      if (responseCode == 0) {
        Log.d(TAG, purchases.toString());
        if (buyItemCB != null) {
          Log.d(TAG, "return : " + purchases.get(0).getOriginalJson());
          buyItemCB.invoke(null, purchases.get(0).getOriginalJson());
          buyItemCB = null;
        }
      }
    }

Seems that it is not being validated when the user cancels the purchase, so i changed for this and now is working.

public void onPurchasesUpdated(int responseCode, @Nullable List<Purchase> purchases) {
      Log.d(TAG, "Purchase Updated Listener");
      Log.d(TAG, "responseCode: " + responseCode);
      if (responseCode == 0) {
        Log.d(TAG, purchases.toString());

        if (buyItemCB != null) {
          Log.d(TAG, "return : " + purchases.get(0).getOriginalJson());
          buyItemCB.invoke(null, purchases.get(0).getOriginalJson());
          buyItemCB = null;
        }
      } else {
        if (buyItemCB != null) {
          buyItemCB.invoke(responseCode, null);
          buyItemCB = null;
        }
      }
    }

I don't know if this is the correct way to resolve the problem, can you please verify?

Thanks!

BAD CONSUMPTION FUNCTIONALITY!!

refreshAllItems is very poorly named!! The implementation uses fetchHistory on iOS which is non-mutative operation, and uses consumeItem on Android, which destroys purchase history! This is either very bad naming, or very poor purchase flow behaviour! I'll nominate it for both!

I can't think of a single case where I'd want to immediately consume all purchased items. What I would expect is that refreshAllItems re-synchronizes the device purchase history with Google Play and the App Store (ie. getPurchases) -- this should absolutely be changed so more people don't make this mistake.

I even checked the source code to make sure I had the right idea about what was going on, but I got as far as getPurchases on the Android side and stopped reading. I didn't notice this module was automatically consuming those purchases!!

Here's my suggestion for a fix: rename refreshAllItems to refreshPurchases, and ONLY fetch the user's purchase history. Do NOT consume items automatically. Consuming behaviour is it's own flow which should be managed by the application developer, ie explicitly calling consumeItem(...) or something similar.

Android RNIapModule.getItems() method response 404 caused app crash

java.lang.NullPointerException Attempt to invoke virtual method 'java.lang.String java.lang.Object.toString()' on a null object reference 
    RNIapModule.java:134 com.reactlibrary.RNIapModule$3.onSkuDetailsResponse
    BillingClientImpl.java:404 com.android.billingclient.api.BillingClientImpl.querySkuDetailsAsync
    RNIapModule.java:129 com.reactlibrary.RNIapModule.getItems
    Method.java:-2 java.lang.reflect.Method.invoke
    JavaMethodWrapper.java:374 com.facebook.react.bridge.JavaMethodWrapper.invoke
    JavaModuleWrapper.java:162 com.facebook.react.bridge.JavaModuleWrapper.invoke
    NativeRunnable.java:-2 com.facebook.react.bridge.queue.NativeRunnable.run
    Handler.java:751 android.os.Handler.handleCallback
    Handler.java:95 android.os.Handler.dispatchMessage
    MessageQueueThreadHandler.java:31 com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage
    Looper.java:154 android.os.Looper.loop
    MessageQueueThreadImpl.java:194 com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run
    Thread.java:762 java.lang.Thread.run

Looking at the code in RNIapModule.java:

@ReactMethod
  public void getItems(String items, final Callback cb) {
    if (mService == null) {
      cb.invoke("IAP not prepared. Check if google play service is available.", null);
      return;
    }

    try {
      JSONArray jsonArray = new JSONArray(items);
      ArrayList<String> skuList = new ArrayList<> ();

      for (int i = 0; i < jsonArray.length(); i++) {
        String str = jsonArray.get(i).toString();
        skuList.add(str);
      }

      SkuDetailsParams.Builder params = SkuDetailsParams.newBuilder();
      params.setSkusList(skuList).setType(BillingClient.SkuType.INAPP);
      mBillingClient.querySkuDetailsAsync(params.build(),
          new SkuDetailsResponseListener() {
            @Override
            public void onSkuDetailsResponse(int responseCode, List<SkuDetails> skuDetailsList) {
              Log.d(TAG, "responseCode: " + responseCode);
              Log.d(TAG, skuDetailsList.toString());     

It appears that toString() method on the last line caused the crash. I believe the HTTP response was 404 Not Found based on the crash log.

RN.RNIap.buyProduct() Android Error

Version of react-native-iap

react-native: 0.54.4
react-native-iap: 0.3.5

Expected behavior

This is fabric error log
Android alpha test

Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.content.Context.getPackageName()' on a null object reference
       at android.content.ComponentName.<init>(ComponentName.java:128)
       at android.content.Intent.<init>(Intent.java:5359)
       at com.android.billingclient.api.BillingClientImpl.launchBillingFlow(BillingClientImpl.java:365)
       at com.dooboolab.RNIap.RNIapModule.buyItemByType(RNIapModule.java:272)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:374)
       at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:162)
       at com.facebook.react.bridge.queue.NativeRunnable.run(NativeRunnable.java)
       at android.os.Handler.handleCallback(Handler.java:751)
       at android.os.Handler.dispatchMessage(Handler.java:95)
       at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:31)
       at android.os.Looper.loop(Looper.java:154)
       at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:194)
       at java.lang.Thread.run(Thread.java:762)

Actual behavior

onPressByProduct = async(productId) => {
    try {
      const purchase = await RNIap.buyProduct(productId)
    } catch (err) {
      Alert.alert(err.message)
    }
  }

Steps to reprodue the behabior

In my case getProducts success.
I get an error when I run buyProduct.

Help with documentation and crash after purchrase

Version of react-native-iap

0.2.16

I'm not an Android or IOs developer and I'm starting now with the purchase system. Among all libraries for react native yours seems the only one with cross platform support and subscription. Thanks for your amazing job.

My questions following:

  1. Is there anything bad in checking the subscription status every time the app loads?

  2. What's the difference between "refreshAllItems" and "getSubscribeItems"? It seems (from the description) they do the same but in the description is unclear

  3. What's the difference between buyItem and buySubscriptionItem?

  4. I'm currently testing by releasing alpha version, I tried in many ways to deploy with android a dev version but seems impossible (by design), there's very little on react native, a guide would be amazing (but I understand you already have done a great job)

  5. The app crash after purchase (the subscription is there after), I don't see anything wrong and the catch should prevent the app from crashing (but I notice in a few scenario it doesn't). I'm on Android

  async subscribe() {
    this.log("subscribe called")
    try {
      const isOS = Platform.OS === 'ios'
      const subscriptionName = isOS ? 'com.cooni.monthly' : 'monthly'
      this.log("attempting to subscribe")
      const receipt = await RNIap.buyItem(subscriptionName)
      this.log("receipt")
      this.log(receipt)
    } catch(e) {
      this.log("bought")
      this.log(e)
    }
  }

Displays login dialog each time application is started

I just fetched getProducts, bought products buyProduct and everything was successful. Since first purchase each time I launch application I see login dialog to my account (iOS platform). I am using 0.3.0-alpha1 but I had this problem earlier at 0.2.*. What am I doing wrong? Code was inspired by example app.

Play with subscriptions

Version of react-native-iap

2.17

I need to deal with both in app and subscriptions (on both android & iOS).
I've created 1 inapp and 1 subscription on the google play console :
Let's say their ids are : com.test.inapp & com.test.subscription

When I call
RNIap.getItems({ android: ['com.test.inapp', 'com.test.subscription' ]});
I only get com.test.inapp as a result.

I guess it's because com.test.subscription is a subscription product?

In the doc there are two methods:
image

getSubscribeItems is maybe the method to get the subscription items, but weird, it takes a String as argument.

When I call it this way:
RNIap.getSubscribeItems("com.test.subscription")
I got this error: "android items are not defined. It should be defined inside param like items.android."

I'm a little confused with this method because in issue #54 getItem() seems to be used even for subscription product.

Any thought on how to get my subscription item?

Thanks for your help :)

Android app crashes randomly

Version of react-native-iap

0.2.17

Platforms you faced the error (IOS or Android or both?)

Android

Expected behavior

No crashing

Actual behavior

App crashes randomly for some users

Steps to reprodue the behabior

It only happened once for me and was quite random. But a crash ocurred for 40% of my users. I have a Crashlytics stacktrace for you
13f9384c-3d7e-4c19-92d0-aaf4384c97a9

Iโ€™m not 100% certain the crash is causes by this plugin but it seems likeit from the stacktrace.

Is it a version thing? Should I update to the latest?

Android: Incorrect RNIapPackage import with react-native link

Version of react-native-iap

0.2.15
react-native: 0.53.3

Expected behavior

react-native link react-native-iap should update MainApplication.java and android/app/build.gradle correctly

Actual behavior

link adds MainApplication.java
import com.dooboolab.RNIap.RNIapPackage;
it should be: com.reactlibrary.RNIapPackage

Also:
compile project(':react-native-iap') is not updated to android/app/build.gradle, it have to be done by hand.

Thank you very much for the component, not yet fully in use but seems very useful.

Building on Android

Hey Great Project, I am however getting an error when i attempt to build the project:

MainApplication.java:6: error: cannot find symbol
import com.dooboolab.RNIap.RNIapPackage;
                          ^
  symbol:   class RNIapPackage
  location: package com.dooboolab.RNIap
MainApplication.java:29: error: cannot find symbol
            new RNIapPackage(),
                ^
  symbol: class RNIapPackage
2 errors
:app:compileReleaseJavaWithJavac FAILED

I have run react-native link and it was successful I have checked all the various android files where native components usually need to be referenced.

Any Ideas? Or any further information I could supply you with?

getProducts always returns an empty array on iOS

Version of react-native-iap

0.3.0-beta5

Expected behavior

Should return an array of purchasable products just like in Android.

Actual behavior

Returns an empty array.

Steps to reproduce the behavior

var purchase_ids = {
  ios: [
    'pro'
  ],
  android: [
    'pro'
  ]
};

return RNIap.prepare()
  .then(() => RNIap.getProducts(Platform.select(purchase_ids)))
  .then(items => {
    if (__DEV__) console.log('RNIap Products:', items);
  });

Yes I do have the in app purchases set up in iTunes Connect:

screen shot 2018-04-03 at 10 08 46 am

And again, this works perfect on Android.

Android force close when skuDetailList is no there due to invalid HTTP response on getItems()

Version of react-native-iap

0.2.13

Expected behavior

getItems() should be able handle no skuDetailList

Actual behavior

getItems() resulted in forced close when getItems() with no skuDetailList.

Steps to reprodue the behabior

getItems() encountered HTTP error with no skuDetailList .

It looks like we need more robust handling of the error when Android getItems() encounters HTTP error response. I suggest that we return an reject with some kind of generic error message when skuDetailList is not there.

Looking through the latest master, it seemed that this error might be fixed.

If that's the case, you can close out this issue

Here is the JAVA NullPointerException error. Error is at RNIapModule.java 137 below:

java.lang.NullPointerException ยท Attempt to invoke interface method 'java.util.Iterator java.util.List.iterator()' on a null object reference
RNIapModule.java:137 com.reactlibrary.RNIapModule$3.onSkuDetailsResponse	
BillingClientImpl.java:404 com.android.billingclient.api.BillingClientImpl.querySkuDetailsAsync	
RNIapModule.java:128 com.reactlibrary.RNIapModule.getItems	
Method.java:-2 java.lang.reflect.Method.invoke	
JavaMethodWrapper.java:374 com.facebook.react.bridge.JavaMethodWrapper.invoke	
JavaModuleWrapper.java:162 com.facebook.react.bridge.JavaModuleWrapper.invoke	
NativeRunnable.java:-2 com.facebook.react.bridge.queue.NativeRunnable.run	
Handler.java:751 android.os.Handler.handleCallback	
Handler.java:95 android.os.Handler.dispatchMessage	
MessageQueueThreadHandler.java:31 com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage	
Looper.java:154 android.os.Looper.loop	
MessageQueueThreadImpl.java:194 com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run	
Thread.java:761 java.lang.Thread.run

getAvailablePurchases() returns empty array

Version of react-native-iap

0.3.10

Platforms you faced the error (IOS or Android or both?)

iOS, did not tried on Android yet

Expected behavior

Get all the unconsumed purchases.

Actual behavior

I get []

Steps to reproduce the behavior

on iOS buy some consumable items. Try to buy again, it says these are already bought, so restoring.
Trying to get getAvailablePurchases() to be able to consume that will give an empty array.

InApp Purchase error

I got this error from logs :

TypeError: undefined is not an object (evaluating 'RNIapIos.fetchProducts')

and thus can't guess what is the issue with that.

Any idea? Thanks.

Android getItems returns empty array

Version of react-native-iap

0.2.17

Expected behaviour

To return the array populated with four in-app purchases with are active on Google Play (my app is published in alpha release)

Actual behaviour

returns: []

Steps to reproduce the behaviour

This is a snippet from my code:

let platformProducts = {
  ios: products,
  android: products
}

export function getInAppPurchases(){
  return (dispatch, getState) => {
    if(Platform.OS == 'ios'){
      getItems(dispatch)
    }
    else if(Platform.OS == 'android'){
      RNIap.prepareAndroid().then(() => {
        console.log('prepared, continue')
        getItems(dispatch)
      }).catch((error) => {
        console.log('Prepare error:', error)
      })
    }
  }
  async function getItems(dispatch){
    try {
      console.log('start getItems:', platformProducts)
      const items = await RNIap.getItems(platformProducts)
      console.log('got items:', items)
      dispatch({ type: 'GOT_PRODUCTS', products: items })
    }
    catch(error) {
      console.log('Some error:', error)
    }
  }
}

Here's the log output:
screen shot 2018-03-26 at 18 34 52

Here are the in-app purchases on Google Play:
screen shot 2018-03-26 at 18 38 41

Error getAvailablePurchases()

Version of react-native-iap 0.3.0-beta5

Expected behavior Receive list of user's purchases

Actual behavior Receive next Error:

{
framesToPop:1,
code: E_NOT_PREPARED,
line:135,
column:4004,
sourceURL:"index.android.bundle"
}

Steps to reprodue the behabior

try {
const purchases = await RNIap.getAvailablePurchases();
let purchase = '';
purchases.forEach(p => {
if (p.productId === PREMIUM_ANDROID_SUBSCRIBE_ID) {
purchase = PURCHASED;
}
});
return purchase;
} catch (err) {
showAlert('ERROR getAndroidPurchases', JSON.stringify(err));
return '';
}
};

ItemSKUs

Hi!,

I have a question regarding the ItemSKUs.

In the docs i found:

const itemSkus = { ios: [ 'com.cooni.point1000', 'com.cooni.point5000', ], android: [ 'point_1000', '5000_point', ], };

In itunes-connect I only got a SKU for my app, not for products i created.

Is there any information about how to get the SKU for a product (only productid is available in iTunes-connet)?

for fast, how about use the api "SKPayment.paymentWithProductIdentifier(product_ID)" instead of "SKPayment.paymentWithProduct(theProd)" ?

Version of react-native-iap

:^0.2.14

Expected behavior

the purchase is very very slow ! i want to make it faster !

why don't you use the api "SKPayment.paymentWithProductIdentifier(product_ID)" ?

i don't want to check the product_id in the validProducts (without fetchProducts).

`

for (int k = 0; k < validProducts.count; k++) {
        SKProduct *theProd = [validProducts objectAtIndex:k];
        if ([productID isEqualToString:theProd.productIdentifier]) {
            NSLog(@"\n\n\n Obj c >> InAppPurchase  :: purchaseItem :: Product Found  \n\n\n.");
            SKPayment *payment = [SKPayment paymentWithProduct:theProd];       **//it's too slow !**
            [[SKPaymentQueue defaultQueue] addPayment:payment];
            return;
        }
}

No valid Product returned !!

I have the error "No valid Product returned !!" after getItems. Any idea of what could be the causes ?

Thanks a lot for the lib

prepareAndroid

To simplify things, prepareAndroid should be called and ignored, with and then run the promise for ios devices. Currently, on ios, prepareAndroid does nothing, and crashes on attempted promise.

// crash on ios
RNIap.prepareAndroid().then(message=>{
    // call get items function
}).catch(error=>{
    // handle error
})

Instead, I had to write conditional code

// works, but extra unneeded code
if (Platform.OS == 'ios') {
    // call get items function
    return
}

RNIap.prepareAndroid().then(message=>{
    // call get items function
}).catch(error=>{
    // handle error
})

Could you make it so ios still handles the promise?

RNIap.getProducts() not working

Version of react-native-iap

0.3.5

Error

Error: An unknown or unexpected error has occured. Please try again later.
    at createErrorFromErrorData (NativeModules.js:123)
    at NativeModules.js:80
    at MessageQueue.__invokeCallback (MessageQueue.js:400)
    at MessageQueue.js:139
    at MessageQueue.__guardSafe (MessageQueue.js:316)
    at MessageQueue.invokeCallbackAndReturnFlushedQueue (MessageQueue.js:138)
    at debuggerWorker.js:72
04-11 15:09:26.313 18588 18660 D ClClient: Not sending keepalive.  Current connection state=STOPPED

04-11 15:09:26.686 12469 21315 E Auth    : [GoogleAccountDataServiceImpl] getToken() -> BAD_AUTHENTICATION. Account: <ELLIDED:-55277692>, App: com.google.android.gms, Service: oauth2:https://www.googleapis.com/auth/contextcontroller
04-11 15:09:26.686 12469 21315 E Auth    : fgc: Long live credential not available.
04-11 15:09:26.686 12469 21315 E Auth    : 	at fgd.b(com.google.android.gms@[email protected] (448-188803320):20)
04-11 15:09:26.686 12469 21315 E Auth    : 	at fgd.a(com.google.android.gms@[email protected] (448-188803320):50)
04-11 15:09:26.686 12469 21315 E Auth    : 	at fen.a(com.google.android.gms@[email protected] (448-188803320):35)
04-11 15:09:26.686 12469 21315 E Auth    : 	at guq.a(com.google.android.gms@[email protected] (448-188803320):8)
04-11 15:09:26.686 12469 21315 E Auth    : 	at guq.a(com.google.android.gms@[email protected] (448-188803320):155)
04-11 15:09:26.686 12469 21315 E Auth    : 	at gtq.a(com.google.android.gms@[email protected] (448-188803320):2)
04-11 15:09:26.686 12469 21315 E Auth    : 	at gtn.a(com.google.android.gms@[email protected] (448-188803320):17)
04-11 15:09:26.686 12469 21315 E Auth    : 	at gtn.a(com.google.android.gms@[email protected] (448-188803320):6)
04-11 15:09:26.686 12469 21315 E Auth    : 	at cpy.a(com.google.android.gms@[email protected] (448-188803320):25)
04-11 15:09:26.686 12469 21315 E Auth    : 	at cpy.a(com.google.android.gms@[email protected] (448-188803320):80)
04-11 15:09:26.686 12469 21315 E Auth    : 	at fbk.a(com.google.android.gms@[email protected] (448-188803320):6)
04-11 15:09:26.686 12469 21315 E Auth    : 	at fbj.a(com.google.android.gms@[email protected] (448-188803320):2)
04-11 15:09:26.686 12469 21315 E Auth    : 	at fbj.e(com.google.android.gms@[email protected] (448-188803320):6)
04-11 15:09:26.686 12469 21315 E Auth    : 	at fbj.d(com.google.android.gms@[email protected] (448-188803320):1)
04-11 15:09:26.686 12469 21315 E Auth    : 	at fbh.b(com.google.android.gms@[email protected] (448-188803320):1)
04-11 15:09:26.686 12469 21315 E Auth    : 	at ndx.a(com.google.android.gms@[email protected] (448-188803320):1)
04-11 15:09:26.686 12469 21315 E Auth    : 	at nck.a(com.google.android.gms@[email protected] (448-188803320):3)
04-11 15:09:26.686 12469 21315 E Auth    : 	at dhu.a(com.google.android.gms@[email protected] (448-188803320):54)
04-11 15:09:26.686 12469 21315 E Auth    : 	at ddb.run(com.google.android.gms@[email protected] (448-188803320):2)
04-11 15:09:26.686 12469 21315 E Auth    : 	at dcz.handleMessage(com.google.android.gms@[email protected] (448-188803320):3)
04-11 15:09:26.686 12469 21315 E Auth    : 	at niy.run(com.google.android.gms@[email protected] (448-188803320):6)
04-11 15:09:26.686 12469 21315 E Auth    : 	at njk.run(com.google.android.gms@[email protected] (448-188803320):26)
04-11 15:09:26.686 12469 21315 E Auth    : 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
04-11 15:09:26.686 12469 21315 E Auth    : 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
04-11 15:09:26.686 12469 21315 E Auth    : 	at npg.run(com.google.android.gms@[email protected] (448-188803320))
04-11 15:09:26.686 12469 21315 E Auth    : 	at java.lang.Thread.run(Thread.java:760)

04-11 15:09:26.706 12469 21315 W Auth    : [GoogleAuthUtil] GoogleAuthUtil

My Scripts

const itemSkus = Platform.select({
  ios: [
    // 'point_1000',
  ],
  android: [
    'android.test.purchased',
    'android.test.canceled',
  ],
});
try {
        // const items = await RNIap.getItems(someSkus); itemSkus
        const items = await RNIap.getProducts(itemSkus);
        // console.log('items: ' + typeof (items));
        console.log('getItems');
        console.log(items); // , JSON.stringify(items));
        // [ {price: 2.19, productId: "react.iap.consum.1000"},   //   iOS result...
        //   {price: 1.09, productId: "react.iap.consum.500"}  ]
        this.setState({ productList: items });
    } catch (err) {
        console.log('err');
        console.log(err);
    }

[ANDROID] Subscription keep being here wherease it has been canceled

Version of react-native-iap

0.3.0-beta3

Expected behavior

if a subscription is canceled, it shouldn't appear anymore when calling: getAvailablePurchases()

Actual behavior

When calling getAvailablePurchases I keep receiving a subscription I previously canceled (and not present in the google play store anymore

Steps to reprodue the behabior

Prepare android
getProducts()
getSubscription()
checkSubscription( itembundleid )

Buy a subscription.
Go to the google play store > Subscriptions > (My app) Manage > Cancel > OK
Close the app and restart

Receiving:
[InApp] checkSubscription :: [{"autoRenewing":false,"purchaseToken":"tokeniiiiiiiddddddd","transactionReceipt":"receiptiiiiiiddddd","transactionDate":"1522356975806","transactionId":"transactioniiiiiiddddd","productId":"com.myapp.subscription"}]

Note: it worked the first time but not the second one.
I've tried to uninstall / install the app again and restart exp.

Android ExpoKit: undefined is not an object (evaluating 'RNIapModule.prepare')

Version of react-native-iap

0.2.14

Expected behavior

RNIap.prepareAndroid() prepares android

Actual behavior

Errors out with undefined is not an object (evaluating 'RNIapModule.prepare')

Steps to reproduce the behavior

Running RNIap.prepareAndroid(). I tried creating a fresh-from-scratch ExpoKit project to duplicate the issue, and it actually worked just fine. I've tried a variety of approaches including:

  • Delete and reinstall node_modules
  • Triple checked the manual installation steps with my build
  • It works on iOS

I'm completely confused.

Do we really need SDK version 26?

Looks like I can't build my app on Android without SDK version 26 (Oreo) using this repo. Is it really needed to be that high? According to a recent blog post I read, only 0.5% of Android users have Oreo or above. And since IAPs have been out since... idk a long time, it doesn't seem like we would need v26.

Nevertheless, I am pretty much a noob when it comes to Android, so maybe someone could answer this question better than I can guess at and make the fix (if plausible).

Not sure if it just needs a number tweak in android/build.gradle or not...

android {
  compileSdkVersion 26
  buildToolsVersion "26.0.2"
  ...
}

refreshAllItems() (android)

I know that this function shouldn't work all the way when using the emulator, but for testing purposes, it seems it should call the catch function. Not sure if it doesn't work on both emulator and real device, but it doesn't work on emulator it seems.

async function restore() {
  try {
    const results = await RNIap.refreshAllItems()
    alert("Got results")
   } catch(error) {
        // this gets called on ios physical devices, but not android emulator
   }
}

This function never ends since it is indefinitely waiting for results or an exception.

Can't receive the receipt

Hi!

I'm having a problem when i buy a item. Everything works great, i can prepare the function, load the products from the store but when i purchase the item, i can't receive the receipt, doesn't show anything. This is the code i'm using when trying to buy:

RNIap.buyItem(productId).then(receipt => {
    alert(JSON.stringify(receipt));
}).catch(error => {
    alert(JSON.stringify(error))
});

The purchase works because i receive the email from google and in the android studio i can see the purchase:

Image

Thanks for the great work!

Pod install fails due to empty description in package.json

Version of react-native-iap

  • react-native-iap 0.3.0-beta3
  • cocoapods 1.4.0

Expected behavior

pod install completes without any errors

Actual behavior

pod install fails because description in package.json is empty.

Fetching podspec for `RNIap` from `../node_modules/react-native-iap`
[!] The `RNIap` pod failed to validate due to 1 error:
    - WARN  | source: The version should be included in the Git tag.
    - ERROR | description: The description is empty.

Steps to reprodue the behavior

  • npm install react-native-iap --save
  • react-native link react-native-iap
  • cd ios
  • pod install

Signature missing from Android purchase.

Hi!

I need to validate purchases from the backend, but I'm missing signature on the purchase.

The Purchase class com.android.billingclient.api.Purchase already contains the signature, but it needs to be passed in the response.

Force Close after Buy Item android.item.canceled

Version of react-native-iap

^0.2.17

After i testing to buy item android.item.canceled. My Apps is force close.
Would you like to fixing them?

This is log when apps force close

03-14 10:12:44.340 1497 13372 D ActivityTrigger: ActivityTrigger activityPauseTrigger 03-14 10:12:44.341 3353 3353 W BillingHelper: Couldn't find purchase lists, trying to find single data. 03-14 10:12:44.341 3353 3353 W BillingHelper: Received a bad purchase data. 03-14 10:12:44.342 3353 3353 W BillingHelper: Couldn't find single purchase data as well. 03-14 10:12:44.342 3353 3353 D RNIapModule: Purchase Updated Listener 03-14 10:12:44.342 3353 3353 D RNIapModule: responseCode: 0 03-14 10:12:44.343 3353 3353 D AndroidRuntime: Shutting down VM 03-14 10:12:44.343 3353 3353 E AndroidRuntime: FATAL EXCEPTION: main 03-14 10:12:44.343 3353 3353 E AndroidRuntime: Process: com.lelangapps, PID: 3353 03-14 10:12:44.343 3353 3353 E AndroidRuntime: java.lang.NullPointerException: Attempt to invoke interface method 'java.lang.Object java.util.List.get(int)' on a null object reference 03-14 10:12:44.343 3353 3353 E AndroidRuntime: at com.dooboolab.RNIap.RNIapModule$8.onPurchasesUpdated(RNIapModule.java:422) 03-14 10:12:44.343 3353 3353 E AndroidRuntime: at com.android.billingclient.api.BillingClientImpl$1.onReceive(BillingClientImpl.java:136) 03-14 10:12:44.343 3353 3353 E AndroidRuntime: at com.android.billingclient.api.LocalBroadcastManager.executePendingBroadcasts(LocalBroadcastManager.java:303) 03-14 10:12:44.343 3353 3353 E AndroidRuntime: at com.android.billingclient.api.LocalBroadcastManager.access$000(LocalBroadcastManager.java:44) 03-14 10:12:44.343 3353 3353 E AndroidRuntime: at com.android.billingclient.api.LocalBroadcastManager$1.handleMessage(LocalBroadcastManager.java:114) 03-14 10:12:44.343 3353 3353 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:102) 03-14 10:12:44.343 3353 3353 E AndroidRuntime: at android.os.Looper.loop(Looper.java:163) 03-14 10:12:44.343 3353 3353 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:6321) 03-14 10:12:44.343 3353 3353 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method) 03-14 10:12:44.343 3353 3353 E AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:880) 03-14 10:12:44.343 3353 3353 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:770) 03-14 10:12:44.344 1810 1810 V PhoneStatusBarPolicy: updateManagedProfile mManagedProfileFocused: false mManagedProfileInQuietMode: false mKeyguardVisible: false mCurrentUserId:0 mCurrentProfileId:0 mSecondSpaceStatusIconVisible: true showIcon:false 03-14 10:12:44.344 1810 1810 D EventBus: [1810, u0] send(AppTransitionFinishedEvent) 03-14 10:12:44.344 1810 1810 D EventBus: [1810, u0] -> ForcedResizableInfoActivityController [0x3c261e4, P1] onBusEvent(AppTransitionFinishedEvent) 03-14 10:12:44.344 1810 1810 D EventBus: [1810, u0] onBusEvent(AppTransitionFinishedEvent) duration: 21 microseconds, avg: 1131

Installation in Cocoapods project

I'm building an ejected Expo app which uses cocoapods in the xcode project. To install the IAP component, I followed the manual install. When I add the link to libRNIap.a, the build fails with the error:

'React/RCTDefines.h' file not found

Is there a way to install using cocoapods or can you help me figure out how to get around this issue?

Thanks!

IAP subscription purchase error.

Version of react-native-iap

Latest

Expected behavior

data

Actual behavior

Error

Steps to reprodue the behabior

Well in my case, Install -> manual merge -> then this code

try {
//also tried RNIap.getSubscriptions().then((data) => ....);
    RNIap.getProducts().then((item_receipt) => {
                    console.log(item_receipt);
    }).catch(err => alert('errror :' + err))
} catch (err) {
alert('errror :' + err);
}

Error message: Type Error Cannot read property of getitems of undefined.

[iOS] Apple reject app : Guideline 3.1.1 - Business - Payments - In-App Purchase

Version of react-native-iap

0.3.0-beta3

Expected behavior

Pass through Apple App Store validation

Actual behavior

Apple keep rejecting the app invoking Guideline 3.1.1 - Business - Payments - In-App Purchase

We found that your app offers in-app purchases that can be restored but does not include a "Restore Purchases" feature to allow users to restore the previously purchased in-app purchases, as specified in the "Restoring Purchase Products" section of the In-App Purchase Programming Guide:

"Users restore transactions to maintain access to content they've already purchased. For example, when they upgrade to a new phone, they don't lose all of the items they purchased on the old phone. Include some mechanism in your app to let the user restore their purchases, such as a Restore Purchases button."

To restore previously purchased in-app purchase products, it would be appropriate to provide a "Restore" button and initiate the restore process when the "Restore" button is tapped by the user.

We only use consumable products (we don't even have other products set in itunes connect.

Steps to reprodue the behabior

Submit an app with inapp purchase and subscription and you might be rejected as we are.

Note: Interesting post that can help us out: https://forums.developer.apple.com/thread/78759

[Android] RNIapModule.prepare got 0 argument, expected 1

Version of react-native-iap

0.3.0-beta3

Expected behavior

Expected to work on production.

Actual behavior

It works fine when testing localy, but when testing in production (beta channel) I got this error when first starting the app.
image

When trying to get the list of products I get this error:
image

Steps to reprodue the behabior

Package in release mode, upload in the beta channel and test.

It works when I test using a unsigned build on Android and exp start
But it doesn't when testing on beta channel (after exp publish).
Note that it used to work before using the 0.3.0.

Any tips or thought on this?

Can you add introductory price?

Your awesome package is well used.
I need introductory price infomation.
Can you add introductory price?

getIntroductoryPrice()
getIntroductoryPriceCycles()
getIntroductoryPricePeriod()

CONTRIBUTING.md and LICENSE is needed

Thanks you maintainers for your awesome work ๐Ÿ‘
This would be helpful to someone like me who's not familiar with android/ios native.

It would be better if there's some guideline for contributors like CONTRIBUTING.md.
Also LICENSE, what charges to use this in my project?

[iOS] promisesByKey is not thread-safe

Version of react-native-iap

0.3.0-beta3

Expected behavior

This dictionary can be accessed by multiple threads at the same time

Actual behavior

This dictionary crashes when accessed by multiple threads at the same time.

Steps to reproduce

Hard to reproduce, but here's a log:

screen shot 2018-04-09 at 1 40 44 pm

The fix would probably be a semaphore or lock inside those add/remove methods.

Shouldn't there be endConnection call somewhere for Android?

Hello!

According to https://developer.android.com/reference/com/android/billingclient/api/BillingClient.html

When you are done with this object, don't forget to call endConnection() to ensure proper cleanup. This object holds a binding to the in-app billing service and the manager to handle broadcast events, which will leak unless you dispose it correctly. If you created the object inside the onCreate(Bundle) method, then the recommended place to dispose is the the onDestroy() method.

But i can't find this in the code. Shouldn't it be somewhere actually?

As far as i know similar package for android has this: https://github.com/idehub/react-native-billing#close

Thanks.

[BUG][ANDROID][0.3.2] cannot find symbol purchaseList

Version of react-native-iap

0.3.2

Expected behavior

android build with succeed

Actual behavior

node_modules/react-native-iap/android/src/main/java/com/dooboolab/RNIap/RNIapModule.java:236: error: cannot find symbol
if (purchaseList != null && responseCode == BillingClient.BillingResponse.OK) {

Steps to reprodue the behavior

react-native run-android with react-native-iap: 0.3.2

possible solutions:
There's probably char missing, shouldn't be here
if (purchasesList != null
instead of
if (purchaseList != null
in RNIapModule.java:236 ?

screen shot 2018-04-09 at 10 25 08

PR for fix: #103

React pod has been deprecated

Installing RNIap (1.0.0)
Installing React (0.11.0)
..
[!] React has been deprecated

I had to remove some other libs that pull in the deprecated React pod as it causes weird errors sometimes. Could this be fixed?

Cannot read property 'fetchProducts' of undefined

Version of react-native-iap

0.2.17

Expected behavior

Should fetch the products

Actual behavior

Some error: TypeError: Cannot read property 'fetchProducts' of undefined
    at blob:file:///4d72f48f-05d3-412d-8e2f-5d0908f04e54:63153:15
    at tryCallTwo (blob:file:///4d72f48f-05d3-412d-8e2f-5d0908f04e54:1975:5)
    at doResolve (blob:file:///4d72f48f-05d3-412d-8e2f-5d0908f04e54:2114:13)
    at new Promise (blob:file:///4d72f48f-05d3-412d-8e2f-5d0908f04e54:1996:3)
    at Object.getItems (blob:file:///4d72f48f-05d3-412d-8e2f-5d0908f04e54:63147:12)
    at getItems$ (blob:file:///4d72f48f-05d3-412d-8e2f-5d0908f04e54:63078:51)
    at tryCatch (blob:file:///4d72f48f-05d3-412d-8e2f-5d0908f04e54:36741:40)
    at Generator.invoke [as _invoke] (blob:file:///4d72f48f-05d3-412d-8e2f-5d0908f04e54:36929:22)
    at Generator.prototype.(anonymous function) [as next] (blob:file:///4d72f48f-05d3-412d-8e2f-5d0908f04e54:36766:21)
    at tryCatch (blob:file:///4d72f48f-05d3-412d-8e2f-5d0908f04e54:36741:40)

Steps to reproduce the behavior

  1. Run yarn install react-native-iap
  2. Run yarn link react-native-iap. (I have a cocoapods projects so it adds the following line: pod 'RNIap', :path => '../node_modules/react-native-iap' to my Podfile
  3. Run cd ios, Run pod install
  4. Launch the app

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.