External Purchase Link Types
External Purchase Link (iOS)#
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).
Native references: Apple · StoreKit ExternalPurchase · External purchase entitlement
Important: External purchase links bypass StoreKit completely. No
purchaseUpdatedListenerwill fire. You must implement deep links and server-side verification.
External Purchase APIs#
| API | Description | Availability |
|---|---|---|
canPresentExternalPurchaseNoticeIOS | Check if external purchase notice sheet can be presented | iOS 17.4+ |
presentExternalPurchaseNoticeSheetIOS | Present Apple's compliance notice sheet (required before external purchase) | iOS 17.4+ |
presentExternalPurchaseLinkIOS | Open external purchase URL in Safari | iOS 18.2+ |
Types#
ExternalPurchaseNoticeResultIOS
| Name | Type | Summary |
|---|---|---|
result | ExternalPurchaseNoticeAction | User action on the notice sheet (continue or dismissed) |
error | string? | Optional error message if presentation failed |
externalPurchaseToken | string? | External purchase token returned when result === 'continue'. Report to Apple's External Purchase Server API. |
ExternalPurchaseLinkResultIOS
| Name | Type | Summary |
|---|---|---|
success | boolean | Whether the user completed the external purchase flow |
error | string? | Optional error message if presentation failed |
ExternalPurchaseCustomLinkTokenResultIOS#
Returned by getExternalPurchaseCustomLinkTokenIOS (iOS 18.1+).
| Name | Type | Summary |
|---|---|---|
token | string | Token to send to Apple's External Purchase Server reporting API. |
error | string? | Populated when token creation fails. |
ExternalPurchaseCustomLinkNoticeResultIOS#
Returned by showExternalPurchaseCustomLinkNoticeIOS (iOS 18.1+).
| Name | Type | Summary |
|---|---|---|
continued | boolean | Whether the user chose to continue to the external purchase. |
error | string? | Populated when the sheet failed to present. |
// 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:
- Check availability - Verify the device supports external purchase
- Present notice sheet - Show Apple's required disclosure
- Open external link - Redirect to your payment page
Complete Example#
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#
| Requirement | Details |
|---|---|
| Platform | iOS 17.4+ (notice sheet), iOS 18.2+ (custom links) |
| Entitlement | App must have StoreKit external purchase entitlement from Apple |
| Deep Linking | Implement deep linking for app return flow after payment |
| Verification | Handle purchase verification on your backend (no StoreKit receipt) |
Android alternative: For Android, use
isBillingProgramAvailableAndroid,launchExternalLinkAndroid, andcreateBillingProgramReportingDetailsAndroid.