Manual-replenish
While the Alipay+ NFC SDK handles credential replenishment automatically, you can also manually trigger the process by calling the replenish() API.
Step 1: The MPP manually triggers the replenishment
To initiate the process, call the replenish() API.
Processing logic
When calling the replenish() API, take the following into consideration:
- The callback of this API indicates the replenishment result. Valid values are:
1: indicates the replenishment is successful.0: indicates the replenishment has failed.
For more information about how to use the replenish() SPI on an Android device, see the replenish API.
Step 2: Request payment credentials
Note: All requests from the Alipay+ NFC SDK to the Ant server side are proxied by the NFCRequestProxy SPI. For more information, see Proxy SDK Requests.
After calling the replenish() API, the SDK first builds a request session with Mastercard.
Then the SDK sends the replenish request to the Ant server to fetch credentials. The Ant server then requests credentials from Mastercard. After obtaining the credentials, the Ant server returns the credentials to the SDK. The SDK securely stores the credentials.