Use this page with AI

Copy this into your coding assistant and add your request.

Read https://openiap.dev/docs/apis/ios/get-external-purchase-custom-link-token-ios 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 →

iOS getExternalPurchaseCustomLinkTokenIOS

Fetch an external-purchase token for the ExternalPurchaseCustomLink API (iOS 18.1+, macOS 15.1+).

For the EU flow, request both token types at app launch and before each potential transaction. Associate returned tokens with the customer account on your server.

In Japan (iOS 26.4 or later) and Brazil (iOS 26.5 or later), request a token before each potential transaction. The app needs Apple's External Custom Purchase Link Regions entitlement and must be eligible at runtime. Rebuild your app with the updated native SDK before using the in-app and link-out values. See Receiving and decoding external purchase tokens.

Signature

swift
func getExternalPurchaseCustomLinkTokenIOS(
    _ tokenType: ExternalPurchaseCustomLinkTokenTypeIOS
) async throws -> ExternalPurchaseCustomLinkTokenResultIOS

Parameters#

  • tokenType is required. Use acquisition and services for the EU flow. In Brazil and Japan, use in-app for a payment provider inside the app or link-out for a checkout on your website.

Returns#

Promise<ExternalPurchaseCustomLinkTokenResultIOS> — an optional opaque token plus an optional error. Send a returned token to Apple's External Purchase Server API. Godot's get_external_purchase_custom_link_token_ios runs on iOS only and returns null on macOS.

Example

swift
let token = try await OpenIapModule.shared.getExternalPurchaseCustomLinkTokenIOS(
    .acquisition
)