Initiate SDK
To enable NFC payments in your app, you must first initialize the Alipay+ NFC SDK. This guide describes how to initialize, connect to, and disconnect from the SDK.
Initialize and connect
Before using the Alipay+ NFC SDK to enable payment, you must initialize the SDK.
Workflow

The process of initiating and connecting the SDK consists of the following steps:
- A user logs in to the MPP app. (Step 1)
- The MPP app calls the init() API. (Step 2)
- The MPP app calls the connect() API. (Step 3)
Step 1: Initialize the SDK
After the user logs in to the MPP app, call the init() API to initiate the SDK.
Processing logic
When using the init() API, take the following into consideration:
- Ensure the following parameter is configured properly:
- config: This parameter contains the configuration settings for initializing the SDK. For detailed information on this parameter, refer to the APNFCConfig section.
For more information about how to use the init() API on an Android device, see the init API.
Step 2: Connect to the SDK
After successful initialization, call the connect() API. The SDK must be in a connected state to perform NFC payments.
Processing logic
When using the connect() API, take the following things into consideration:
- Ensure the following parameters are configured properly:
- id: The ID that is used internally by the SDK for user isolation.
- callback: A callback to handle scenarios where the connection takes an extended time.
- Ensure the following response is handled properly:
- result: The result that indicates whether the connection is successful.
For more information about how to use the connect() API on an Android device, see the connect API.
Disconnect
When a user logs out of your app or their session expires, call the disconnect() API.
Workflow

The process of disconnecting the SDK consists of the following steps:
- A user logs out of the MPP app, or the login session expires. (Step 1)
- The MPP app calls the disconnect() API. (Step 2)
Processing logic
When using the disconnect() API, take the following things into consideration:
- Ensure the following response is handled properly:
- result: The result that indicates whether the disconnection is successful.
For more information about how to use the disconnect() API on an Android device, see the disconnect API.