External Purchase Link Types

iOS-specific feature for redirecting users to an external website for payment using Apple's StoreKit ExternalPurchase API. Available from iOS 17.4+ (notice sheet) and iOS 18.2+ (custom links).

Result of presentExternalPurchaseLinkIOS. iOS only — wraps ExternalPurchaseLink.open(url:) (Apple docs).

Important: External purchase links bypass StoreKit completely. No purchaseUpdatedListener will fire. You must implement deep links and server-side verification.

External Purchase APIs#

APIDescriptionAvailability
canPresentExternalPurchaseNoticeIOSCheck if external purchase notice sheet can be presentediOS 17.4+
presentExternalPurchaseNoticeSheetIOSPresent Apple's compliance notice sheet (required before external purchase)iOS 17.4+
presentExternalPurchaseLinkIOSOpen external purchase URL in SafariiOS 18.2+

Types#

ExternalPurchaseNoticeResultIOS

NameTypeSummary
resultExternalPurchaseNoticeActionUser action on the notice sheet (continue or dismissed)
errorstring?Optional error message if presentation failed
externalPurchaseTokenstring?External purchase token returned when result === 'continue'. Report to Apple's External Purchase Server API.

ExternalPurchaseLinkResultIOS

NameTypeSummary
successbooleanWhether the user completed the external purchase flow
errorstring?Optional error message if presentation failed

Returned by getExternalPurchaseCustomLinkTokenIOS (iOS 18.1+).

NameTypeSummary
tokenstringToken to send to Apple's External Purchase Server reporting API.
errorstring?Populated when token creation fails.

Returned by showExternalPurchaseCustomLinkNoticeIOS (iOS 18.1+).

NameTypeSummary
continuedbooleanWhether the user chose to continue to the external purchase.
errorstring?Populated when the sheet failed to present.
swift
// Result from presenting external purchase link
struct ExternalPurchaseLinkResultIOS {
    let success: Bool
    let error: String?
}

// Result from presenting notice sheet (iOS 17.4+)
struct ExternalPurchaseNoticeResultIOS {
    let result: ExternalPurchaseNoticeAction
    let error: String?
    // External purchase token returned when result == .continue
    let externalPurchaseToken: String?
}

// User action on notice sheet
enum ExternalPurchaseNoticeAction: String {
    case `continue` = "continue"
    case dismissed = "dismissed"
}

External Purchase Flow#

The external purchase flow requires 3 steps for Apple compliance:

  1. Check availability - Verify the device supports external purchase
  2. Present notice sheet - Show Apple's required disclosure
  3. Open external link - Redirect to your payment page

Complete Example#

swift
import OpenIap

@available(iOS 18.2, *)
func handleExternalPurchase(externalUrl: String) async {
    do {
        // Step 1: Check if external purchase is available
        let canPresent = try await OpenIapModule.shared.canPresentExternalPurchaseNoticeIOS()
        guard canPresent else {
            print("External purchase not available on this device")
            return
        }

        // Step 2: Present Apple's compliance notice sheet
        let noticeResult = try await OpenIapModule.shared.presentExternalPurchaseNoticeSheetIOS()
        guard noticeResult.result == .continue else {
            print("User dismissed the notice sheet")
            return
        }

        // Step 3: Open external purchase link
        let linkResult = try await OpenIapModule.shared.presentExternalPurchaseLinkIOS(externalUrl)
        if linkResult.success {
            print("User redirected to external payment")
            // Implement deep linking to handle return from payment
        } else if let error = linkResult.error {
            print("Failed: \(error)")
        }
    } catch {
        print("External purchase error: \(error)")
    }
}

Requirements#

RequirementDetails
PlatformiOS 17.4+ (notice sheet), iOS 18.2+ (custom links)
EntitlementApp must have StoreKit external purchase entitlement from Apple
Deep LinkingImplement deep linking for app return flow after payment
VerificationHandle purchase verification on your backend (no StoreKit receipt)

Android alternative: For Android, use isBillingProgramAvailableAndroid, launchExternalLinkAndroid, and createBillingProgramReportingDetailsAndroid.