Alipay+ DocsAlipay+ Docs

ActivateStatusListener

Call the ActivateStatusListener API to monitor the status of the activatePayment API.

Method signature

copy
public interface ActivateStatusListener {

    void onActivateResult(int result, String errorCode, String errorMessage);

}

Note:

  • ACTapManager provides three methods for managing this listener: setActivateStatusListener, addActivateStatusListener, and removeActivateStatusListener.
  • Be aware of the following behaviors:
    • setActivateStatusListener does not replace or clear previously registered listeners. It delegates to addActivateStatusListener internally, so calling it multiple times (for example, on every login) accumulates listeners. Listeners are deduplicated by object reference only.
    • Accumulating listeners causes duplicate callbacks for the same event. To avoid duplicate callbacks, call removeActivateStatusListener to remove the listener before re-registering it.
    • removeActivateStatusListener removes a listener by object reference. If the specified listener was never added, it silently does nothing.

Request parameters

Method

Item

Type

Description

Required

onActivateResult

result

int

The processing result of the activatePayment API.

For valid values, see Token status.

Yes

errorCode

String

The result code. For more information, see Result codes.

Yes

errorMessage

String

The result message. For more information, see Result codes.

Yes

Token status

Code

Value

Description

Further action

Returned by

-2

TOKEN_NOT_CONNECTED

No user is connected, or the user has already disconnected.

Call connect with the user id.

isPaymentAvailable, activatePayment, and activatePaymentInSlientMode

-1

TOKEN_STATUS_UNKNOWN

The token status could not be determined. Possible causes: an invalid input parameter (errorCode 10011), a card read or sync failure, or an activation failure.

Check the errorCode returned with this value to identify the cause.

isPaymentAvailable, activatePayment, and activatePaymentInSlientMode

0

TOKEN_STATUS_NOT_EXIST

No card exists for this user, or the card is not activated, is marked for deletion, or is in an unresolvable state.

Call activatePayment. If errorCode 10010 is also returned, an activation is already in progress. Wait for it to complete instead of starting another.

isPaymentAvailable, activatePayment, and activatePaymentInSlientMode

1

TOKEN_STATUS_ACTIVATED_WITH_NO_CREDENTIALS

The card is active but has no credentials available for payment.

Call replenish.

isPaymentAvailable, activatePayment, and activatePaymentInSlientMode

2

TOKEN_STATUS_READY_TO_TAP

The card is active and has at least one valid credential. This is the only value that confirms a tap can succeed.

No action required.

isPaymentAvailable, activatePayment, and activatePaymentInSlientMode

3

TOKEN_STATUS_LOCKED

The card is suspended by the server.

Call unlock.

isPaymentAvailable, activatePayment, and activatePaymentInSlientMode

21

TOKEN_STATUS_NOT_CONFIRMED

The card is active but the user has not yet confirmed it.

Call activatePayment with NFCActivateParams.setDoConfirm(true).

isPaymentAvailable, activatePayment, and activatePaymentInSlientMode

Note: This table lists only the token status values that onActivateResult returns. If an activation is already in progress, onActivateResult returns code 0 paired with result code 10010. For the complete list of token status values and which API calls can return each value, see Token status.

Response parameters

N/A

Sample

copy
ACTapManager manager = ACTapManager.getInstance(this.getApplication());
manager.setActivateStatusListener(new ActivateStatusListener() {
    @Override
    public void onActivateResult(int result, String errorCode, String errorMessage) {
    }
});