ADVANCED
How to detect iOS Storefront?
When distributing your app through Apple's App Store, you may need to detect the current storefront to implement region-specific functionality. The storefront represents the App Store region that the user is currently using, identified by a three-letter country code (e.g., "USA" for United States).
This detection is particularly important because several storefronts now permit developers to direct players to external payment pages — the United States (Epic v. Apple), Japan (Mobile Software Competition Act), Brazil (CADE settlement), and the European Union (Digital Markets Act). You can use the storefront detection to:
- Enable external payment links for the storefronts that permit them
- Implement region-specific payment flows
- Control feature availability based on regional requirements
- Ensure compliance with local regulations
If the app is installed via alternative distribution (for example, an alternative marketplace/web distribution under the DMA), the Storefront country code may be unavailable and returned as an empty string. In that case, use the store installation detection guide to determine whether the app is running in an alternative distribution environment.
To determine the current iOS storefront and control SDK functionality based on the region, use the following code snippet:
XsollaStoreClientInfo.GetAppleStorefront((storefront, error) =>
{
if (error != null)
{
Debug.LogError($"Failed to get Apple Storefront: {error}");
return;
}
// Storefronts where Apple permits external payments, using an external browser.
// In the EU either flow is allowed, so add its codes here only if you route out to the web.
bool allowsExternalPayments = storefront == "USA" || storefront == "JPN" || storefront == "BRA";
settings = XsollaClientSettings.Builder.Update(settings)
.SetWebViewType(allowsExternalPayments
? XsollaClientSettings.WebViewType.External
: XsollaClientSettings.WebViewType.Auto)
.Build();
});