Alipay+ DocsAlipay+ Docs

getStaticTokenInfo

Call the getStaticTokenInfo API to retrieve information about the current user's static token.

Method signature

copy
public static func getStaticTokenInfo(completion: @escaping (Result<IAPAPStaticTokenInfo, IAPAPErrors>) -> Void)

Request parameters

Parameter

Type

Required

Description

completion

(Result<IAPAPStaticTokenInfo, IAPAPErrors>) -> Void

Yes

An asynchronous completion callback that returns the result of calling the getStaticTokenInfo API.

IAPAPStaticTokenInfo

Field

Type

Required

Description

tokenUniqueReference

String

Yes

The unique ID assigned by the MPP to identify the static token.

tokenNumber

String

Yes

The card number of the token.

expiryMonth

String

Yes

The expiration month of this static token.

expiryYear

String

Yes

The expiration year of this static token.

Response parameters

N/A

Sample

copy
IAPApplePay.getStaticTokenInfo { result in
    switch result {
    case .success(let info):
        print("Token ID: \(info.tokenUniqueReference)")
        print("Card Number: \(info.tokenNumber)")
        print("Valid Until: \(info.expiryMonth)/\(info.expiryYear)")
    case .failure(let error):
        print("Error: \(error.localizedDescription)")
    }
}