Class CardManager
java.lang.Object
com.samsung.android.sdk.samsungpay.v2.SpaySdk
com.samsung.android.sdk.samsungpay.v2.card.CardManager
- All Implemented Interfaces:
AppToAppConstants
This class provides APIs for card management. The APIs include getting
card status, adding new card to Samsung Pay, and so on.
Note:Whenever a new instance of CardManager is created, all pending requests (which were sent by another instances) will be discarded.
It would be helpful when partner application attempt to send a request again.
However, in a single session of partner application, you should maintain only one instance of this class and use it to send requests to Samsung Pay application.
Note:Whenever a new instance of CardManager is created, all pending requests (which were sent by another instances) will be discarded.
It would be helpful when partner application attempt to send a request again.
However, in a single session of partner application, you should maintain only one instance of this class and use it to send requests to Samsung Pay application.
- Since:
- API Level 1.1
-
Nested Class Summary
Nested classes/interfaces inherited from class com.samsung.android.sdk.samsungpay.v2.SpaySdk
SpaySdk.Brand, SpaySdk.ServiceType
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
This error indicates that the given parameter is invalid.
This is returned asSpaySdk.EXTRA_ERROR_REASON
forSpaySdk.ERROR_REGISTRATION_FAIL
error.Fields inherited from class com.samsung.android.sdk.samsungpay.v2.SpaySdk
COMMON_STATUS_TABLE, CRYPTOGRAM_TYPE_ICC, CRYPTOGRAM_TYPE_UCAF, DEVICE_ID, DEVICE_TYPE_GEAR, DEVICE_TYPE_PHONE, ERROR_ANDROID_PLATFORM_CHECK_FAIL, ERROR_DEVICE_INTEGRITY_CHECK_FAIL, ERROR_DEVICE_NOT_SAMSUNG, ERROR_DUPLICATED_SDK_API_CALLED, ERROR_EXPIRED_OR_INVALID_DEBUG_KEY, ERROR_INITIATION_FAIL, ERROR_MISSING_INFORMATION, ERROR_NO_NETWORK, ERROR_NONE, ERROR_NOT_ALLOWED, ERROR_NOT_FOUND, ERROR_NOT_SUPPORTED, ERROR_PARTNER_APP_BLOCKED, ERROR_PARTNER_APP_SIGNATURE_MISMATCH, ERROR_PARTNER_APP_VERSION_NOT_SUPPORTED, ERROR_PARTNER_INFO_INVALID, ERROR_PARTNER_NOT_APPROVED, ERROR_PARTNER_SDK_API_LEVEL, ERROR_PARTNER_SDK_VERSION_NOT_ALLOWED, ERROR_PARTNER_SERVICE_TYPE, ERROR_REGISTRATION_FAIL, ERROR_SDK_NOT_SUPPORTED_FOR_THIS_REGION, ERROR_SERVER_INTERNAL, ERROR_SERVER_NO_RESPONSE, ERROR_SERVICE_ID_INVALID, ERROR_SERVICE_NOT_APPROVED_FOR_RELEASE, ERROR_SERVICE_UNAVAILABLE_FOR_THIS_REGION, ERROR_SPAY_APP_INTEGRITY_CHECK_FAIL, ERROR_SPAY_APP_NEED_TO_UPDATE, ERROR_SPAY_CONNECTED_WITH_EXTERNAL_DISPLAY, ERROR_SPAY_FMM_LOCK, ERROR_SPAY_INTERNAL, ERROR_SPAY_PKG_NOT_FOUND, ERROR_SPAY_SDK_SERVICE_NOT_AVAILABLE, ERROR_SPAY_SETUP_NOT_COMPLETED, ERROR_UNABLE_TO_VERIFY_CALLER, ERROR_UNAUTHORIZED_REQUEST_TYPE, ERROR_USER_CANCELED, ERROR_USER_NOT_REGISTERED_FOR_DEBUG, EXTRA_ACCEPT_COMBO_CARD, EXTRA_CARD_TYPE, EXTRA_COUNTRY_CODE, EXTRA_CPF_HOLDER_NAME, EXTRA_CPF_NUMBER, EXTRA_CRYPTOGRAM_TYPE, EXTRA_DEVICE_CARD_LIMIT_REACHED, EXTRA_DEVICE_TYPE, EXTRA_ERROR_REASON, EXTRA_ERROR_REASON_MESSAGE, EXTRA_ISSUER_NAME, EXTRA_ISSUER_PKGNAME, EXTRA_LAST4_DPAN, EXTRA_LAST4_FPAN, EXTRA_MEMBER_ID, EXTRA_MERCHANT_REF_ID, EXTRA_PARTNER_NAME, EXTRA_REQUEST_ID, EXTRA_REQUIRE_CPF, EXTRA_RESOLVED_1, EXTRA_RESOLVED_2, EXTRA_RESOLVED_3, EXTRA_RESOLVED_4, EXTRA_RESOLVED_5, EXTRA_RESOLVED_6, EXTRA_RESOLVED_7, PARTNER_SERVICE_TYPE, SPAY_HAS_NO_TRANSIT_CARD, SPAY_HAS_TRANSIT_CARD, SPAY_NOT_ALLOWED_TEMPORALLY, SPAY_NOT_READY, SPAY_NOT_SUPPORTED, SPAY_READY, WALLET_DM_ID, WALLET_USER_ID
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
ConstructorDescriptionCardManager
(android.content.Context context, PartnerInfo partnerInfo) API to get the CardManager instance.
The caller should set valid ServiceId. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addCard
(AddCardInfo addCardInfo, AddCardListener listener) API to add a card from partner app (example: issuer/bank app) to Samsung Pay.
Partner app uses this API to add card to Samsung Pay by providing the required card details.void
getAllCards
(android.os.Bundle cardFilter, GetCardListener listener) API to get all the cards from Samsung Pay for the given filter.Methods inherited from class com.samsung.android.sdk.samsungpay.v2.SpaySdk
getVersionCode, getVersionName
-
Field Details
-
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 1.2
- See Also:
-
-
Constructor Details
-
CardManager
API to get the CardManager instance.
The caller should set valid ServiceId. PartnerInfo is passed to Samsung Pay 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(SamsungPay.EXTRA_ISSUER_NAME, issuerName); bundle.putString(SamsungPay.PARTNER_SERVICE_TYPE, SamsungPay.ServiceType.APP2APP.toString()); PartnerInfo pInfo = new PartnerInfo(serviceId, bundle); CardManager cardManager = new CardManager(ct, pInfo);
- Parameters:
context
- Activity Context or Service Context.partnerInfo
- Partner information.- Throws:
NullPointerException
- Thrown if parameters are null.- Since:
- API Level 1.1
-
-
Method Details
-
addCard
API to add a card from partner app (example: issuer/bank app) to Samsung Pay.
Partner app uses this API to add card to Samsung Pay by providing the required card details. This helps user to add their cards to Samsung Pay directly from partner app.CardManager cardManager = new CardManager(ct, pInfo); String cardType = Card.CARD_TYPE_CREDIT; String tokenizationProvider = AddCardInfo.PROVIDER_ABCD; // Get it from issuer app. // Samsung Pay 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); cardManager.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 SamsungPay.EXTRA_ERROR_REASON or SamsungPay.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 withSpaySdk.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 SpaySdk.ERROR_REGISTRATION_FAIL
(-104)SpaySdk.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)SpaySdk.EXTRA_REQUEST_ID
String value returned from server AppToAppConstants.ERROR_TSM_FAIL
(-507)SpaySdk.EXTRA_ERROR_REASON
String Error Message(For TSM solution) SpaySdk.COMMON_STATUS_TABLE
for other error status.
In case of TSM, please referAddCardListener.onProgress(int, int, Bundle)
.- Throws:
NullPointerException
- Thrown if parameters are null.- Since:
- API Level 1.2
-
getAllCards
API to get all the cards from Samsung Pay for the given filter.
Since API level 2.13,getAllCards(Bundle, GetCardListener)
would return a card list in which aCard
ofSpaySdk.Brand.VISA
brand would hold a Token Reference ID as itsCard.getCardId()
instead of a Provisioned Token ID in earlier API level.
Since API level 1.4, partner must define issuer names as a card filter on Samsung Pay Developers while on-boarding.Bundle cardFilter = new Bundle(); // since API Level 1.4, card filter is retrieved from Samsung Pay Developers. // No need to set from partner app. cardFilter.putString(CardManager.EXTRA_ISSUER_NAME, issuerName); cardManager.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(CardManager.EXTRA_LAST4_FPAN); String last4DPan = s.getCardInfo().getString(CardManager.EXTRA_LAST4_DPAN); String app2AppPayLoad = s.getCardInfo().getString(CardManager.EXTRA_APP2APP_PAYLOAD); String cardType = s.getCardInfo().getString(CardManager.EXTRA_CARD_TYPE); String cardIssuerName = s.getCardInfo().getString(CardManager.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 SamsungPay.EXTRA_ERROR_REASON (if provided). } });
- Parameters:
cardFilter
- Filter to limit the card list.
Since API level 1.4, issuer name filter is retrieved from Samsung Pay Developers.
CardFilter bundle key-value pairs are defined as follows:
Keys Values SpaySdk.EXTRA_ISSUER_NAME
String issuerName (issuerCode for Korean issuers) 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.15
-
Samsung Electronics.
Samsung Pay SDK 2.18.00 - Aug 25 2023