This is a migrated thread and some comments may be shown as answers.

iOS In App Purchase

5 Answers 122 Views
Apple iOS
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Alessandro
Top achievements
Rank 1
Alessandro asked on 06 Mar 2014, 04:39 PM
Hi everyone,
in order to sell virtual items in my app i'm trying to use the iOS in app purchase according to ios developer guidelines.
To do this i'm following the instruction of this tutorial:  3 Steps Tutorial for PhoneGap In-App Purchase on iOS
and i'm using this plugin: PhoneGap-InAppPurchase-iOS
This plugin uses <js-module> to be imported,  in particular the plugin.xml file contains these lines:
<js-module src="InAppPurchase.js" name="InAppPurchase">
            <clobbers target="storekit" />
        </js-module>

for a testing purpose i've created a blank project  and added the custom plugin 
but when I try to use the methods  as described in the documentation of this plugin I get a javascript error:
"storekit is undefined". 

It seems that the plugin is not recognized. Can anyone tell me what is wrong? 
Or alternatively is there anyone who has successfully implemented the Ios in-app-purchase and can tell me how to integrate it into my app?

Thanks in advance
Alessandro

5 Answers, 1 is accepted

Sort by
0
Iva Koevska
Telerik team
answered on 07 Mar 2014, 07:40 AM
Hi Alessandro,

Would you, please, provide more details about the behavior you're observing? Do you get this error on device or in the device simulator?

In case you are getting this error in the simulator, this is expected. The device simulator does not support custom plugins.

In case you are getting this error on device, have you tried debugging on device or in the simulator?

Regards,
Iva Koevska
Telerik
Icenium is now Telerik AppBuilder, and is part of the Telerik Platform. For more information on the new name, and to learn more about the Platform, register for the free online keynote and webinar on Wednesday, February 12, 2014 at 11:00 a.m. ET (8:00 a.m. PT)
0
Josh
Top achievements
Rank 1
answered on 27 Aug 2014, 08:33 PM
Ever get this figured out?
0
Martin Yankov
Telerik team
answered on 01 Sep 2014, 11:20 AM
Hello Josh,

The problem is with referencing the plugin correctly and not with the plugin itself. Alessandro has not shared whether he has solved the issue, but the most probable causes for the plugin to not be initialized are:
  • The plugin is being called before the deviceready() event has fired. You should call plugins only after the Cordova deviceready().
  • The plugin is being called from the AppBuilder Simulator. The AppBuilder Simulator cannot run custom plugins. Only the most basic plugins work in the Simulator and even then, you should always test plugins on real devices.

I hope this information was helpful. Let me know if you have any other questions.


Regards,
Martin Yankov
Telerik
 

Visit the Telerik Verified Plugins Marketplace and get the custom Cordova plugin you need, already tweaked to work seamlessly with AppBuilder.

 
0
Stefano
Top achievements
Rank 1
answered on 26 Apr 2016, 06:00 AM

Hello,

I am trying to understand how the Telerik-Verified-Plugins/InAppPurchase plugin works, but I have some question I can't find an answer.

- First of all: is this the official/suggested plugin for inApp purchases on iOS and Android? In fact it reference the v.4.0.0 of this plugin which is at v.5.0.0. However, the installation suggestion for Appbuilder CLI on the webpage of the plugin ("appbuilder plugin add "Purchase"") didn't actually load the folder in my project. why?

- I tried to follow the suggestions of this post, but I found it quite confusing. The 3-steps tutorial Tina suggested is related to PhoneGap and not Appbuilder; however I believe I managed to install the plugin with "appbuilder plugin fetch "github-link"" (is this correct or I need some other step?). In addition, the code shown in the tutorial does not match with the library/documentation of the InAppPurchase plugin; for instance it refers to a 'storekit' variable, while the InAppPurchase plugin has a 'store' variable, and it uses different methods like 'storekit.purchase()' while your verified plugin has a 'store.order()' method. Why it that? Am I missing something?

- I tried to run the InAppPurchase-DemoApp, but I had this error when I ran "appbuilder deploy ios --debug":

Multiple exceptions were thrown:
Cannot find applicable provisioning profiles. 
 Cannot use provision "ios_development" because the following error occurred: The application identifier must match the bundle identifier in the provisioning profile. 
 
Cannot find applicable provisioning profiles.
Cannot use provision "ios_development" because the following error occurred: The application identifier must match the bundle identifier in the provisioning profile. 

Do I need to create an app and a product within my iTunes Connect to be able to run the demo?

 

Do you have any up-to-date documentation that could help me understand how to use the plugin with some example?

Thanks,

Stefano

0
Kaloyan
Telerik team
answered on 28 Apr 2016, 01:50 PM
Hello Stefano,

Straight to your questions:

Q: "is this the official/suggested plugin for inApp purchases on iOS and Android? In fact it reference the v.4.0.0 of this plugin which is at v.5.0.0. However, the installation suggestion for Appbuilder CLI on the webpage of the plugin ("appbuilder plugin add "Purchase"") didn't actually load the folder in my project. why?"
A: Yes, this is the official Cordova plugin for In-App purchases and it should work flawlessly for both the Android and iOS platforms. You are absolutely correct that the plugin's version on our side is v4.0.0 from the j3k0's repository. This is so, as we haven't approved the latest version at this stage, but I believe it will be available next month. Further, installing the plugin with appbuilder add is not expected to create a folder under Plugins in your project. This is so, as when you install a Telerik Marketplace plugin it is only being referenced in the project and its source files are imported during cloud build. Still, you should notice that the plugin is installed after the add command in the properties of the project. For example, executing the appbuilder plugin command should print the Purchase plugin among the others. I have created a simple video showing this.

Q: "I tried to follow the suggestions of this post, but I found it quite confusing. The 3-steps tutorial Tina suggested is related to PhoneGap and not Appbuilder; however I believe I managed to install the plugin with "appbuilder plugin fetch "github-link"" (is this correct or I need some other step?). In addition, the code shown in the tutorial does not match with the library/documentation of the InAppPurchase plugin; for instance it refers to a 'storekit' variable, while the InAppPurchase plugin has a 'store' variable, and it uses different methods like 'storekit.purchase()' while your verified plugin has a 'store.order()' method. Why it that? Am I missing something?"
A: As explained above, you can install the plugin following the approach shown in the video. This will allow you to configure its Billing Key accordingly and is the recommended approach for installing Telerik Verified plugins in the AppBuilder CLI. Still, the approach you have followed is also correct, but instead of the Telerik Verified version of the plugin it installs the official version in the j3k0's repository. The downsides of this is that, this version hasn't been verified on our side and if issues arise we might be unable to help. As for the differences in the docs, I am afraid I didn't find such, as both the v4.0.0 docs seem similar to me. In example, the verified plugin uses the store object as well as the official plugin. Please correct me if I have missed something here.

Q: "I tried to run the InAppPurchase-DemoApp, but I had this error when I ran "appbuilder deploy ios --debug":"
A: Judging from the error message, you will need to configure the sample application in the AppBuilder CLI to use the same app ID as the development certificate you have imported. To do this, you can use the following command:
$ appbuilder prop set AppIdentifier <new app id as configured in the iOS development cert>
After that, you should be able to build and deploy the app on iOS devices.

I hope this helps.

Regards,
Kaloyan
Telerik
 

Visit the Telerik Verified Plugins Marketplace and get the custom Cordova plugin you need, already tweaked to work seamlessly with AppBuilder.

 
Tags
Apple iOS
Asked by
Alessandro
Top achievements
Rank 1
Answers by
Iva Koevska
Telerik team
Josh
Top achievements
Rank 1
Martin Yankov
Telerik team
Stefano
Top achievements
Rank 1
Kaloyan
Telerik team
Share this question
or