Git Product home page Git Product logo

Comments (45)

joshuapinter avatar joshuapinter commented on August 18, 2024 1

@chirag04 When I load the products, it's returns null error but an empty Array [].

When I use product id to make a purchase it says invalid_product.

Which brings up another good question, do we pass the product id into purchaseProduct or do we pass (one of) the returned products from loadProducts?

from react-native-in-app-utils.

chirag04 avatar chirag04 commented on August 18, 2024 1

oh yeah. For me it took like 24 hours.

I don't know if it will prevent you from accessing the products. I just sent all my information to them before even adding products.

from react-native-in-app-utils.

chirag04 avatar chirag04 commented on August 18, 2024 1

depends on the app. It's a valid concern but returning error in not the right solution.

How about:

InAppUtils.loadProducts(products, (error, products, invalidProducts) => {
   //update store here.
});

from react-native-in-app-utils.

nickyhajal avatar nickyhajal commented on August 18, 2024 1

Just a note that I was experiencing this because I hadn't completed the Tax/Banking information (I had added the Tax info but not a bank).

Once I added a bank, it took about an hour and then worked fine.

from react-native-in-app-utils.

chirag04 avatar chirag04 commented on August 18, 2024 1

@malithjkmt That is actually the expected flow for now.

from react-native-in-app-utils.

chirag04 avatar chirag04 commented on August 18, 2024

user cancelling will be an error but it should not be invalid_product error tho. You can test buy product using sandbox mode and you won't be charged.

For invalid_product can you make sure you marked the product as "available for sale" on itunes?

from react-native-in-app-utils.

emretekince avatar emretekince commented on August 18, 2024

Yes its cleared for sale.
I have log out from my own iTunes account but still same.

from react-native-in-app-utils.

joshuapinter avatar joshuapinter commented on August 18, 2024

Any resolution to this issue? I'm seeing the same thing....

from react-native-in-app-utils.

chirag04 avatar chirag04 commented on August 18, 2024

@joshuapinter what's the error log?

from react-native-in-app-utils.

chirag04 avatar chirag04 commented on August 18, 2024

i see the problem.

so the way it works is: when you do load products we cache the loaded products on native side using their productIdentifiers. When you say purcahseProduct(productIdentifier) we load the cached product and fire the purchase request.

In you case the load seems to have an empty array so the cache is empty on native side. hence purcahseProduct is not working.

Ideally you shouldn't have empty array in loadProducts if your setup is correct and you have products in there.

from react-native-in-app-utils.

joshuapinter avatar joshuapinter commented on August 18, 2024

@chirag04 I've got everything setup. in iTunes Connect. I've been reading that it takes a while for the Product ID to "register" with Apple. Do you have any idea how long that takes?

Also, I've completed all my banking information and what not but I still need to mail them my signed agreement. Would that prevent me from accessing the products?

from react-native-in-app-utils.

joshuapinter avatar joshuapinter commented on August 18, 2024

@chirag04 Oh damn! Okay, that makes me feel better. I'll do some other stuff and then come back to this tomorrow morning. Thanks for your help - I'll let you know how it goes.

from react-native-in-app-utils.

chirag04 avatar chirag04 commented on August 18, 2024

πŸ‘

from react-native-in-app-utils.

joshuapinter avatar joshuapinter commented on August 18, 2024

@chirag04 Still nothing. So maybe the rest of the contract stuff has to be in place.

Question: Is there a way I can get all possible products from loadProducts without passing in a full in-app purchase product id?

from react-native-in-app-utils.

chirag04 avatar chirag04 commented on August 18, 2024

@joshuapinter idk. best to make sure you follow the stackoverflow link in readme and make sure your step is correct.

As far as i know you can only load products using product ids. let me know if you know find

from react-native-in-app-utils.

joshuapinter avatar joshuapinter commented on August 18, 2024

@chirag04 Me again. All of the contract stuff is correctly setup and the in-app purchase is submitted for review. But I still get an empty array when using loadProducts. Any idea? The errors response is null. If I'm using an incorrect productIdentifier it would return an error, correct?

Thanks!

from react-native-in-app-utils.

chirag04 avatar chirag04 commented on August 18, 2024

i think ios skips invalid productIdentifier. looks for the response of loadProducts and you should have your products there. if not something wrong with your setup.

from react-native-in-app-utils.

chirag04 avatar chirag04 commented on August 18, 2024

also refer: #37

from react-native-in-app-utils.

joshuapinter avatar joshuapinter commented on August 18, 2024

@chirag04 The response is just an empty array with loadProducts so something must be wrong with my setup, although I don't know what.

You mention that you need to use a real device to test In-App Purchases but is this necessary for using loadProducts or just for purchasing?

from react-native-in-app-utils.

chirag04 avatar chirag04 commented on August 18, 2024

if i remember correctly you want to try this on a real device for loadProducts also.

from react-native-in-app-utils.

joshuapinter avatar joshuapinter commented on August 18, 2024

@chirag04 Thanks for your help. Still nothing when using a real device.

So, if I don't have something setup correctly, shouldn't your library give me an error instead of an empty array? Under what circumstances would an empty array be provided as a response? Either I have the correct product id or I don't, right?

from react-native-in-app-utils.

chirag04 avatar chirag04 commented on August 18, 2024

can you put a debug point and see what you get in the response object here: https://github.com/chirag04/react-native-in-app-utils/blob/master/InAppUtils/InAppUtils.m#L175

from react-native-in-app-utils.

joshuapinter avatar joshuapinter commented on August 18, 2024

You bet. I'll give that a try right now.

from react-native-in-app-utils.

joshuapinter avatar joshuapinter commented on August 18, 2024

Ah, it looks an invalid product. Take a look at the breakpoint objects:

screenshot 2016-08-04 16 06 28

It should really return an error then, eh?

from react-native-in-app-utils.

joshuapinter avatar joshuapinter commented on August 18, 2024

What do you think about checking invalidProductIdentifiers and returning those as an error if it's not empty:

(lldb) p response
(SKProductsResponse *) $0 = 0x0000000144f8a4e0

(lldb) p response.products
(__NSArray0 *) $1 = 0x0000000144d140b0 @"0 elements"

(lldb) p response.invalidProductIdentifiers
(__NSCFArray *) $2 = 0x0000000144f8c980 @"1 element"

(lldb) p response.invalidProductIdentifiers[0]
(__NSCFString *) $3 = 0x0000000144f86b80 @"com.ntwrkapp.ntwrk.somethingcompletelydifferent"

from react-native-in-app-utils.

chirag04 avatar chirag04 commented on August 18, 2024

so something is def wrong with your in-app items on itunesconnect.

about the error, i don't think we should return those as errors because it can happen that you have 10 products out of which 9 loads fine and 1 is bad! Mostly like these are one time dev errors.

we can probably warn in dev mode when we have invalid products. up for PR?

from react-native-in-app-utils.

chirag04 avatar chirag04 commented on August 18, 2024

ok. going to close this issue. feel free to PR to make the dev exp better.

Thanks everyone for the discussion.

from react-native-in-app-utils.

joshuapinter avatar joshuapinter commented on August 18, 2024

We definitely need to do something to let the developer know that something is not right.

If 1 fails out of 9, isn't that still a concern? Wouldn't you want to know that 1 failed and which one failed?

from react-native-in-app-utils.

joshuapinter avatar joshuapinter commented on August 18, 2024

Yeah, that's not bad.

I still need a little convincing why this wouldn't justify an error. Can you give me a scenario where this could happen and you would want to ignore it?

from react-native-in-app-utils.

joshuapinter avatar joshuapinter commented on August 18, 2024

@chirag04 Hey Chirag, so I was finally able to get loadProducts working.

However, now I'm running into an issue with purchaseProduct. It returns invalid_product.

You mentioned that there might be a caching issue so I dived into your library and put a breakpoint in purchaseProduct to see what products is. It's nil even though my loadProducts are coming up fine.

Any way to clear the cache or something? Thanks again for all your help and your great library. :)

from react-native-in-app-utils.

joshuapinter avatar joshuapinter commented on August 18, 2024

Okay, so I got it working by putting purchaseProduct inside of the callback of loadProducts.

var productIdentifiers = [
    'com.ntwrkapp.ntwrk.unlimitedrelationships',
];

InAppUtils.loadProducts(productIdentifiers, (error, products) => {
   InAppUtils.purchaseProduct(productIdentifiers[0], (error, response) => {
     if (response && response.productIdentifier) {
       console.log('Purchase Successful. Your Transaction ID is ' + response.transactionIdentifier);
     }
   });
});

Is this necessary? Do you need to call loadProducts before calling purchaseProduct?

from react-native-in-app-utils.

chirag04 avatar chirag04 commented on August 18, 2024

yes you need to call loadProducts before calling purchaseProduct.

You can load all your products once when the app start and then just call purchaseProduct whenever you want. you can also put loadProducts response in some store if you want some more control over load products.

from react-native-in-app-utils.

joshuapinter avatar joshuapinter commented on August 18, 2024

@chirag04 πŸ‘

from react-native-in-app-utils.

laxxers avatar laxxers commented on August 18, 2024

@chirag04 Hey Chirag, so I was finally able to get loadProducts working.

@joshuapinter hi Joshua, I'm facing the same problem as well. The products returns an empty Array []. Mind sharing your solutions?

from react-native-in-app-utils.

joshuapinter avatar joshuapinter commented on August 18, 2024

@laxxers Mine had to do with Apple not approving my products, etc.

The best way to narrow it down is to see if you have any invalid products returned, as described in #29 (comment).

If you do then at least it's picking up the products and it's a matter of working with Apple to get the products approved, etc.

from react-native-in-app-utils.

laxxers avatar laxxers commented on August 18, 2024

@joshuapinter Hi, thanks for your reply.

I did get invalid products returned.

I'd created the in app purchase products in iTunes Connect along with all sort of information required. Any particular things that I need to take note in order to get Apple to approve? Do I need to upload the screenshot and submit for review or I should get it working on my app first before I take the screenshot and update and submit for review?

from react-native-in-app-utils.

joshuapinter avatar joshuapinter commented on August 18, 2024

@laxxers It could be a bunch of different things. Best way to find out is to get in touch with the App Store Review team and figure out why the products are not approved yet. Be patient but be persistent with them. It took about two weeks for me to figure everything out with them and it was painful. Good luck.

When you do figure it out, report your findings back here.

from react-native-in-app-utils.

Asterism1985 avatar Asterism1985 commented on August 18, 2024

Hi,

Any resolution to this issue? I'm seeing the same thing....
The products returns an empty Array [].

RCT_EXPORT_METHOD(loadProducts:(NSArray *)productIdentifiers
callback:(RCTResponseSenderBlock)callback)
{
if([SKPaymentQueue canMakePayments]){
SKProductsRequest *productsRequest = [[SKProductsRequest alloc]
initWithProductIdentifiers:[NSSet setWithArray:productIdentifiers]];
productsRequest.delegate = self;
_callbacks[RCTKeyForInstance(productsRequest)] = callback;
[productsRequest start];
} else {
callback(@[@"not_available"]);
}
}

In this code, productIdentifiers is always nil value.
Why is productIdentifiers array value empty ?

from react-native-in-app-utils.

jasonlfunk avatar jasonlfunk commented on August 18, 2024

For people who come across this in the future, here is an apple faq which explains why your product ID may be invalid:

For me, I hadn't submitted the right legal paperwork/bank information yet. Why nothing said that anywhere in the itunesconnect site, I have no idea.

https://developer.apple.com/library/content/technotes/tn2413/_index.html#//apple_ref/doc/uid/DTS40016228-CH1-TROUBLESHOOTING-WHY_ARE_MY_PRODUCT_IDENTIFIERS_BEING_RETURNED_IN_THE_INVALIDPRODUCTIDENTIFIERS_ARRAY_

from react-native-in-app-utils.

WonderDev21 avatar WonderDev21 commented on August 18, 2024

Hello, everyone.
I integrated react-native-in-app-utils on my project for in-app purchase function.

import {
  ...
  NativeModules,
  ...
} from 'react-native';
var InAppUtils = require('NativeModules').InAppUtils;

export default class HintStore extends React.Component {
...
var products = [
        'com.abc.xyz.coins.200'
     ];
     InAppUtils.loadProducts(products, (error, products) => {
        console.log("products===>", products);
     });
...
}

But products===> []

I set com.abc.xyz.conis.200 product on my account and it was reviewed.
Please help me!
Thanks.

from react-native-in-app-utils.

AmmarHasan avatar AmmarHasan commented on August 18, 2024

Following the steps mentioned in this answer solved my problem. I hadn't completed the contract, tax and banking information. It is working fine now. Thanks @nickyhajal

from react-native-in-app-utils.

malithjkmt avatar malithjkmt commented on August 18, 2024

I've completed all the setup processes.
But, InAppUtils.purchaseProduct() fails! (in both debug sandBox and test flight modes)
The error is invalid_product

Workaround:-
First load product details, then purchase

InAppUtils.loadProducts([productId], (error, products) => {
  if (error) {
    console.log('Error in loading products: ', error)
  } else {
    InAppUtils.purchaseProduct(productId, (error, response) => {
      // process
    });
  }
});

from react-native-in-app-utils.

mygreatstory avatar mygreatstory commented on August 18, 2024

@malithjkmt Same issue for me.

from react-native-in-app-utils.

unmec avatar unmec commented on August 18, 2024

My issue is exactly the same: an empty array while calling loadProducts. However my situation is a little bit different:

I have an app with in app purchase implemented, working, on sales on App Store for several months now, and I decided to make an update(without touching in app purchase part, nor RN version though). Now the loadProducts returns 200 with empty array, all my bank and tax information are still up to date. I can however restore the purchase without any issue.

I have no idea why this could happen, maybe I should just upload it to App Store and wish it works with production? Any idea? Thanks.

from react-native-in-app-utils.

unmec avatar unmec commented on August 18, 2024

It seems that you need to create a new sandbox tester account, and make sure that you didn't log in with the new tester account on your device prior the purchase, just let the popup prompt you to login when making the purchase.

from react-native-in-app-utils.

Related Issues (20)

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.