Alipay+ DocsAlipay+ Docs

init

Call the init API to initialize the client SDK.

Note: The SDK is initialized after the first API call. init takes effect only on the first call when the SDK is not initialized. Subsequent calls are silently ignored even if different configurations are provided. To apply a new configuration, call destroy first, then call ACTapManager.getInstance(context) to obtain a fresh instance, and call init again.

Method signature

copy
ACTapManager.getInstance(context).init(config)

Request parameters

Item

Type

Description

Required

config

APNFCConfig

Configuration settings for the SDK.

No

Note: If you pass null, the SDK uses its built-in defaults: transit and lock-screen payment are disabled, and the authentication mode is NFCAuthMode.FLEXIBLE.

APNFCConfig

Item

Type

Description

Default value

Required

authType

NFCAuthMode

The authentication type.

NFCAuthMode.FLEXIBLE

No

isSupportTransit

Boolean

Whether to support transportation scenarios.

Valid values are:

  • true: Supported.
  • false: Not supported.

false

No

isSupportLockScreenPay

Boolean

Whether to support transportation payments when the screen is off.

Valid values are:

  • true: Supported.
  • false: Not supported.

false

No

isNeedConfirmActivate

Boolean

Whether secondary confirmation is required for card activation.

Valid values are:

  • true: Required.
  • false: Not required.

false

No

minNumberAllowedReplenish

Integer

The minimum Credential threshold for replenishment requests through the replenish API.

When local Credentials exceed this value, replenish calls return the REPLENISH_DENIED result code. This prevents unnecessary network requests.

15

No

autoReplenishThreshold

Integer

The threshold for automatic replenishment.

When Credentials fall below this threshold due to transactions, the SDK automatically triggers replenishment.

  • To trigger replenishment after every successful transaction, set to max integer (2^31 - 1).
  • To disable automatic replenishment, set to 0 or less.

15

No

initMonitorDefault

Boolean

Whether to set NFCMonitor init status to false by default.

Valid values are:

  • true: Set the init status to false.
  • false: Set the init status to true.

false

No

isUseDefaultDeviceFingerPrint

Boolean

Whether the default device fingerprint is used.

Valid values are:

  • true: Used.
  • false: Not used.

false

No

NFCAuthMode

Item

Type

Description

FLEXIBLE

String

The SDK's internal risk control determines password exemption. If a previous authentication is passed within 5 minutes, the password-exempted amount can be increased.

FLEXIBLE_WITHOUT_UPPER_AMOUNT

String

The SDK's internal risk control determines password exemption.

CDCVM_ALWAYS

String

Requires authentication for every transaction.

Response parameters

N/A

Sample

copy
private APNFCConfig config = APNFCConfig.newBuilder()
.setNeedConfirmActivate(true)
.setShowCoreLog(BuildConfig.DEBUG)
.build();

ACTapManager.getInstance(getApplication()).init(config);

Note: APNFCConfig.Builder provides the following setters:

    • setAutoReplenishThreshold
    • setMinNumberAllowedReplenish
    • setAuthType
    • setSupportTransit
    • setSupportLockScreenPay
    • setNeedConfirmActivate
    • setInitMonitorDefault
    • setUseDefaultDeviceFingerPrint