Testing In-App purchases for multilanguage - ios

I have included various localized descriptions in iTunesConnect (English, French, Chinese) for an in-app product. I am displaying the localizedTitle and localizedDescription properties after fetching them from apple's server using an SKProductsRequest.
My understanding from the docs and other threads is that if I change the test phone to the relevant language it will display the correct language. However in testing with my phone in French or Chinese the product descriptions are still in the original English.
I am not logged on with any iTunes account during the testing (Settings=>Store=>Signout).
Can anyone provide any hints how to test the IAP multilingual functionality?

I believe the localization that the store returns for the product description is based on the assigned iTunes store of the test user you are using. The device's language setting only pertains to the resources loaded locally.

After further testing I have confirmed that #claireware was in fact correct in his answer.
The tester is not able to manually change or set the store for testing (Apple docs state not to login with test user (Settings=>Store=>Signin)). However if you make a test purchase and enter the test users credentials at the prompt the device will warn you that it is changing to the test user country's iTunes store. After you make a test purchase the test user will be logged in and your subsequesnt SKProductRequest will return information localized for that store.
In summary for localization testing I followed these steps:
In iTunesConnect create one or more SKProducts with localized
text in English, French and Chinese. (no I dont know French, so I
just used random French words for testing)
Created two new test user accounts: frenchtestuser#mydomain.com &
chinatestuser#mydomain.com, set to the France and China store
respectively.
On the device go to Settings=>Store=>Signout
Run the app and initiate a purchase
At itunes account dialog prompt login with frenchtestuser account
AFter purchase complete perform a new SKProductsRequest
Confirm dialog prompts and product details display the French
localization
Close app and start again from step 3 this time logging in with
chinatestuser account.

Related

Test flight locale does not return local locale for associated apple id

We have an app implements subscription feature vi app store. We show subscription fee on our app which value is taken from StoreKit.
When distributing as ad-hoc all despite the associated app store of apple id used to sign in the device, StoreKit always return Japanese locale(we develop our app in Japan)
When distributing as Test Flight then Store Kit locale returns US locale.
We don't know if they are some testing feature controlled by apple or we did something wrong.
Anyone know why this is happening and if it will return proper locale if deployed to app store.
To solve this issue, create a sandbox user in your Testflight management console and set the correct language/region for it. Then, on the testing device go to Settings -> App Store -> Sandbox User and sign in with that user.
Some time ago, only sandbox users could test in-app purchases. Nowadays, however, every user gets an automatically assigned sandbox user when testing an app through test flight. This auto-created user gets the locale US assigned to it.
Source: https://developer.apple.com/forums/thread/101316

In App Purchase sandbox - Invalid address

I have implemented In App Purchase in so many applications and tested all of them in Sandbox environment. Right now I am working on one of the app's In App Purchase, which i tested yesterday and was working fine, but by today morning none of the existing sandbox accounts working for In App test.
I followed one of the apple thread to solve issue but nothing seems to be working.In this thread so many developers faced same issue, some of them come with solution, but none of them works for me.
I have tried below solutions till now:
Add new product with all meta data and tried with new product Id.
Created fresh demo app to test In App Purchase with new certificates and profiles.But not working.
Created new sandbox tester, verify it from mail account.
I am able to fetch product info like Product name and price but not able to complete purchase. At first when OS ask to enter Apple ID and Password for Sandbox user I entered it, it accept credential and iTunes logged in with sandbox user.But then suddenly another OS alert prompt with Invalid Address.
Find below screen shot of that alert.
When I tapped Continue, then it redirects to iTunes Store and after some loading, it display another alert with iTunes account creation not allowed. Below screen for that alert.
I have tried all possible solution but nothing worked for me. If any of you ever faced same problem then please update here.
I tried sandbox account with App Store Territory as United States and United Kingdom and it works, but with Indian Accounts not working.
Follow below steps to create Sandbox Account:
Open itunesconnect.apple.com
Select Users and Roles
Select Sandbox Testers
Select + button
From App Store Territory , you can create Sandbox Account for any country and test In App Purchase
Select country as United States or United Kingdom, works for me.
The "technerd" solution works properly in current situations, by using territory as "United States"
In case of Indian account, we need to follow the following extra steps.
1) After signin to iTunes Store message, we will get error in case of Indian Account.
"This apple ID is only valid for purchases in the U.S. iTunes Store. You will be switched to that Store." Touch OK
2) This will take us to iTunes store link, and come back to same view.
3) Sign - in again.
4) Success message will appear as
"You're currently subscribed to this. ..."
Hope this helps to persons like me.
Apple server looks like inappropriate, Wait for some time & try again.
Please logout with your sandbox account from your phone.Then make another account with App Store territory as United States, not as India.
I am sure it will works.
I am facing same problem ,as soon as i change Country ,it works like a charm.

In-App-Purchase sandbox testing - Purchasing Not Supported in your region

I developing an App for Ukrainian people with In-App-Purchase. When I add sandbox tester with Ukraine location and try purchase I am getting this alert .
If I use some other location, Russia for example - thats good. My App is for Ukrainian people and I am disturbed by this.
Does anybody know how to resolve this issue?
Apple is a US company and are therefore they are prohibited from carrying out business transactions with the Crimea region of the Ukraine as per executive order 13685 section 1 (a) (iii)
(iii) the exportation, reexportation, sale, or supply, directly or indirectly, from the United States, or by a United States person, wherever located, of any goods, services, or technology to the Crimea region of Ukraine;
I suspect that since you don't enter an address, just a store, when creating a sandbox user, they don't know which region you are in and they default to blocking the purchase. In production, a user has a registered address which lets Apple block purchases more selectively.
It looks like you will need to complete your testing with a user from another store.
Note: iOS 12+ Only
Sign in into your main account. Then you will see option for SANDBOX ACCOUNT.
Use not Ukrainian test account and test your purchases.
Sandbox Account Image:
You need to create the sandbox tester, related to not Ukrainian Itunes Store. Something like this:
Many thanks to Mike form Cherrypie Studio
I had the same error that was caused by using test user with Ukrainian country. But that error didn't go away even after I logged out from that account, created new non Ukrainian one, logged in(many times), logged out (many times), deleted an app, restarted the phone...
The only thing that helped was device reset. Only after that system stopped showing me that error and I finally saw App Store login window again.

Testing localized in-app purchases

Running the app with the Scheme set to another language does not affect the SKProduct received from iTunes in testing. The only way I’ve found to affect change is to create a new Sandbox Tester User in iTunes Connect with an iTunes Store for each... and every... language you might want to test.
Then - you should NOT login with that user on your device through Settings. Run your app and login with the test user when asked.
This successfully got my phone to be defaulting to the App Store for a different country.
But still, when I printed to the console each SKProduct’s .localizedTitle, .localizedDescription, and .price - only the price was translated to the different country’s numbers. The title and description remained in English (I’m developing in the United States). All the languages are set up in iTunes Connect.
When I click to purchase an in-app, the system pop up is in English: "Confirm Your In-App Purchase" and then "Do you want to buy one ____ for ___?" and "Cancel" and "Buy" buttons all in English. The first blank is filled in by Display Name that I set in iTunes Connect. But it is still using the English version. And the second blank is filled in with the price, which IS SHOWING in the language of the Test User's store. [separate issue: Japanese shows the Yen symbol and price. Spain shows the Euro symbol and price. Mexico shows the Dollar sign with the Peso price.]
So only the price translates for my Sandbox Tester account. Anybody know how to get the title in a different country’s language during testing? Not only do I want to make sure that it will look right to people in each country I've localized the app for, I’d like to set the SKProducts' titles as labels on buttons in my app to launch the in-app purchases. I could set these through the Localizable.strings file but would prefer to pull it from the SKProduct since I've already entered that information through iTunes Connect.
Thanks for any help!
Here is what I've been able to figure out, to the best of my ability. This is pretty tricky to test... sometimes needed to run the app 3 or 4 times and load the list of SKProducts over and over again before a localizedDescription would change to the language I was trying to test.
I was trying to figure out if these are controlled by logging in with a Sandbox Test User that was created with an iTunes Store set to another country? Or by the iPhone's language chosen in Settings?
SKProduct's .price, SKProduct's .localizedTitle, SKProduct's .localizedDescription, and the system pop up "Do you want to buy one ____ for ___?" / "Cancel" / "Buy"
It seems to me that to properly get all the values for each language, you need BOTH to have changed the phone's system language AND to log in with a Sandbox Test User created for the country's App Store.
To populate my button text, I did the following:
let formatter = NSNumberFormatter()
formatter.numberStyle = .CurrencyStyle
formatter.locale = productName.priceLocale
let cost = formatter.stringFromNumber(productName.price)!
labelForButton = "\(cost) " + productName.localizedDescription
You are right: change Scheme's language will not affect the SKProduct.
Go to change "App Store's Country/Region", then you can see the changes, how to change:
https://apple.stackexchange.com/a/89186/283550
Also refer to my answer in another post:
https://stackoverflow.com/a/52418249/3260008

Is there any ways to track user in app purchase without application login

I'm creating an app that use IN-App Purchase and I want to track the user Purchase on my server so user doesn't have to redownload the same purchase. But my client want that to do without the login module in app.
I don't mean that do purchase without the iTune/app-store login. I means I don't want to make user login in application.
So does iTune/app-store provide us some special user related unique identifier to know that this is the same user which downloaded this purchase before.
EXAMPLE
Suppose if user have downloaded English Language Pack from the iPhone and when he try to download same Language Pack from the iPad with same Apple id than our server can know that this is the same user and provide him his all previous purchase(which is English Language Pack downloaded in iPhone and already done payment using in-app purchase) on the iPad also.
This is how i think i can do this (but this logic only be successful if apple provide some unique id for user)
So if apple provide some unique identifier on the purchase to my app than i will store it on my server when user download the English language pack on iPhone and when he tries to download same language pack in iPad than apple again provide me his unique identifier and i will compare this id on my server and know that i have to let user download this language pack
So Does apple provide UniqueID for user or we can find the Users Apple Id(not password)?
What you're looking for is 'restore purchases' functionality in StoreKit.
Note that not all in-app purchases can be restored this way.
But I think that in your case - permanent functionality purchase - you can use iOS 7 new SKReceiptRefreshRequest class.
If you have to support older versions of iOS, use [SKPaymentQueue restoreCompletedTransactions](SKPaymentQueue API reference).
EDIT : 'purchases' that appear in the receipt depend on product type, see tables at bottom of this page
No, you need to do your purchases trough the In-App Purchase, Apple is not going to allow you to use your own service.
Summarizing, you cannot sell anything on your app that is not trough Apple.
After your edit:
If you want that a user has the same product in iPhone and iPad, you have to indentify that user somehow, let say with his email. then when the user buys one thing, store that email on the server, and give the product for that user for free in the iPad.
You have to store something if you want to recognize that user in iPhone and iPad.

Resources