<!--
{
  "availability" : [
    "iOS: 18.1.0 - 27.2.0",
    "iPadOS: 18.1.0 - 27.2.0",
    "macOS: 15.1.0 - 27.2.0",
    "tvOS: 18.1.0 - 27.2.0",
    "visionOS: 2.1.0 - 27.2.0",
    "watchOS: 11.1.0 - 27.2.0"
  ],
  "documentType" : "symbol",
  "framework" : "StoreKit",
  "identifier" : "/documentation/StoreKit/ExternalPurchaseCustomLink/token(for:)-1fyo",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "StoreKit"
    ],
    "preciseIdentifier" : "s:8StoreKit26ExternalPurchaseCustomLinkO5token3forAC5TokenVSgSS_tYaKFZ"
  },
  "title" : "token(for:)"
}
-->

# token(for:)

Returns an external purchase token of the specified type.

```
static func token(for tokenType: String) async throws -> ExternalPurchaseCustomLink.Token?
```

## Parameters

`tokenType`

The type of token to request.

## Discussion

If `isEligible` is `false`, this method will always fail.

> Throws: A `StoreKitError`.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)