Alipay+ DocsAlipay+ Docs

setWalletDataSource

Call the setWalletDataSource API to set up a wallet data source for the MPP to obtain wallet data.

Method signature

copy
public static func setWalletDataSource(_ dataSource: IAPAPWalletDataSource)

Request parameters

Parameter

Type

Required

Description

dataSource

IAPAPWalletDataSource

Yes

The data source of the wallet.

IAPAPWalletDataSource

copy
public protocol IAPAPWalletDataSource {
    func tokenCoverImage(for context: IAPAPWalletContext) -> CGImage?
    func tokenTitle(for context: IAPAPWalletContext) -> String?
    func tokenDisplayExtraInfo(for context: IAPAPWalletContext) -> [IAPAPTokenDisplayInfo]?
}

Method

Parameter

Required

Return

tokenCoverImage

context: Context information including the current action type and device information.

Optional
This method is required for the wallet extension scenario.

A CGImage used as the token cover art.

tokenTitle

context: Context information including the current action type and device information.

Optional
This method is required for the wallet extension scenario.

A string representing the token title.

tokenDisplayExtraInfo

context: Context information including the current action type and device information.

Optional

An array of extra display information items. This function returns nil if no items are provided.

Response parameters

N/A

Sample

copy
IAPApplePay.setWalletDataSource(WalletDataSource())