Bruce Stuart
Posts: 0
Joined: Fri Oct 24, 2014 4:42 am

InAppPayment Tutorial In Progress - 'Slight' challenge

After adding storeKit library - and re-exporting my project .pbxproj - and reloading that same file to my source - ios - xcodeproject folder structure - I started an Export - Apple - binary (.ipa) and Happy Dance - the app now can be built in Appery. Next step - write code that uses the store functions! I'm totally beside myself....

Image

Bruce Stuart
Posts: 0
Joined: Fri Oct 24, 2014 4:42 am

InAppPayment Tutorial In Progress - 'Slight' challenge

ok... now to explain the balance of the steps I've taken.... and to ask for my next ... and hopefully last little bit of assistance before this works...and i can publish a tutorial....

step 17 I've created a generic Java set of functions to initiate and load the storekit into memory at startup. adding the functions to your project is shown below:

Image

next Step 18 - create a service that will hold your product id's and later the secret key for getting receipts and payments made by users:

Image

Bruce Stuart
Posts: 0
Joined: Fri Oct 24, 2014 4:42 am

InAppPayment Tutorial In Progress - 'Slight' challenge

next step 18a - add the details to the service you just created....

Image

next step 19 - call the code to initialize the store functions in your code at startup - login:

Image

Finally - Add code to your application - to do a purchase (obviously this is 'out of order' - as when you startup - you'd like to see if this user has purchased the full version or not by restoring previous purchases possibly .... but - I'm going to leave that code to later - or to you - the first order of business - is to attempt to purchase something...) so - I added this code and this visual...

Visual:

Image

Code:

function fpurchasefullverion(){
// ask user if they would like to purchase the full version - if so - kick off a store purchase....
var lpurchase = false;
var nselection = 0 ;
if (!busenavigator ) // then you are on the Windows platform or the Web --- don't really care - we're not going to code these stores
{
lpurchase = false;
alert('You are using the free version. Support your favorite charity, get features like recurring emails, unlimited emails, cc, bcc, attachments, & more. Please download the full version from your phone-tablet store..');
}
else {
confirm( 'You are using the free version. Support your favorite charity, get features like recurring emails, unlimited emails, cc, bcc, attachments, & more. Would you like to purchase the full version now?' , fdonextstep );
}
}

function fdonextstep( nbuttonpressed ){
if ( nbuttonpressed === 1) // do the purchase
{ window.storekit.purchase( InAppPurchasesSettings.InAppProduct1 , 1);
}
}

Bruce Stuart
Posts: 0
Joined: Fri Oct 24, 2014 4:42 am

InAppPayment Tutorial In Progress - 'Slight' challenge

And now.... for the issues and things that don't work after I've done this work. On the good side - the StoreKit foundation appears to be installed correctly - and so is the plugin - and I'm getting debug messages from it - when I run it in the IOS simulator. Now - the detailed questions - which hopefully are the last round to get this working:

This is my first IOS inAppPurchase Product obviously. I've loaded it to the Store as shown below. Image 1 - Store Submission summary page ; Image 2 - Store submission detail page (note the warning here - to which I'll state that I've created a build with my code so far - and loaded it to the store for BETA review - it's the build that's shown in Image 3 - details of attaching the inAppPurchase - to the new build that I've created.

Image

Image

Image

So - what are the questions you ask.

  1. Is the name of my product - for inclusion in the code (as this is what I've used):

    io.appery.app.iLater.iLater1 ??

  2. I believe my methods to initialize the library are working. Are they???

    Here's the dump from the debug log (running via IOS simulator - i know some posts say that the simulator won't actually hit the store.... true statement even though the Storekit does get information back from the store during its calls)... that highlights the debug information coming back from StoreKit functions and some of my code that produces console logging during initialization:

    http://the-software-studio.com/javasc...

  3. If the calls are working as I suspect - I'm getting zero records back. I realize this may be because I'm hitting the production Store ?? instead of the test store?? or vice-versa?? How do you control that? How do I get my product - in the sandbox - test store?? and get the app to go against the test store?? I have my app (the version I want to promote eventually) - in BETA.

    Do I change build settings? Login differently to the store?

    Help :-) !!!

    Almost done just need to get past this last hurdle....!!

    Bruce

Bruce Stuart
Posts: 0
Joined: Fri Oct 24, 2014 4:42 am

InAppPayment Tutorial In Progress - 'Slight' challenge

Can you possibly help with the error implied here - during successful interaction with the store for product id's etc (See log) - when I attempt a purchase - I get this output (end of the log)

2015-04-17 00:38:14.679 iLater[9782:534032] InAppPurchase[objc]: productsRequest: didReceiveResponse:
2015-04-17 00:38:14.679 iLater[9782:534032] InAppPurchase[objc]: Has 1 validProducts
2015-04-17 00:38:14.679 iLater[9782:534032] InAppPurchase[objc]: - iLater1: iLater Full Version
2015-04-17 00:38:14.680 iLater[9782:534032] InAppPurchase[objc]: productsRequest: didReceiveResponse: sendPluginResult: (
(
{
description = "This is the full version of iLater. Purchasing this product, enables features in the App for recurring emails, changing when notifications go out, turning off CC myself, adding unlimited CC and BCC's to any scheduled email, and adding attachments.";
id = iLater1;
price = "$1.99";
title = "iLater Full Version";
}
),
(
"io.appery.app.iLater.iLater2",
"io.appery.app.iLater.iLater1"
)
)
2015-04-17 00:38:14.681 iLater[9782:534032] InAppPurchase[js]: load ok: { valid:[{"id":"iLater1","title":"iLater Full Version","description":"This is the full version of iLater. Purchasing this product, enables features in the App for recurring emails, changing when notifications go out, turning off CC myself, adding unlimited CC and BCC's to any scheduled email, and adding attachments.","price":"$1.99"}] invalid:["io.appery.app.iLater.iLater2","io.appery.app.iLater.iLater1"] }
2015-04-17 00:38:14.681 iLater[9782:534032] id: iLater1 title: iLater Full Version val: This is the full version of iLater. Purchasing this product, enables features in the App for recurring emails, changing when notifications go out, turning off CC myself, adding unlimited CC and BCC's to any scheduled email, and adding attachments. price: $1.99
2015-04-17 00:38:14.682 iLater[9782:534032] Invalid Product IDs: ["io.appery.app.iLater.iLater2","io.appery.app.iLater.iLater1"]
2015-04-17 00:38:19.428 iLater[9782:534032] InAppPurchase[objc]: About to do IAP
2015-04-17 00:38:19.428 iLater[9782:534032] InAppPurchase[objc]: Payment transaction updated ((null)):
2015-04-17 00:38:19.428 iLater[9782:534032] InAppPurchase[objc]: Purchasing...
2015-04-17 00:38:54.382 iLater[9782:534032] InAppPurchase[objc]: Payment transaction updated ((null)):
2015-04-17 00:38:54.382 iLater[9782:534032] InAppPurchase[objc]: Error ERR_UNKNOWN Cannot connect to iTunes Store
2015-04-17 00:38:54.383 iLater[9782:534032] InAppPurchase[objc]: Error 4983507 Cannot connect to iTunes Store
2015-04-17 00:38:54.383 iLater[9782:534032] InAppPurchase[objc]: State: PaymentTransactionStateFailed
2015-04-17 00:38:54.384 iLater[9782:534032] in myAlert
2015-04-17 00:38:54.399 iLater[9782:534032] THREAD WARNING: ['Notification'] took '14.890137' ms. Plugin should use a background thread.
2015-04-17 00:38:54.401 iLater[9782:534032] complete running navigator alert
2015-04-17 00:38:54.401 iLater[9782:534032] Failed: Cannot connect to iTunes Store

Specifically - can a payment transaction ever really succeed in the Sandbox or is the failure intentional by the Sandbox ???

Bruce Stuart
Posts: 0
Joined: Fri Oct 24, 2014 4:42 am

InAppPayment Tutorial In Progress - 'Slight' challenge

Any update on this thread? I am publishing my app to BETA to determine if this occurs on devices directly --- but in terms of getting good debug data - the best place is going to be through the IOS Simulator ---- dependent upon what the developers that have used StoreKit in IOS might say about this???

Bruce Stuart
Posts: 0
Joined: Fri Oct 24, 2014 4:42 am

InAppPayment Tutorial In Progress - 'Slight' challenge

I suppose it would be useful to show the User side of the app - when the store initializes - here are the images the store produces:

Image

Image

Question however remains - can a payment transaction ever really succeed in the Sandbox - or is the err_unknown state intentionally thrown by the store during testing in the sandbox?

Illya Stepanov
Posts: 0
Joined: Mon Mar 18, 2013 8:48 am

InAppPayment Tutorial In Progress - 'Slight' challenge

Hi Bruce -

We will forward this info to our developers they will try to help you here - but I hope you understand that reply won't be quick here.

Bruce Stuart
Posts: 0
Joined: Fri Oct 24, 2014 4:42 am

InAppPayment Tutorial In Progress - 'Slight' challenge

illya,

Thank you. They actually helped above quite a bit - just by looking - and did so quite expeditiously on the last question (within say 12 hours).

Are you saying longer because it's the weekend - or longer because this is tougher or what expectation are you trying to set??

There are a lot of us here that are looking to deploy this functionality - and - I think I'm within 30-45 minutes of someone who really knows this - taking a look at it....

That said - I know you're going to say normally you guys don't support this.... so please be gentle :-)

Illya Stepanov
Posts: 0
Joined: Mon Mar 18, 2013 8:48 am

InAppPayment Tutorial In Progress - 'Slight' challenge

Bruce - Due to the weekend, but I'll try to ping developer as quickly as possible :-)

Return to “Issues”