Use this page with AI

Copy this into your coding assistant and add your request.

Read https://openiap.dev/docs/apis/get-storefront and https://openiap.dev/llms.txt. Follow the reading instructions, detailed reference, and linked guides relevant to my task before making changes.
Inspect my existing project and reuse its framework and conventions. Ask me for missing product decisions. Implement the requested behavior and run the applicable checks.
Show the working result, the commands and actual test results, and any remaining limitations. Keep your explanation brief.

My request: [describe what customers should be able to do]
See an example request →

getStorefront

Get the storefront country code for the active user.

iOS: Reads Storefront.current?.countryCode (StoreKit 2). Returns the user's App Store storefront, not the device locale. Apple docs. Android: Reads BillingConfig.countryCode from BillingClient.getBillingConfigAsync. Reflects the Play Store account region, not the SIM/device locale. Google docs.

On a Meta Horizon build the billing client answers getBillingConfigAsync with FEATURE_NOT_SUPPORTED, so getStorefront rejects with that code rather than returning a country. Observed on a Quest 3 with horizon-billing-compatibility 2.0.0. Read the region from your own backend on that store.

Signature

swift
func getStorefront() async throws -> String

Returns#

Promise<string> — the store account's country code. StoreKit returns ISO 3166-1 alpha-3 (for example "USA" or "KOR"). Google Play Billing and Horizon return alpha-2 country codes, while Amazon returns its alpha-2-like UserData.marketplace value (for example "US" or "DE"). This is not the device locale. A failed store lookup rejects or throws a platform-mapped purchase error without firing purchaseError listeners. The exceptions are an automatic iOS connection that fails with init-connection, KMP on Android before the store connects (not-prepared), and Godot, which cannot throw, so it returns an empty string and emits purchase_error.

Example

swift
let countryCode = try await OpenIapModule.shared.getStorefront()