Alipay+ DocsAlipay+ Docs

Environment configurations

This document introduces the SDK environment configurations for different phases or scenarios.

Card activation phase

The following table lists the configurations used during the card activation phase. Omit any key to use the default value.

Key

Configuration

Supported SDK version

Data type

Description

nfc_issue_config

applyTokenTimes

1.0.0

Number

The number of polls for the token application.

Default value: 25

applyTokenInterval

1.0.0

Number

The polling interval for the token application. The unit is milliseconds (ms).

Default value: 2000

activateTimes

1.0.0

Number

The number of polls for the activation.

Default value: 7

activateInterval

1.0.0

Number

The polling interval for the activation. The unit is milliseconds (ms).

Default value: 1000

sessionTimes

1.0.0

Number

The number of polls for the session.

Default value: 7

sessionInterval

1.0.0

Number

The polling interval for the session. The unit is milliseconds (ms).

Default value: 1500

Sample

The following sample shows a custom configuration.

copy
{
  "nfc_issue_config": {
    "applyTokenTimes": 25,
    "applyTokenInterval": 2000,
    "activateTimes": 7,
    "activateInterval": 1000,
    "sessionTimes": 7,
    "sessionInterval": 1500
  }
}

Transaction phase

The following table lists the configurations used during the transaction phase.

Key

Configuration

Supported SDK version

Data type

Description

nfc_transaction_config

isSupportTransit

1.0.0

Boolean

Indicates whether to support transportation scenarios.

Valid values are:

  • true: supported
  • false: not supported

Default value: false

This remote configuration takes precedence over isSupportTransit passed via the init API.

isSupportTransitWithoutConsent

1.1.12

Boolean

Indicates whether the traffic payment is supported while the screen is locked.

Valid values are:

  • true: supported
  • false: not supported

Default value: false

This remote configuration takes precedence over isSupportLockScreenPay passed via the init API.

requireDeviceUnlock

1.2.11

Boolean

Indicates whether the device must be unlocked to use NFC functionality.

Valid values are:

  • true: required
  • false: not required

Default value: false

allowTapTransaction

1.2.11

Boolean

Indicates whether the NFC functionality is enabled.

Valid values are:

  • true: enabled
  • false: disabled

Default value: true

isSupportCardStatusJudgement

1.2.19

Boolean

Indicates whether to support card status judgment in advance.

Valid values are:

  • true: supported
  • false: not supported

Default value: false

failedCallbackInterval

1.2.18

Int

The interval between the reports of the same error code. The unit is milliseconds (ms).

Default value: 0

isWalletActionRequired

1.2.18

Boolean

Whether the refund process requires a second confirmation.

Valid values are:

  • true: required
  • false: not required

Default value: false

isSupportCardProfileRepair

1.2.19

Boolean

Indicates whether to support card token re-activation if a card content parsing error occurs.

Valid values are:

  • true: supported
  • false: not supported

Default value: true

isCheckTransitAdvancePayLimit

1.4.5

Boolean

Indicates whether to check the payment amount limit of the transit card.

Valid values are:

  • true: Check the payment amount limit. If the limit is reached, the tap fails.
  • false: Do not check the payment amount limit. The tap succeeds regardless of the payment amount limit

Default value: false

isSwitchDBStorage

1.5.0

Boolean

Indicates whether to switch to DB storage.

Valid values are:

  • true: switch
  • false: do not switch

Default value: true

isSwitchInitCard

1.5.0

Boolean

Indicates whether to switch to a new initialization card token information in the tap process.

Valid values are:

  • true: switch
  • false: do not switch

Default value: false

isEventTransactionTrackingV2

1.5.0

Boolean

Indicates whether to switch to the SDK version 1.5 parameters of the NFCMonitor API.

Valid values are:

  • true: switch
  • false: do not switch

Default value: false

sameTapJudgementLevel

1.5.0

Int

The time interval between two taps that will be considered as the same tap. The unit is milliseconds (ms).

Default value: 0

timeOfDelayReport

1.5.0

Int

The time delay to report failure results after a business failure. The unit is milliseconds (ms).

Default value: 0

isSupportNewTransactionResultReport

1.5.0

Boolean

Indicates whether to support the new transaction result report mechanism.

Valid values are:

  • true: supported
  • false: not supported

Default value: false

isSubmitFirstFailReason

1.5.1

Boolean

Indicates whether to report only the first failure reason during a transaction. When this key is set to true, subsequent failure reasons in the same transaction are suppressed.

Default value: false

isTransactionCallbackAsync

1.11.0

Boolean

Indicates whether transaction callbacks are dispatched on a background thread. When this key is set to true, ensure your callback implementation is thread-safe.

Default value: false

isAutoRotateCredentialsEnabled

1.9.0

Boolean

Indicates whether the SDK automatically rotates transaction credentials when they are running low, without requiring an explicit replenish call.

Default value: false

isSupportLeByteAbsence

1.5.1

Boolean

Indicates whether the SDK accepts APDU commands that omit the Le byte. When this key is set to false, a command without an Le byte returns status word 6700. Set this to true if your terminal omits the Le byte.

Default value: false

isResetProvider

1.5.0

Boolean

Indicates whether the SDK storage provider is reset during initialization. Resetting clears locally cached configuration. Set to false only when instructed by Alipay+.

Default value: true

useLocalConfig

1.10.0

Boolean

Indicates whether the built-in local configuration is used when remote configuration is unavailable.

Default value: true

Sample

copy
{
  "nfc_transaction_config": {
    "isSupportTransit": false,
    "isSupportTransitWithoutConsent": false,
    "isSupportTapWithoutConsent": false,
    "isOnlySupportAggregate": true,
    "isWalletActionRequired": false,
    "isChangeDeclineToTryAgain": false,
    "isCheckPreTapContext": true,
    "isSupportCardProfileRepair": true,
    "isSupportCardStateCheckAtFinalAssessment": false,
    "regionTBC": ["0156"],
    "useLocalConfig": true,

    "allowTapTransaction": true,
    "requireDeviceUnlock": false,
    "isCheckTransitAdvancePayLimit": false,
    "failedCallbackInterval": 0,
    "isSupportNewTransactionResultReport": false,
    "sameTapJudgementLevel": 0,
    "timeOfDelayReport": 0,
    "isSubmitFirstFailReason": false,
    "isTransactionCallbackAsync": false,
    "isAutoRotateCredentialsEnabled": false,
    "isSupportLeByteAbsence": false,
    "isResetProvider": true,

    "asyncAmountLimitSwitch": false,
    "canQueryAmountLimit": false
  }
}

Transit phase

The following table lists configurations specifically for transit scenarios.

Key

Configuration

Supported SDK version

Data type

Description

nfc_transit_config

terminalCountryCode

1.1.16

String

The country code of the transaction.

merchantCategoryCode

1.1.16

String

The merchant category code (MCC) that represents the categorization of the merchant's business type.

currencyAmount

1.1.16

Number

The transaction amount.

merchantNameAndLocation

1.1.16

String

The merchant's name, address, and location.

Sample

copy
{
  "nfc_transit_config": [
    {
      "terminalCountryCode": "0458",
      "merchantCategoryCode": "4131"
    },
    {
      "terminalCountryCode": "0458",
      "merchantCategoryCode": "4111"
    },
    {
      "terminalCountryCode": "0458",
      "merchantCategoryCode": "4784"
    },
    {
      "terminalCountryCode": "0458",
      "merchantCategoryCode": "1234"
    },
    {
      "terminalCountryCode": "0458",
      "merchantCategoryCode": "0000"
    }
  ]
}

Initialization phase

The following table lists the configurations used during the initialization phase.

Key

Configuration

Supported SDK version

Data type

Description

nfc_init_config

init_monitor

1.1.25

Boolean

Indicates whether to activate initialization monitoring.

If it is set to true, an initialization flag is recorded and the monitor initialization logic is determined based on this flag.

If this key is absent from the remote configuration, the value falls back to the setting provided through APNFCConfig.Builder.setInitMonitorDefault(Boolean) in the init API.

Default value: false

next_step_type

1.1.25

Number

The next step to do upon detecting a previous crash.Valid values are:

  • 1: Upon detecting a previous crash, skip the remaining initialization steps and returns false directly.
  • 0: Upon detecting a previous crash, continue with the remaining initialization steps.

Default value: 0

invalidate_time_stamp

1.1.25

Number

The validity period for the recorded initialization flag. The unit of this value is seconds (s).

Default value: 1209600 (equivalent to 14 days)

vtee_precheck_enabled

1.11.0

Boolean

Indicates whether the virtual Trusted Execution Environment (vTEE) compatibility check runs during initialization. When enabled, the SDK verifies that the device supports vTEE before proceeding. Disable this only when instructed by Alipay+.

Default value: true

Sample

copy
{
  "nfc_init_config": {
    "init_monitor": false,
    "next_step_type": 1,
    "invalidate_time_stamp": 1209600
  }
}

Transaction blacklist

The following table lists configurations for the transaction blacklist.

Key

Configuration

Supported SDK version

Data type

Description

nfc_transaction_black

countrycode values

1.1.27

List<String>

The transaction types that are blacklisted. For the valid transaction types, see Transaction types.

Transaction types

The following table lists the transaction types and their corresponding richTransactionType.

Value

Corresponding richTransactionType

Description

ALL

N/A 

All transaction types

PURCHASE

PURCHASE

Ordinary transactions

REFUND

REFUND

Refund

CASH

CASH

Cash withdrawal

TRANSIT

TRANSIT

Transit transactions

CASHBACK

PURCHASE_WITH_CASHBACK

Purchases with cashback

Sample

copy
{
  "nfc_transaction_black": {
    "0344": [
      "TRANSIT"
    ],
    "0156": [
      "ALL"
    ]
  }
}

Transaction whitelist

The following table lists the configurations about the transaction whitelist.

Key

Configuration

Supported SDK version

Data type

Description

nfc_transaction_white

terminalCountryCode

1.4.3

String

The country code of the transaction.

transactionType

1.4.3

String

Transaction types.

Valid values are:

  • PURCHASE: Ordinary transactions
  • REFUND: Refund
  • CASH: Cash withdrawal
  • TRANSIT: Transit transactions
  • PURCHASE_WITH_CASHBACK: Purchases with cashback

needDebitBin

1.4.3

Boolean

Indicates whether debit card bins are required.

Sample

copy
{
  "nfc_transaction_white": [
    {
      "terminalCountryCode": "0344",
      "transactionType": "PURCHASE",
      "needDebitBin": false
    }
  ]
}

Manage configurations with blacklist and whitelist

The following table lists configurations for managing nfc_transaction_config items using blacklists and whitelists.

Note: Only the allowTapTransaction configuration is supported.

Key

Configuration

Supported SDK version

Data type

Description

nfc_payment_access_control_config

key

1.2.18

String

The configuration that needs to be managed according to the blacklist and whitelist.

Valid value isallowTapTransaction which indicates whether to allow tapping to pay.

blackList

1.2.18

List<String>

A list of user IDs, who are blacklisted and the configuration for them is set to false for the configuration specified in the key parameter.

whiteList

1.2.18

List<String>

A list of user IDs, who are whitelisted and the configuration for them is set to true for the configuration specified in the key parameter.

Sample

copy
{
  "nfc_payment_access_control_config": [
    {
      "key": "allowTapTransaction",
      "blackList": ["123", "456", "789"], // Users that are not allowed to make tap payment
      "whiteList": ["123", "456"] // Users that are allowed to make tap payment
    },
    // other configurations
    ...
  ]
}