I'm posting my issue and solution here, because I didn't found the answer anywhere else online.
Problem
You're using Cordova with CreateReactApp and your inAppPurchase object is accessible on iOS, but not on Android. You've checked everything: the cordova object does exist in the window, you wait until deviceReady and you've set up the billing key in the manifest file. What could be wrong?
Solution
If you are like me, you've tried every suggestion online but failed. You might want to check one stupid detail that I overlooked for hours:
The billing key should not be added the manifest.json file in the www folder, but to the one in the public folder. That's because the www folder is rebuilt every time you build your project. So you can add your billing key to www, but it will never make it into the build. Seems obvious now, but I overlooked it for the longest time...
I'm posting my issue and solution here, because I didn't found the answer anywhere else online.
Problem
You're using Cordova with CreateReactApp and your
inAppPurchase
object is accessible on iOS, but not on Android. You've checked everything: thecordova
object does exist in the window, you wait untildeviceReady
and you've set up the billing key in the manifest file. What could be wrong?Solution
If you are like me, you've tried every suggestion online but failed. You might want to check one stupid detail that I overlooked for hours:
The billing key should not be added the
manifest.json
file in thewww
folder, but to the one in thepublic
folder. That's because thewww
folder is rebuilt every time you build your project. So you can add your billing key towww
, but it will never make it into the build. Seems obvious now, but I overlooked it for the longest time...