In-App Purchases With Ionic

Hello,

Please forgive the rookie question, I’m new to Ionic. I’m about 90% finished with my first app, but the last piece I have to consider is how to handle in-app purchases. I could do an API for it, but I’d prefer to use iOS in-app purchasing via the Apple and Android stores. Has anyone tied into those with Ionic? I’d assume it’s a Cordova thing, but it’s all a bit hazy to me still.

Thanks!

1 Like

I haven’t done this myself either. I will be doing it eventually though. This looks interesting.

http://fovea.cc/blog/index.php/3-steps-tutorial-for-phonegap-in-app-purchase-on-ios/

There is this plugin that I found that is supposed to be for in app purchases. I’ve never used it before so I can’t swear by it.

Ionic is pretty Cordova-friendly (or Cordova-agnostic) so you can use whatever plugins you’d otherwise use. It’s opinionated as a UI but feature-wise it’s still on you.

If you’re new to Cordova/Phonegap the explanation that opened my eyes about it is that Cordova offers a way to hook into native object methods - so behind every plugin is native code with a very thin JavaScript wrapper that just calls cordova.exec() and then whatever method on the native plugin wrapper, and arguments tend to get passed as-is (although some plugin authors do more than others to make their API more JS-like, accepting booleans rather than “Yes/No” strings, etc.

Thanks everyone, these leads are really helpful. @jough that really does make understanding the whole Ionic + Cordoba relationship a lot more clear. Thanks for that!

i am starting to use this plugin, hopefully it’s not too complicated to work with. If I get an IAP to work i’ll post a tutorial.

Hey,

I have tried to implement this IAP plugin, however whenever I try to run my code I consistently get the same error message in Xcode:

2014-05-06 16:41:57.281 Airborne[80261:70b] CDVPlugin class InAppPurchase (pluginName: InAppPurchase) does not exist.
2014-05-06 16:41:57.281 Airborne[80261:70b] ERROR: Plugin ‘InAppPurchase’ not found, or is not a CDVPlugin. Check your plugin mapping in config.xml.
2014-05-06 16:41:57.282 Airborne[80261:70b] -[CDVCommandQueue executePending] [Line 158] FAILED pluginJSON = [
“InAppPurchase466332499”,
“InAppPurchase”,
“setup”,
[

]
]

I have absolutely no idea why this is happening, as it seems that all the files are there and registered in the proper confix.xml and cordova_plugins.json files. I am currently compiling with cordova version 3.4.1-0.1.0

Any help would be really appreciated

if anyone else runs into the issue of Xcode not finding a plugin check this stackoverflow page:

hey so did you get it work? After bashing my head I finally got the fovea.cc IAP working so if you need any help ask away, and I will do my best

You should put together a sample project on GitHub and share it on the forum. I’m sure users would appreciate the example

3 Likes

ya that’s a good idea… will do next week!
although, with IAP’s the code is rarely the issue, it is usually the setup on apples side.
Our issue, since we are located in Canada, is that we still had to fill out the American tax receipts to tell them we are not in the US, and send in our Canadian tax info.

Can someone possibly provide some additional details on how IAP’s should be setup on apple? Is putting in a bank account necessary while testing? Confused how testing is possible before apple submission as well.