Use this page with AI

Copy this into your coding assistant and add your request.

Read https://openiap.dev/docs/features/external-purchase 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 →

External Purchase

Overview

External purchase allows you to redirect users to external payment systems instead of using platform-native billing (StoreKit on iOS, Google Play Billing on Android). This enables alternative payment methods and can reduce platform fees.

Platform Support

PlatformFeature NameMinimum OS VersionNative Framework
iOSExternal Purchase URLiOS 17.4+ (Notice Sheet)
iOS 18.1+ (Custom Links)
StoreKit 2
AndroidAlternative Billing / Billing ProgramsAndroid 6.0+ (API 23)Google Play Billing 6.2+ (legacy), 8.2.0+ (External Content Links), 8.2.1+ (External Offers), 8.3.0+ (External Payments)

Android Billing Programs at a Glance#

A billing program is Google Play's name for any way to pay outside Google Play Billing. Play Billing 8.2 put them all behind one API: pick the program with enableBillingProgramAndroid in initConnection, then use the calls for that program. Each program needs its own enrollment in Play Console and covers different countries.

ProgramWhereHow the user paysOpenIAP calls
user-choice-billingSouth Korea and other eligible countriesChooses Google Play or your billing inside the appuserChoiceBillingAndroid event
external-offerEEALeaves the app for your web checkoutopenExternalPurchaseLink
external-content-linkUnited StatesLeaves the app for web content or an app downloadlaunchExternalLinkAndroid
alternative-billing-onlyEligible countriesPays only with your billing, without Google PlayAlternative Billing Only
external-paymentsJapanChooses Google Play or your external payment side by sideExternal Payments
billing-choiceEligible countries (Play Billing 9.1+)Chooses Google Play, your billing, or a web link on Play's choice screengetBillingChoiceInfoAndroid

Play Billing 8.2 deprecated the standalone external offer calls (enableExternalOffer, isExternalOfferAvailableAsync and related); OpenIAP already uses the billing program calls in their place. User choice billing and alternative billing only remain current Play APIs.

Common Requirements#

Both platforms require the following infrastructure to support external purchases:

Backend Verification System

  • Payment gateway integration
  • Purchase verification endpoint
  • Entitlement management system
  • Transaction logging and auditing

To link out to a web checkout, call openExternalPurchaseLink. It shows the store's required disclosure, opens the URL only after the user continues, and returns the token to report from your server. The disclosure cannot be skipped, so the call cannot produce a flow that App Review rejects for a missing notice.

  • iOS 18.1+: ExternalPurchaseCustomLink notice, then a token of apple.tokenType (default acquisition; use link-out in Japan and Brazil).
  • iOS 17.4 to 18.0: the ExternalPurchase notice sheet, which returns the token.
  • Google Play: the external offers program (Play Billing 8.2.1+). Play shows its own dialog before it opens the link. Initialize with enableBillingProgramAndroid set to external-offer.
  • Amazon, Meta Horizon, Vega OS, macOS, watchOS, iOS before 17.4: always unavailable.
ts
import {
  isExternalPurchaseLinkAvailable,
  openExternalPurchaseLink,
} from 'expo-iap'; // or 'react-native-iap'

if (await isExternalPurchaseLinkAvailable()) {
  const result = await openExternalPurchaseLink({
    url: 'https://example.com/checkout',
  });
  if (result.status === 'opened') {
    // Send result.reportToken to your backend and report it as the store requires.
    await api.saveExternalPurchaseToken(result.platform, result.reportToken);
  }
}

The store entitlement or program enrollment is still required. On Android, use the platform calls below for alternative billing and billing choice. The step-by-step iOS calls are deprecated and are removed in client protocol 2.0.0.

Platform-Specific Implementation#

iOS - External Purchase

iOS supports external purchase through StoreKit's External Purchase API. The notice sheet presents within the app and returns results immediately - no browser redirect required.

Basic Usage

Call openExternalPurchaseLink. It picks ExternalPurchaseCustomLink on iOS 18.1+ and the notice sheet on iOS 17.4 to 18.0. The step-by-step calls it replaces (canPresentExternalPurchaseNoticeIOS, isEligibleForExternalPurchaseCustomLinkIOS, presentExternalPurchaseNoticeSheetIOS, and presentExternalPurchaseLinkIOS) are deprecated and keep working until client protocol 2.0.0.

Requirements

  • iOS 17.4+ - Required for openExternalPurchaseLink
  • iOS 18.1+ - Required for the ExternalPurchaseCustomLink APIs
  • StoreKit 2 - Uses StoreKit 2 framework
  • Entitlement required - com.apple.developer.storekit.external-purchase entitlement must be configured in App Store Connect
  • Country code configuration - Must specify supported country codes in SKExternalPurchase array in Info.plist. Only available in EU countries and South Korea. See Apple Documentation
  • No deep linking required - Notice sheet presents within the app and returns results immediately

Configuration (iOS)

Add entitlement and country codes in Info.plist. Use lowercase ISO 3166-1 alpha-2 country codes:

1. SKExternalPurchase (Required)

Specify countries where your app supports external purchases:

xml
<key>SKExternalPurchase</key>
<array>
  <!-- South Korea -->
  <string>kr</string>

  <!-- Netherlands -->
  <string>nl</string>

  <!-- EU Countries (examples) -->
  <string>de</string>  <!-- Germany -->
  <string>fr</string>  <!-- France -->
  <string>it</string>  <!-- Italy -->
  <string>es</string>  <!-- Spain -->
  <!-- Add other EU country codes as needed -->
</array>

<!-- Entitlement required -->
<!-- com.apple.developer.storekit.external-purchase: true -->
2. SKExternalPurchaseLink (Optional - iOS 15.4+)

Provide destination URLs for each country. Required if using com.apple.developer.storekit.external-purchase-link entitlement:

xml
<key>SKExternalPurchaseLink</key>
<dict>
  <key>nl</key>
  <string>https://your-site.com/checkout</string>

  <key>de</key>
  <string>https://your-site.com/de/checkout</string>

  <key>kr</key>
  <string>https://your-site.com/kr/checkout</string>
</dict>
3. SKExternalPurchaseMultiLink (iOS 17.5+)

Provide multiple URLs (up to 5) for each country. Use this instead of SKExternalPurchaseLink for iOS 17.5+:

xml
<key>SKExternalPurchaseMultiLink</key>
<dict>
  <key>es</key>
  <array>
    <string>https://your-site.com/es1</string>
    <string>https://your-site.com/new-user-es</string>
    <string>https://your-site.com/seasonal-sale-es</string>
  </array>

  <key>fr</key>
  <array>
    <string>https://your-site.com/fr</string>
    <string>https://your-site.com/global-sale</string>
  </array>

  <key>it</key>
  <array>
    <string>https://your-site.com/global-sale</string>
  </array>
</dict>
4. SKExternalPurchaseCustomLinkRegions (iOS 18.1+)

For custom links to communicate and promote offers. Required if using com.apple.developer.storekit.external-purchase-link entitlement and ExternalPurchaseCustomLink API:

xml
<key>SKExternalPurchaseCustomLinkRegions</key>
<array>
  <string>de</string>  <!-- Germany -->
  <string>fr</string>  <!-- France -->
  <string>nl</string>  <!-- Netherlands -->
  <!-- Add other EU country codes -->
</array>
5. SKExternalPurchaseLinkStreamingRegions (iOS 18.2+)

For music streaming apps only. Required if using com.apple.developer.storekit.external-purchase-link-streaming entitlement:

xml
<key>SKExternalPurchaseLinkStreamingRegions</key>
<array>
  <string>at</string>  <!-- Austria -->
  <string>de</string>  <!-- Germany -->
  <string>fr</string>  <!-- France -->
  <string>nl</string>  <!-- Netherlands -->
  <string>is</string>  <!-- Iceland -->
  <string>no</string>  <!-- Norway -->
  <!-- Add other EU country codes -->
</array>

Common Issues (iOS)

IssueCauseSolution
Notice Sheet Not ShowingMissing entitlement or country codeAdd com.apple.developer.storekit.external-purchase entitlement and configure SKExternalPurchase array
canPresent Returns FalseDevice region not supportedCheck device is in supported country (EU, NL, KR)
FeatureNotSupported ErroriOS version too oldRequires iOS 17.4+ (notice sheet), iOS 18.1+ (custom links)

Implementation Flow#

The complete external purchase flow involves coordination between your app, external website, and backend. The flow differs between iOS and Android:

iOS Flow (iOS 17.4+)

StepAPI / ActionDescription
1isExternalPurchaseLinkAvailable()Check that this app and device can link out
2openExternalPurchaseLink(request)Shows Apple's notice, opens the URL if the user continues, and returns the report token
3Backend Payment ProcessingApp calls backend API to process payment with payment gateway (Stripe, PayPal, etc.) and grant entitlements
4Unlock ContentApp unlocks purchased content after backend confirmation

Complete Examples#

For complete, production-ready examples with full UI implementation, please refer to the native example apps:

iOS (SwiftUI)

This example demonstrates:

  • Complete UI implementation with state management
  • Apple's disclosure before the link opens (iOS 17.4+)
  • Deep link handling and verification flow
  • Error handling and user feedback
  • Production-ready code patterns

Native References#