Comments (45)
@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.
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.
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.
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.
@malithjkmt That is actually the expected flow for now.
from react-native-in-app-utils.
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.
Yes its cleared for sale.
I have log out from my own iTunes account but still same.
from react-native-in-app-utils.
Any resolution to this issue? I'm seeing the same thing....
from react-native-in-app-utils.
@joshuapinter what's the error log?
from react-native-in-app-utils.
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.
@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.
@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.
π
from react-native-in-app-utils.
@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.
@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.
@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.
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.
also refer: #37
from react-native-in-app-utils.
@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.
if i remember correctly you want to try this on a real device for loadProducts
also.
from react-native-in-app-utils.
@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.
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.
You bet. I'll give that a try right now.
from react-native-in-app-utils.
Ah, it looks an invalid product. Take a look at the breakpoint objects:
It should really return an error then, eh?
from react-native-in-app-utils.
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.
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.
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.
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.
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.
@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.
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.
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.
@chirag04 π
from react-native-in-app-utils.
@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.
@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.
@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.
@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.
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.
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.
from react-native-in-app-utils.
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.
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.
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.
@malithjkmt Same issue for me.
from react-native-in-app-utils.
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.
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)
- After trying to upgrade a plan this module always fails. HOT 1
- payment modal ui style HOT 2
- Docs improvement (pod installation) HOT 1
- Question: How to associate apple payment notification with my custom payment records?
- 'downloadable' is unavailable: not available on iOS 13 HOT 7
- Calling #loadProducts with different productId resets previously loaded products
- Discount Subscriptions
- Can't compile with Xcode 11 for iOS 13 HOT 4
- Add release tag for version 6.0.2 HOT 2
- 'downloadable' is unavailable: not available on IOS HOT 1
- InAppUtils.receiptData returns undefined
- We didn't find any purchases to restore. HOT 2
- How to buy subscription?
- ε ³δΊθΉζζ―δ»ζεοΌε€§δ½¬δ»¬ι½ζ―ζδΉθ§£ε³ηε
- InAppUtils.purchaseProduct() doesn't work on iOS 14 HOT 6
- loadProducts can not work as expected after upgrading iOS 14 HOT 3
- No callback registered for transaction with state purchased. HOT 1
- Hmmm ideas
- Fix crash on simulator with this small change HOT 1
- loadProducts not working on iOS 14.5 simulator
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-in-app-utils.