Copy this into your coding assistant and add your request.
Read https://openiap.dev/docs/apis/init-connection 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]
Initialize the store connection and wait for a successful result before starting store operations.
iOS: Receives promoted IAPs through PurchaseIntent.intents on iOS 16.4+ (and SKPaymentQueue only on iOS 15–16.3) and starts a Transaction.updates listener that drives the purchase event stream. Safe to call repeatedly. It also connects when Screen Time or MDM blocks purchases (AppStore.canMakePayments is false): reads and restore keep working, and requestPurchase rejects with iap-not-available. Apple docs. React Native and Expo can connect on demand on iOS, but an explicit call keeps listener setup and cross-platform gating predictable. Android: Starts BillingClient and waits for onBillingSetupFinished. React Native and Expo do not open it implicitly; wait for true or the hook's connected flag before another Play Billing call. Meta Horizon additionally requires a current foreground Activity; initialization fails with MissingCurrentActivity instead of falling back to an application context. Google docs.
Pass an optional InitConnectionConfig — Android billing program flags. iOS ignores Android-specific fields.
enableBillingProgramAndroid(optional, BillingProgramAndroid) — Android. Enable a Play Billing program at connection time. EXTERNAL_CONTENT_LINK and EXTERNAL_OFFER require Billing 8.2.1+; EXTERNAL_PAYMENTS requires Billing 8.3.0+ (Japan only); BILLING_CHOICE is available in OpenIAP 2.1.0 / openiap-google 2.3.0 and requires Billing 9.1.0+.
billingChoiceScreenTypeAndroid(optional, BillingChoiceScreenTypeAndroid) — OpenIAP 2.1.0 / openiap-google 2.3.0. Requires Play Billing 9.1.0+ and must match the Billing Choice renderer configured in Play Console. Defaults to GOOGLE_RENDERED; set DEVELOPER_RENDERED when your app owns the choice screen.
On Google Play and Meta Horizon, calling initConnection(config) on an already connected client returns true and ignores the config, so end the connection first to change the billing program; Godot Android instead returns false and emits a developer error when the config differs.