Open Alipay+ NFC pages
When a user opens the Alipay+ NFC page, the MPP APP must check the user's token status to determine which page to display. View the following content to learn about the logic for handling each possible status
Workflow

The Alipay+ NFC display process consists of the following steps:
- The user opens the NFC page. (Step 1)
- The MPP app calls the isPaymentAvailable() API to check if the payment function is available. (Step 2)
- Based on the returned token statuses, the MPP app displays different pages:
- If the token status is
-2,0,11, or21, the MPP app redirects to the Alipay+ NFC service activation page. (Steps 3-7) - If the token status is
1or2, the MPP app redirects to the Alipay+ NFC payment page. (Steps 8-19) - If the token status is
3, the MPP app displays the token lock or unlock page. (Steps 20-21) - If the token status is
-1, the MPP app displays the error page, requiring debugging. (Steps 22-23)
Step 1: Open the NFC page
- The user initiates the process by opening the NFC page within the MPP app.
- Call the isNfcPaySettingsCompleted() API to determine if the NFC payment function is accessible.
Processing logic
When calling the isNfcPaySettingsCompleted API, take the following into consideration:
- Configure the request parameters properly:
- activity: The context of the current NFC settings page.
- apduServiceName: The customized APDU service name during the integration.
- Handle the result properly:
- The result is a Boolean and indicates whether NFC payment is enabled.
True: NFC payment is enabled.False: NFC payment is disabled.
For more information about how to use the isNfcPaySettingsCompleted API on an Android device, see the isNfcPaySettingsCompleted API.
Step 2: Handle token status and navigate pages
Navigate to the activation page
- For token statuses
-2,0,11, or21:
- Direct users to the Alipay+ NFC service activation page.
- If token status is
-2:
- Call the init() and connect() APIs to initialize the SDK. For detailed information about the SDK initialization, see Initiate SDK.
- Display the activation page.
- If the token status is
0,11, or21, directly display the activation page.
Prepare for payment
- For token statuses
1and2:
- If token status is
1:
- Call the replenish() API to obtain necessary credentials.
- The token status is updated to
2by the SDK.
- If token status is
2:
- Check NFC settings with the isNfcPaySettingsCompleted() API.
- If
Falseis returned, the ApplyCardActivity.setting() API is called to open the NFC configuration page. - The user configures NFC settings, completes the process, and returns to the MPP app page.
- Once NFC configurations are confirmed and completed (returns
Truefrom the isNfcPaySettingsCompleted() API), the app displays the Alipay+ NFC payment page to the user.
Processing logic
When calling the ApplyCardActivity.setting() API, take the following into consideration:
- Configure the request parameters properly:
- activity: The context of the current NFC settings page.
- apduServiceName: The customized APDU service name during integration.
For more information on how to use the ApplyCardActivity.setting() API on an Android device, see ApplyCardActivity.setting() API.
Manage token
- If the token status is
3:
- Display the token lock/unlock page and allow users to manage their token status (lock/unlock). For more information about how to manage a token, see Manage the token.
Handle error
- If the token status is
-1
- Display an error page indicating that debugging is required.