Class WatchManager
java.lang.Object
SamsungPayBase
com.samsung.android.sdk.samsungpay.v2.WatchManager
- All Implemented Interfaces:
AppToAppConstants
This class provides APIs for watch management.
Partner apps must check the Samsung Pay watch status on the device
before performing any card management.
Also, this class provides APIs getting cards information, adding new card to Samsung Pay on watch, and so on.
Also, this class provides APIs getting cards information, adding new card to Samsung Pay on watch, and so on.
- Since:
- API Level 2.5
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Key to represent device serial number to generate the paymentAppInstanceId.static final int
This error indicates that the given parameter is invalid.
This is returned asSpaySdk.EXTRA_ERROR_REASON
forSpaySdk.ERROR_REGISTRATION_FAIL
error.static final int
This error indicates that user canceled the PIN lock setup.
Partner app should ask user to setup PIN for Samsung Pay Gear.static final int
This error indicates that Samsung Pay(Watch Plug-in) can not connect with Samsung Pay(Watch).
Partner app should ask user to check bluetooth connection or pairing.static final int
This error indicates that Samsung Pay(Watch) is in a process of payment.static final int
This error indicates that user canceled the PIN lock setup.
Partner app should ask user to setup PIN for Samsung Pay(Watch).static final int
This error indicates that Samsung Pay(Watch) is taking log for error report.static final int
This error indicates that Samsung Pay(Watch) being updated.Fields inherited from interface com.samsung.android.sdk.samsungpay.v2.AppToAppConstants
ERROR_AUTH_CODE_EXPIRED, ERROR_AUTH_CODE_INVALID, ERROR_AUTH_CODE_MAX_TRY_REACHED, ERROR_AUTH_CODE_TYPE_INVALID, ERROR_AUTHENTICATION_CLOSED, ERROR_AUTHENTICATION_FAILED, ERROR_AUTHENTICATION_NOT_READY, ERROR_AUTHENTICATION_TIMED_OUT, ERROR_CARD_ALREADY_REGISTERED, ERROR_CARD_IDV_NOT_SUPPORTED, ERROR_CARD_NOT_SUPPORTED, ERROR_FRAMEWORK_INTERNAL, ERROR_INVALID_CARD, ERROR_INVALID_CARDINPUT, ERROR_MAX_CARD_NUM_REACHED, ERROR_MAX_PAN_PROVISION_NUM_REACHED, ERROR_SERVER_REJECT, ERROR_TSM_FAIL, ERROR_VERIFY_CARD, ERROR_WALLET_ID_MISMATCH, EXTRA_APP2APP_INTENT, EXTRA_APP2APP_PAYLOAD, EXTRA_CARD_BALANCE, EXTRA_CARD_STATUS_REASON, EXTRA_ISSUER_APP_CARD_LINKED
-
Constructor Summary
ConstructorDescriptionWatchManager
(android.content.Context context, PartnerInfo partnerInfo) API to get the WatchManager instance.
The caller should set valid ServiceId. -
Method Summary
Modifier and TypeMethodDescriptionvoid
API to bring the Samsung Pay on watch app to a state in which cards can be added.
Samsung Pay on watch might be Samsung Account is not signed in state.
Partner app checks the Samsung Pay on watch status withgetSamsungPayStatus(StatusListener)
API.
If the status is#SPAY_NOT_READY
and#EXTRA_ERROR_REASON
is#ERROR_SPAY_SETUP_NOT_COMPLETED
,
partner app can call this API to launch Samsung Pay on watch and user can sign in to the app.void
addCard
(AddCardInfo addCardInfo, AddCardListener listener) API to add a card from partner app (example: issuer/bank app) to Samsung Pay on watch.
Partner app uses this API to add card to Samsung Pay on watch by providing the required card details.void
getAllCards
(android.os.Bundle cardFilter, GetCardListener listener) API to get all the cards from Samsung Pay on watch for the given filter.void
getSamsungPayStatus
(StatusListener listener) API to get the Samsung Pay on watch status on the device.
Partner (Issuers) applications must call this API to check the current state of Samsung Pay on watch before doing any operation.void
getWalletInfo
(List<String> keys, StatusListener listener) API to get the requested wallet information from Samsung Pay on watch.
Partner app can use this information to uniquely identify the user and Samsung Pay on watch app on a particular device.void
API to go to Samsung Pay on watch update page.
Partner app checks the Samsung Pay on watch status withgetSamsungPayStatus(StatusListener)
API.
If the status is#SPAY_NOT_READY
and#EXTRA_ERROR_REASON
is#ERROR_SPAY_APP_NEED_TO_UPDATE
,
partner app can call this API to go to update Samsung Pay on watch app.
-
Field Details
-
DEVICE_SERIAL_NUM
Key to represent device serial number to generate the paymentAppInstanceId.- Since:
- API Level 2.5
- See Also:
-
ERROR_SPAY_PIN_LOCK_SETUP_CANCELED
public static final int ERROR_SPAY_PIN_LOCK_SETUP_CANCELEDThis error indicates that user canceled the PIN lock setup.
Partner app should ask user to setup PIN for Samsung Pay Gear.- Since:
- API Level 2.5
- See Also:
-
ERROR_INVALID_PARAMETER
public static final int ERROR_INVALID_PARAMETERThis error indicates that the given parameter is invalid.
This is returned asSpaySdk.EXTRA_ERROR_REASON
forSpaySdk.ERROR_REGISTRATION_FAIL
error.- Since:
- API Level 2.5
- See Also:
-
ERROR_SPAY_WATCH_PIN_LOCK_SETUP_CANCELED
public static final int ERROR_SPAY_WATCH_PIN_LOCK_SETUP_CANCELEDThis error indicates that user canceled the PIN lock setup.
Partner app should ask user to setup PIN for Samsung Pay(Watch).- Since:
- API Level 2.5
- See Also:
-
SPAY_WATCH_UPDATE_IS_ONGOING
public static final int SPAY_WATCH_UPDATE_IS_ONGOINGThis error indicates that Samsung Pay(Watch) being updated.- Since:
- API Level 2.5
- See Also:
-
SPAY_WATCH_TAKING_LOG_FOR_REPORT
public static final int SPAY_WATCH_TAKING_LOG_FOR_REPORTThis error indicates that Samsung Pay(Watch) is taking log for error report.- Since:
- API Level 2.5
- See Also:
-
ERROR_SPAY_WATCH_PAY_PROGRESS
public static final int ERROR_SPAY_WATCH_PAY_PROGRESSThis error indicates that Samsung Pay(Watch) is in a process of payment.- Since:
- API Level 2.5
- See Also:
-
ERROR_SPAY_WATCH_CONNECTION
public static final int ERROR_SPAY_WATCH_CONNECTIONThis error indicates that Samsung Pay(Watch Plug-in) can not connect with Samsung Pay(Watch).
Partner app should ask user to check bluetooth connection or pairing.- Since:
- API Level 2.5
- See Also:
-
-
Constructor Details
-
WatchManager
API to get the WatchManager instance.
The caller should set valid ServiceId. PartnerInfo is passed to Samsung Pay on watch for caller verification.Context ct = activity; // or Context ct = service; String issuerName = "MyBank"; // Set the serviceId which is assigned by the Samsung Pay Developer during on boarding. String serviceId = "sampleServiceId"; Bundle bundle = new Bundle(); bundle.putString(WatchManager.EXTRA_ISSUER_NAME, issuerName); bundle.putString(WatchManager.PARTNER_SERVICE_TYPE, WatchManager.ServiceType.APP2APP.toString()); PartnerInfo pInfo = new PartnerInfo(serviceId, bundle); WatchManager watchManager = new WatchManager(ct, pInfo);
- Parameters:
context
- Activity Context or Service Context.partnerInfo
- Partner information.- Throws:
NullPointerException
- Thrown if parameters are null.- Since:
- API Level 2.5
-
-
Method Details
-
getSamsungPayStatus
API to get the Samsung Pay on watch status on the device.
Partner (Issuers) applications must call this API to check the current state of Samsung Pay on watch before doing any operation.
// Set the serviceId which is assigned by the Samsung Pay Developer during on boarding. String serviceId = "sampleServiceId"; Bundle bundle = new Bundle(); bundle.putString(WatchManager.PARTNER_SERVICE_TYPE, WatchManager.ServiceType.APP2APP.toString()); PartnerInfo pInfo = new PartnerInfo(serviceId, bundle); WatchManager watchManager = new WatchManager(context, pInfo); watchManager.getSamsungPayStatus(new StatusListener() { @Override public void onSuccess (int status, Bundle data){ // success case if (status == SPAY_READY){ Log.d(TAG, "Samsung Pay on watch is ready on the device"); // Perform your operation. } else if( status == SPAY_NOT_READY){ // Samsung Pay on watch is supported but not fully ready. // If EXTRA_ERROR_REASON is ERROR_SPAY_APP_NEED_TO_UPDATE, // Call goToUpdatePage(). // If EXTRA_ERROR_REASON is ERROR_SPAY_SETUP_NOT_COMPLETED, // Call activateSamsungPay(). } else { // Samsung Pay on watch is not supported on this device. Log.d(TAG, "Device does not support Samsung Pay on watch"); } } @Override public void onFail(int errorCode, Bundle errorData){ Log.e(TAG, "onFail callback is called, errorCode: " + errorCode); // To get more reason of the failure, // check some extra error codes in the errorData bundle such as WatchManager.EXTRA_ERROR_REASON (if provided). } });
- Parameters:
listener
- Callback through which the result is provided.
On success, Samsung Pay on watch status code is provided viaStatusListener.onSuccess(int status, Bundle data)
.
If Samsung Pay on watch is ready to be used,#SPAY_READY
will be returned.
Otherwise,#SPAY_NOT_READY
or#SPAY_NOT_SUPPORTED
can be returned with#EXTRA_ERROR_REASON
from Bundle.
Also, partner can get extra information from Bundle data.
Bundle Keys(if provided) Bundle Values SpaySdk.EXTRA_COUNTRY_CODE
Device Country code(ISO 3166-1 alpha-2) StatusListener.onFail(int errorCode, Bundle errorData)
.
Note: Please referSpaySdk.COMMON_STATUS_TABLE
in detail.
- Throws:
NullPointerException
- Thrown if the callback passed is null.- Since:
- API Level 2.5
-
goToUpdatePage
public void goToUpdatePage()API to go to Samsung Pay on watch update page.
Partner app checks the Samsung Pay on watch status withgetSamsungPayStatus(StatusListener)
API.
If the status is#SPAY_NOT_READY
and#EXTRA_ERROR_REASON
is#ERROR_SPAY_APP_NEED_TO_UPDATE
,
partner app can call this API to go to update Samsung Pay on watch app.
// Set the serviceId which is assigned by the Samsung Pay Developer during on boarding. String serviceId = "sampleServiceId"; Bundle bundle = new Bundle(); bundle.putString(WatchManager.PARTNER_SERVICE_TYPE, WatchManager.ServiceType.APP2APP.toString()); PartnerInfo pInfo = new PartnerInfo(serviceId, bundle); WatchManager watchManager = new WatchManager(context, pInfo); watchManager.goToUpdatePage();
- Since:
- API Level 2.5
-
activateSamsungPay
public void activateSamsungPay()API to bring the Samsung Pay on watch app to a state in which cards can be added.
Samsung Pay on watch might be Samsung Account is not signed in state.
Partner app checks the Samsung Pay on watch status withgetSamsungPayStatus(StatusListener)
API.
If the status is#SPAY_NOT_READY
and#EXTRA_ERROR_REASON
is#ERROR_SPAY_SETUP_NOT_COMPLETED
,
partner app can call this API to launch Samsung Pay on watch and user can sign in to the app.
// Set the serviceId which is assigned by the Samsung Pay Developer during on boarding. String serviceId = "sampleServiceId"; Bundle bundle = new Bundle(); bundle.putString(WatchManager.PARTNER_SERVICE_TYPE, WatchManager.ServiceType.APP2APP.toString()); PartnerInfo pInfo = new PartnerInfo(serviceId, bundle); WatchManager watchManager = new WatchManager(context, pInfo); watchManager.activateSamsungPay();
- Since:
- API Level 2.5
-
getWalletInfo
API to get the requested wallet information from Samsung Pay on watch.
Partner app can use this information to uniquely identify the user and Samsung Pay on watch app on a particular device.// Set the serviceId which is assigned by the Samsung Pay Developer during on boarding. String serviceId = "sampleServiceId"; Bundle bundle = new Bundle(); bundle.putString(WatchManager.EXTRA_ISSUER_NAME, "issuer name"); bundle.putString(WatchManager.PARTNER_SERVICE_TYPE, WatchManager.ServiceType.APP2APP.toString()); PartnerInfo pInfo = new PartnerInfo(serviceId, bundle); WatchManager watchManager = new WatchManager(context, pInfo); // Bundle keys added to get wallet information from Samsung Pay on watch. // This information can be delivered to the Partner Server for eligibility check. ArrayList<String> keys = new ArrayList<>(); keys.add(WatchManager.WALLET_USER_ID); keys.add(WatchManager.DEVICE_ID); watchManager.getWalletInfo(keys, new StatusListener() { @Override public void onSuccess(int status, Bundle walletData) { // Log.d(TAG, "doWalletInfo onSuccess callback is called"); // For VISA, deviceID can be set to "clientDeviceID" as defined by VISA String deviceId = walletData.get(WatchManager.DEVICE_ID); // For VISA, walletUserId can be set to "clientWalletAccountID" as defined by VISA String walletUserId = walletData.get(WatchManager.WALLET_USER_ID); } @Override public void onFail(int errorCode, Bundle errorData) { Log.e(TAG, "onFail callback is called, errorCode: " + errorCode); // To get more reason of the failure, // check some extra error codes in the errorData bundle such as WatchManager.EXTRA_ERROR_REASON (if provided). } }
- Parameters:
keys
- Key list to get wallet information.
If the list is empty, all possible key values are returned.
The possible keys are:
#WALLET_DM_ID
#DEVICE_ID
#WALLET_USER_ID
DEVICE_SERIAL_NUM
listener
- Callback through which the result is provided.
On success,StatusListener.onSuccess(int status, Bundle data)
is invoked with wallet information.
The success code can be one of the following codes with bundle data:
Status Bundle Keys Bundle Values USAGE VTS MDES #ERROR_NONE
#WALLET_DM_ID
String Device Management ID N/A paymentAppInstanceId = DEVICE_SERIAL_NUM + WALLET_DM_ID
(*If you need 'paymentAppInstanceId', you can generate it as above)#DEVICE_ID
String Device ID clientDeviceID #WALLET_USER_ID
String Wallet User ID clientWalletAccountID DEVICE_SERIAL_NUM
String Device Serial Number N/A
On any failure, the error code is provided viaStatusListener.onFail(int errorCode, Bundle errorData)
.
Note: Please referSpaySdk.COMMON_STATUS_TABLE
in detail.
- Throws:
NullPointerException
- Thrown if parameters are null.- Since:
- API Level 2.5
-
addCard
API to add a card from partner app (example: issuer/bank app) to Samsung Pay on watch.
Partner app uses this API to add card to Samsung Pay on watch by providing the required card details. This helps user to add their cards to Samsung Pay on watch directly from partner app.WatchManager watchManager = new WatchManager(ct, pInfo); String cardType = Card.CARD_TYPE_CREDIT; String tokenizationProvider = AddCardInfo.PROVIDER_ABCD; // Get it from issuer app. // Samsung Pay on watch does not provide detailed payload information. // Generate provisioning payload in accordance with your card network specifications. String testPayload = "ThisIsTestPayloadCardInfo1234567890"; Bundle cardDetail = new Bundle(); cardDetail.putString(AddCardInfo.EXTRA_PROVISION_PAYLOAD, testPayload); AddCardInfo addCardInfo = new AddCardInfo(cardType, tokenizationProvider, cardDetail); watchManager.addCard(addCardInfo, new AddCardListener() { @Override public void onSuccess(int status, Card card) { Log.d(TAG, "onSuccess callback is called"); } @Override public void onFail(int errorCode, Bundle errorData ) { Log.e(TAG, "onFail callback is called, errorCode: " + errorCode); // To get more reason of the failure, // check some extra error codes in the errorData bundle // such as WatchManager.EXTRA_ERROR_REASON or WatchManager.EXTRA_REQUEST_ID (if provided). } @Override public void onProgress(int currentCount, int totalCount, Bundle bundleData) { Log.d(TAG,"onProgress callback is called : " + currentCount + " / " + totalCount); } });
- Parameters:
addCardInfo
- Detail card information to add.listener
- Callback through which the result is provided.
On success,AddCardListener.onSuccess(int, Card)
is invoked with#ERROR_NONE
status code with added card information.
On any failure, the error code is provided viaAddCardListener.onFail(int errorCode, Bundle errorData)
.
The failure code can be one of the following codes with bundle data:
Status Bundle Keys Bundle Values #ERROR_REGISTRATION_FAIL
(-104)#EXTRA_ERROR_REASON
AppToAppConstants.ERROR_CARD_ALREADY_REGISTERED
(-500)AppToAppConstants.ERROR_FRAMEWORK_INTERNAL
(-501)AppToAppConstants.ERROR_INVALID_CARD
(-502)AppToAppConstants.ERROR_INVALID_CARDINPUT
(-503)ERROR_INVALID_PARAMETER
(-504)AppToAppConstants.ERROR_SERVER_REJECT
(-505)AppToAppConstants.ERROR_MAX_CARD_NUM_REACHED
(-506)AppToAppConstants.ERROR_CARD_NOT_SUPPORTED
(-514)AppToAppConstants.ERROR_MAX_PAN_PROVISION_NUM_REACHED
(-515)AppToAppConstants.ERROR_WALLET_ID_MISMATCH
(-516)ERROR_SPAY_WATCH_PIN_LOCK_SETUP_CANCELED
(-701)SPAY_WATCH_UPDATE_IS_ONGOING
(-702)SPAY_WATCH_TAKING_LOG_FOR_REPORT
(-703)ERROR_SPAY_WATCH_PAY_PROGRESS
(-704)ERROR_SPAY_WATCH_CONNECTION
(-705)#EXTRA_REQUEST_ID
String value returned from server SpaySdk.COMMON_STATUS_TABLE
for other error status.
- Throws:
NullPointerException
- Thrown if parameters are null.- Since:
- API Level 2.17
-
getAllCards
API to get all the cards from Samsung Pay on watch for the given filter.
Since API level 2.5, partner must define issuer names as a card filter on Samsung Pay Developers while on-boarding.Bundle cardFilter = new Bundle(); watchManager.getAllCards(cardFilter, new GetCardListener() { @Override public void onSuccess(List<Card> cards){ // Getting card status is success if (cards == null || cards.isEmpty()){ Log.e(TAG,"No card is found"); return; } else { // Perform operation with card data. for (Card s:cards){ Log.d(TAG, "CardId: " + s.getCardId() + "CardStatus" + s.getCardStatus()); // Get extra card data. if (s.getCardInfo() != null) { String last4FPan = s.getCardInfo().getString(WatchManager.EXTRA_LAST4_FPAN); String last4DPan = s.getCardInfo().getString(WatchManager.EXTRA_LAST4_DPAN); String cardType = s.getCardInfo().getString(WatchManager.EXTRA_CARD_TYPE); String cardIssuerName = s.getCardInfo().getString(WatchManager.EXTRA_ISSUER_NAME); Log.d(TAG, "last4FPan: " + last4FPan + "last4DPan" + last4DPan + "App2AppPayLoad: " + app2AppPayLoad); } } } } @Override public void onFail(int errorCode, Bundle errorData) { Log.e(TAG, "onFail callback is called, errorCode: " + errorCode); // To get more reason of the failure, // check some extra error codes in the errorData bundle such as WatchManager.EXTRA_ERROR_REASON (if provided). } });
- Parameters:
listener
- Callback through which the result is provided.
On success,GetCardListener.onSuccess(List)
is invoked with list of Cards.
On any failure, the error code is provided viaGetCardListener.onFail(int, Bundle)
.
Note: Please referSpaySdk.COMMON_STATUS_TABLE
in detail.
- Throws:
NullPointerException
- Thrown if listener is null.- Since:
- API Level 2.13
-
Samsung Electronics.
Samsung Pay SDK 2.19.00 - Jun 12 2024