I am facing a strange behavior with In-App-Purchase in iOS while testing with sandbox. Few things I observed, Please make your comments where I am wrong.
I know sandbox has small time interval for subscriptions like 30 minutes for 6 month subscription. I am using subscription model, when I am trying to purchase same item multiple time, it allows. Is that OK ? As per my understanding, it should allow only once to purchase and in subsequent call, it should say "Already purchased".
When I am restoring my previous purchase. Storekit is calling updateTransations with large number of previous transactions. Don't know why it is returning these large amount like 100, 200 ,245, 360, 650 seems like Random in every restore.
Please make your comments. Thanks in advance.
Regards,
OP
Dear All,
As I did not get reply on this thread. We have done testing an make the app live, app is working fine. Here are my comments that might be helpful to others.
When testing with sandbox, since time interval is not same as live app. You get 5 minutes for 3 month subscription and so on, so once your subscription expire your subscription will be renewed. If you will make one more payment request if subscription is live, you will get popup for already purchased.
Apple sends a large number of transactions, we need to add condition by our own, so that we will identify the current transaction and will process that only, rest will be ignored.
Hope this will help you all.
Thanks,
Om
Related
In order to be able to better estimate the revenue income of our app, we implemented a Database function that reliably (we tested it in Sandbox mode) increases a subscription counter for the subscription that was made by one once a subscription has been made.
This function is only triggered once an in-app purchase has been successful (i.e. when we receive the feedback from StoreKit to enable the Premium functions). Now, we have found enormous discrepancies between the data we observed and the data App Store Connect gives us.
For the past two days, upon confirmation of purchase via StoreKit, our app has 13 times enabled premium functions on a monthly subscription basis, and 14 times on a yearly subscription basis.
However, App Store Connect tells us we had one yearly subscription and 5 monthlies.
Furthermore, for the one premium subscription that generated sales of $5.60, Apple has added proceeds of $3.73 - but that's more than 30% commission. That's almost 35%.
The sales that Apple has not accounted for amount to more than $70.
Can anybody explain to me what's going on, why Apple is not showing us subscriptions that definitely happened and takes more commission than agreed?
My bet is that you are not aggregating the prices correctly on your database side. It is extremely complicated thing to do, despite superficially seeming simple.
The second guess is that ItunesConnect revenue is delayed by day or three (they were experiencing delays).
If you want to see know the revenue calculation is done correctly, I recommend hooking yourself to RevenueCat (quite simple process), and to double check numbers.
Regarding the price, don’t forget their is also sales tax/VAT that is deducted too. Eg. Any sales made in the UK will have 20% vat removed, then Apple takes 30% and you get the rest.
Background
I have an application that supports in-app purchase with Apple subscription (in particular auto-renewable plans).
Using the WWDC 2016 slides material, in the Manage Subscription page, (inside iTunes & App Store -> View my Apple ID), we have this:
in which the user is allowed to change the current subscription plan (and also to cancel it). So far, so good.
Case scenario
I would like to simulate the scenario of a user changing account (or cancelling the current subscription) from the Manage Subscriptions page.
My issue (and possible solutions)
Thus, I am now facing the issue of testing the reported scenario.
It seems to conflict with Sandbox Account for testing purposes. In particular: if I try to login with the sandbox Apple ID into the iTunes Store & App Store page, I of course receive the message: iTunes Account creation not allowed (as reported in this question).
The most straight-forward solution seems the one reported in this thread (shortly: let the subscription plan auto-renew for 5 times with 5 minutes period, after which we should receive the 21006 error). Anyway, I am not sure that it could be applied to this case, since it seems only including the cancel my subscription case.
Another thread comes directly from the apple forum (this thread) but: (1) something is strange, i.e. the iTunes account creation not allowed error seems not to appear when logging into iTunes with sandbox accounts - while it happens to me systematically) and (2) even after logging in, the subscriptions are reported not to be shown.
I expect that everything works using a real Apple ID, but this is something I don't really want to do.
Conclusion (?) and question
So, finally :), my question. Is there a way to test the reported case scenario (or an equivalent one) without using a real apple ID, thus without triggering a real transaction? I don't really want to believe that the current sandbox testing mechanism does not include it.
Thanks in avance to all!
An iTunesConnect Sandbox test user account can test auto-renewing subscriptions but that account cannot login to iTunes and utilize the Manage Subscriptions.
Only Option
The only option I have seen being utilized is to essentially get your app fully approved for the app store (do not auto-release). Once approved, use a promo code to download and live test the Manage Subscription scenarios. If it all checks out, release the app. (I cant seem to find the link for this but will add it here if I come across it.)
Other Notes Testing Auto-Renewing Subscriptions
Duration times are shortened when test your auto-renewable subscriptions. Additionally, test subscriptions only auto-renew a maximum of six times.
Reference Link
~Emphasis is mine
1 week = 3 minutes
1 month = 5 minutes
2 months = 10 minutes
3 months = 15 minutes
6 months = 30 minutes
1 year = 1 hour
This thread has a response posted from an Apple Developer in regards to this situation. Link
I have an application that has a requirement for a user to be able to purchase an e-card. This is a digital image. The user is then permitted to share this e-card as many times as they wish within a 48 hour period (So, the card is visible in a 'My Cards' menu) It then disappears.
I'm looking through the apple documentation for IAP, and cant figure out if this should be a consumable, or a non-renewing subscription. I currently handle all the persistence and expiry myself within the app.
The problem with the latter is that it seems every card would need its own ProductID (Rather than me just having a product for 'A Card' and the app being aware of which one it is. There's over 200 cards so this doesn't seem feasible, but the methods one must implement don't seem to work like this. For example, a user may have 10 cards, all purchased at different times.
Does anyone know the correct type of purchase this should be, and the best way to implement it?
This answer Floored by new rejection on non renewable subscription type in app purchases in iphone? , rather old (2012), claims that subscriptions must last for at least 7 days. Apart from that, iTunes Connect has no problem with 200 different products.
A non-renewing subscription might work but the 7 day issue is a problem for you. A non-renewing subscription can be purchased many times so there is no problem with duplicate cards - as long as you keep track of that.
A consumable would work except a consumable can't 'expire in time' it can only 'expire when used'. So if I purchase a card as a consumable I must be allowed to keep it on my device for a long time until I want to use it. You could let the user do that - they keep the card but can't use it. When they want to use it then it gets consumed and for the next 48 hours they can use it as often as they want. You may need to explain to App Review that this is a consumable that does not expire but that can be used for a continuous 48 hour period once it finally gets consumed.
I'm creating an app that will unlock features to users for a limited time. Premium features let's call them. They can buy a subscription for a month, 6 months or a year. These subscriptions would be non-renewing. After a lot of searching the web and finding very different "solutions", I turn to StackOverflow for what the best should be.
When a subscription is bought, the end date is stored locally on the device until synced via iCloud, because Apple wants you to have this subscription on all your devices. The app checks iCloud to see if the current subscription is still available, shows a nice countdown for the users with days left. But I'm currently encountering a problem. When the user has paid for a month, and changes the date of the device to a year earlier (or something else), it can use the subscription for a year. The countdown now doesn't show 23 days left, but 389.
How can I avoid this?
Should I check a certain server to check for the real time and date?
What if a user only uses the app in airplane mode?
Thx in advance!
You could check standard web-based time-servers to do this. Since I have my own server (as part my in-app purchase mechanisms), I just ask my server for the current time, at the server. I do this every time the app launches, and every time I make a server-call (usually when in-app purchases are done). I then store the time locally (either in the KeyChain or NSUserDefaults, can't remember which!), and use it (and the device time, which ever is later in time) to compute purchase expiries.
Of course, this assumes that the user has a network connection when they launch the app. You can only do so much though!
Actually what happening is after successful completion of your InAppPurchase apple will provide you a Transaction Reciept...this transaction reciept is stored in locally . When you want to check the subscription is in active or expired you need to request the storekit with this transaction reciept then the store kit will give you the status .. if the status is 0 then it is in active state . if the status is 21006 then your transaction is Expired. If you want to continue the subscription in antoher device then you need to Restore the transactions there .. after completion of the restoration you will get all the product ids and the transaction reciepts.. you need to store the transaction reciepts there and you need to pass this for the storekit whether it is in active or expired state .. sorry for my poor english..
due to the fact that Apple requires at least one auto-renewable subscription or one free subscription for a newsstand app, we changed all monthly subscriptions of our news app to auto-renewable ones while adding newsstand functionality.
When I try to buy one of these subscriptions on device #1 (e.g. my iPad) everything works fine. When I try to buy the same subscription on device #2 (e.g. my iPhone), I get a message from the Store Kit telling me that I am already a subscriber of this certain issue (which is ok as well) but afterwards the process is finished without having bought anything.
Checking the log shows, that the SKPaymentTransactionObserver delegate method paymentQueue:updatedTransactions: first gets a transaction for that product in the state 'SKPaymentTransactionStatePurchasing' (ok so far) followed by transaction in the state 'SKPaymentTransactionStateFailed'. Having a closer look on the transaction error code and message of the last transaction, the transaction error description says "Cannot connect to iTunes Store'. A second purchase of another product (bought the first time on the second device) works perfectly. Both purchases are done against the sandbox, does anybody has a hint how to address this problem.
Thanks for your help in advance
Michael
It shouldn't be possible to to purchase the same auto-renewing subscription on multiple devices, instead you should implement restore functionality, and restore on the second device. It's worth noting that the sandbox uses time compression for testing, so a 1 month subscription, will actually auto-renew every 5 minutes or so, and will only renew 5 times in a day. it's possible the original subscription has expired by the time you try to repurchase for the second time.
Often the sandbox error messages are not useful, the "Couldn't connect to iTunes" is not relevant.
I would suggest reading the whole of this page very carefully, as there are a lot of important details it's easy to miss. The bit about restoring purchases is here:
https://developer.apple.com/library/ios/#documentation/NetworkingInternet/Conceptual/StoreKitGuide/MakingaPurchase/MakingaPurchase.html#//apple_ref/doc/uid/TP40008267-CH3-SW1
Best of luck