addToAppleWallet
Call the addToAppleWallet API to create a device token for the current device or paired device and add the token to Apple Wallet.
Method signature
public static func addToAppleWallet(completion: @escaping (Result<IAPAPDeviceToken, IAPAPErrors>) -> Void)Request parameters
Parameter | Type | Required | Description |
completion | (Result<IAPAPDeviceToken, IAPAPErrors>) -> Void | Yes | An asynchronous completion callback that returns the result of calling the addToAppleWallet API. |
IAPAPDeviceToken
Parameter | Type | Required | Description |
tokenUniqueReference | String | Yes | The unique identifier to identify a device token. |
primaryAccountIdentifier | String | Yes | An opaque value that identifies the primary account number that funds the device token's transactions. |
primaryAccountNumberSuffix | String | Yes | A display-ready version of the primary account number. |
deviceAccountIdentifier | String | Yes | The unique identifier for the device-specific account number. |
deviceAccountNumberSuffix | String | Yes | A display-ready version of the device-specific account number. |
passActivationState | Yes | The activation status of the device token. | |
devicePassIdentifier | String | No | An opaque value for the device token. |
pairedTerminalIdentifier | String | No | The unique identifier to identify the paired terminal. |
IAPAPDeviceTokenState
Value | Code | Description |
unknown | -1 | Unknown status. |
activated | 0 | The token is activated. |
requiresActivation | 1 | The token requires activation. |
activating | 2 | The token is in activation process. |
suspended | 3 | The token is suspended. |
deactivated | 4 | The token is deactivated. |
Response parameters
N/A
Sample
IAPApplePay.addToAppleWallet { result in
switch result {
case .success(let deviceToken):
print("Add to AppleWallet success: \(deviceToken)")
case .failure(let error):
print("Add to AppleWallet error: \(error)")
}
}