Alipay+ DocsAlipay+ Docs

connect

Call the connect API to switch the current operation context to a specified user account. Call this API after a user logs in or switches accounts.

Method signature

copy
public static func connect(params: IAPAPConnectParams) -> Bool

Request parameters

Parameter

Type

Required

Description

params

IAPAPConnectParams

Yes

The parameters of the connect API.

IAPAPConnectParams

Field

Type

Required

Description

userId

String

Yes

The unique ID assigned by the MPP to identify a user.

context

[String: Any]?

No

The operation context object containing the current user, session, and configuration.

Response parameters

Parameter

Type

Required

Description

result

Bool

Yes

Whether the operation context switching is successful.

Valid values are:

  • true: successful
  • false: failed

Sample

copy
let success = IAPApplePay.connect(faid: "MPP-ACC-67890")
if success {
    // Context switched
}