I'd like to test CANCEL events...
My understanding is that when users switch between two items within the same group (down/up grades) - the old one is CANCELed and a new one PURCHASEd.
How would I simulate that in a sandbox?
The iTunes SUBSCRIPTION manager doesn't seem to be available on the device when I'm logged into a sandbox account. I'd also like to change subscription status from there also.
You cannot manage subscriptions in the sandbox, but there is nothing special about the upgrade/downgrade process. You just check the in_app field of the receipt as per usual.
For a downgrade, you will receive a purchase event/updated receipt containing the new, lower, subscription product at the end of the current period. If you validate the receipt then you will also see the new product in the auto_renew_product_id that indicates the product that will renew at the end of the current period
For an upgrade, you will receive a purchase event and updated receipt immediately.
Related
I am implementing auto renewable subscription in my iOS application. Monthly subscription auto renews after 5 mins in sandbox mode. I have added transaction observer in appDelegate. So when app restarts updated transaction method gets called and i m getting following logs.
payment store product purchased il_pkg1_1month_2
payment storee product purchased transaction id Optional("1000000792969469")
payment store product purchased il_pkg1_1month_2
payment storee product purchased transaction id Optional("1000000792972183")
payment store product purchased il_pkg1_1month_2
payment storee product purchased transaction id Optional("1000000792976003")
payment store product purchased il_pkg1_1month_2
payment storee product purchased transaction id Optional("1000000792978690")
payment store product purchased il_pkg1_1month_2
payment storee product purchased transaction id Optional("1000000792982052")
My questions are
1)This method is not getting called when app is open and transaction is renewed. is this correct behaviour?
I am planning to implement verification of receipt when this Method is called (on server side). So Suppose when i open app and transaction is auto renewed multiple times.Do i need to implement verify receipt for each transactions or the latest one only? How to verify receipt if app is open and transaction is auto renewed?
3)I have 3 kind of plans in same subscription group. I am not able to upgrade/downgrade in sandbox mode, is it possible to test upgrade/downgrade in sandbox mode?
4)After subscription has expired, if i renew subscription from manage subscription page updated transaction method is called but i m getting same transaction as before renewal.Even transaction expiry date is same as before renewal. Is this correct behaviour, do i need to do any additional things.
Any help would be appreciated.
That is the expected behaviour, also note that with each of the subsequent purchases there is an original_transaction_id so you can tell what the original purchase was.
Whenever you call your server receipt verification, you send up the receipt data the app has currently, and Apple always returns the very latest receipt info. So you can call Apple whenever you like to verify a subscription is still active, or an any subsequent transition to verify a re-subscriptiuon happened. You can also store the data from the app receipt on the server to check from time to time only on the server side, to verify a subscription is still active and has not been cancelled.
I think you used to be able to upgrade/downgrade in sandbox, if not from the sandbox account editing page in device settings, then try by allowing a downgrade/upgrade purchase in your app. At the very least I believe it should work using Xcode 12 App Store configuration local StoreKit testing.
I am not sure if that behaviour you are seeing is normal, If you subscribe after a subscription has lapsed, it should behave like a new purchase - but would still have an original_transaction_id of the original subscription.
I am developing an app which requires auto renew subscription monthly and I want to maintain that on per user basis who logged into my app. is it possible anyhow with in app purchase. Also how can we handle cancelation of subscriptions ?
I want to maintain all this on my own server.
In the StoreKit documentation, it mentioned in Cancellation section:
A subscription is paid for in full when it’s purchased and can be
refunded only by contacting Apple customer service. For example, if
the user accidentally buys the wrong product, customer support can
cancel the subscription and issue a refund. It’s not possible for
customers to change their mind in the middle of a subscription period
and decide they don’t want to pay for the rest of the subscription.
To check whether a purchase has been canceled, look for the
Cancellation Date field in the receipt. If the field has a date in it,
regardless of the subscription’s expiration date, the purchase has
been canceled—treat a canceled receipt the same as if no purchase had
ever been made.
Depending on the type of product, you may be able to check only the
currently active subscription, or you may need to check all past
subscriptions. For example, a magazine app would need to check all
past subscriptions to determine which issues the user had access to.
Bear in mind that users can cancel the subscription anytime without opening your App. Therefore, you have to check the status of subscription every time the user logs into your App.
I am implementing a sample which includes the in-app purchase feature. The subscription is of non-renewal type.
In case of auto-renewal subscription, if the user has made a purchase, and within the validity period if the user retries to make the purchase, the iTunes shows the alert that
You are already subscribed to the purchase
and won't proceed further. The user can restore his subscription using the app restore feature.
But in case of non-renewal subscription type, if a user has made a purchase, and within the validity period if the user retries to make the purchase, the iTunes shows a confirmation alert that
You have already purchased the subscription, to renew or extend the
subscription press buy or press cancel
and if the user presses buy it proceeds further.
So, my doubt is what exactly happens in the later case (non-renewal repeated subscription).
Is the user again charged?
What happens with the user's subscription validity?
Can it be handled and controlled inside the code by me?
In case yes, any idea to proceed with would be highly appreciated and will be very helpful for me.
Thanks in Advance.
For Apple, there is no "within the validity period" for non-renewing subscriptions. The duration of the period, fortunately or unfortunately, is left up to the developer.
Yes, when the user buys a non-renewing subscription a second (or third, etc) time, the are charged again.
Subscription validity is up to the developer.
It seems common for developers to use their own server to track the expiry period of a non-renewing subscription. For example, this helps with the "restore" feature required by Apple.
You can alter the subscription start date from the day of repurchase of the APP. This will enable extended validity.
This validity extension mechanism also serves when the user realizes his subscription is about to expire and renews it before hand rather than letting the subscription end.
From the development perspective, logging the first subscribed time along with the current sub and expire time would serve the purpose.
Yes i am altering the subscription start date obviously, and i am getting this from the transaction. According to this subscription start date i am altering the expiry date as well.
The concern here is to avoid the user from getting charged again in any case if he has already subscribed. And, for that i am using iCloud to support restore functionality in user's multiple devices.
I've been reading the various threads on in-app purchases auto-renewal subscriptions, and I think I've pieced together most of the information I need, but there are a few missing pieces. I'm hoping someone can help me.
The situation:
I have various subscription packages the user can subscribe to (e.g., package A for £1 a month, package B for £2 a month, etc.). I store the user's subscription information in my database. When the user logs in, I check which package he's on and if it's expired or not. My website, android and iOS all use the same database, hence this approach seems to make sense.
Subscribing users via in-app purchase seems straight forward enough. I check paymentQueue and once the payment is cleared, I can update my database.
My questions:
1) My understanding is the user can use iTunes to manage their subscription. Say, they go in to iTunes and cancel their subscription, how can I be notified so I can update my database? Do I need a daemon that checks expired subscriptions to see if the user renewed?
2) If the user wants to upgrade their subscription from Package A to Package B, how do I handle the pricing? Say on Jan 1st, they buy Package A, I charge them £1.00 and set the expiry date to Jan. 31st. On Jan. 15th, they want to upgrade to package B via in-app purchase. Ideally, I would charge them £2 for Package B minus £0.50 of credit they have for Package A and set the new expiry date to feb 14th. However, Apple forces me to associate each package with a tier price. How can I handle this? I don't want the user to wait until the end of the month to put them on a higher tier package...if they upgraded mid-month, it means they want the new content package B will deliver to them immediately.
Any help appreciated!
Thanks!
1) Yes you'll have to reverify your receipt check out the Receipt Validation Programming Guide in the documentation. They mention some important keys:
status - 0 if receipt is valid, or an error code
receipt - JSON response of the receipt
latest_receipt (auto-renewable only) - base 64 encoded receipt for the most recent renewal
latest_receipt_info - JSON version of latest_receipt
With this information, when a purchase is made, send the receipt to your backend for validation, the backend will keep the receipt in the DB and verify with status = 0 that it's a valid receipt. From there, every x days you can validate that receipt with a chron job, daemon, etc. and reverify. The response back each time will have latest_receipt_info that you now need to save to your DB so you have an up-to-date receipt for the next check in x days. This way you will always have the latest receipt. There is no instant notification for telling when a user cancels a subscription, but with this you'll know every x days if they have the subscription still.
2) Pricing like this unfortunately can't be handled. It was not intended for a user to "upgrade" with subscriptions - each subscription is access to it's own exclusive content as of this writing. However, if a customer emails in and complains about it, you could ask for their user name and figure out in your DB if this user has indeed upgraded mid-month and reimburse them appropriately. Very old-school and not feasible for a big user base, but hopefully you won't have that many and can keep them happy.
EDITED
For the second question, Apple's auto-renewable subscription system does not technically offer upgradeable plans between different products.
Every subscription is a stand alone product and it's up to the user to turn on/off subscriptions manually using the Subscription Manager in the iTunes Store.
However if package A and package B offer the exact same content only different duration than what ajay_nasa said is correct, you can create an single auto-subscription product with different duration options. If the user is on 1 month subscription and then the user tries to change to 2-months subscription they will get the following error message asking them go to the App Store's subscriptions manager
So basically the ONLY place the user can actually change the subscription's length is in the App Store. Whether Apple decide to pro-rate the amount left on the old subscription or just append it to the current one is really up to Apple. You need to make sure the user have access to the subscription as long as it's active by reading the Original Purchase Date and Subscription Expiration Date field from each receipt entry and determining the start and end dates of the subscription.
Answering question 1, you can verify subscription receipts in the same way as other IAP, but you'll need to check it periodically to see if the subscription has expired (the verification will tell you if it's expired).
There is more info on the Apple docs here:
http://developer.apple.com/library/mac/#documentation/NetworkingInternet/Conceptual/StoreKitGuide/RenewableSubscriptions/RenewableSubscriptions.html
Actually, Apple's auto-renewable subscription system does offer upgradeable plans.
To achieve this we simply should add duration in existing Auto-Renewable Subscription. Every Auto-Renewable Subscription could be family of Subscriptions so whenever developer wants to achieve upgradation in subscription he should add duration in existing Auto-Renewable Subscription with different productID.
Whenever, user upgrade his plan in between the month then his upgrade plan will be automatically works from next month.
Answering to your question #1
Recently Apple launched a feature to enable server notification whenever the subscription is renewed. However, the subscription should be in-app.
See the links given below for your reference:
https://help.apple.com/itunes-connect/developer/#/dev0067a330b
&
https://itunespartner.apple.com/en/apps/news/45333106?sc_cid=ITC-AP-ENREC
We Need to Check Cancellation-Date provided in Receipt.
I'm having in-app purchase subscriptions in my app. I'm able to integrate and make subscriptions successfully. There are 3 different subscriptions, monthly, quarter and yearly.
So if user subscribes to monthly user can use that feature for 30 days. There's no server in my case. Only availability of some features will be activated/deactivated according to subscription.
When ever the app starts, i want to check whether user paid for subscription or not. If I'm maintaining some bool value in subscriptions, what if the user has deactivated the subscriptions from settings? How can I detect whether the subscriptions are valid or not?
You can add counter and add that counter value in a database that must be inside your app. Whenever user tries to access subscriptions you can verify from the database.
You have to post the receipt back to apple server and from the response we receive, we can identify the expiry date. Then I'll know whether the subscription is expired or renewed etc.
Visit Apple documentation