SDK Programming Guide
  • 3.3.8 Requesting the list of registered cards in Samsung Pay
  • Partner apps: Issuer

  • The getAllCards() method of the CardManager class is used to request a list of all cards currently registered/enrolled in the Samsung Pay app. To succeed, the issuer app must pass valid PartnerInfo to CardManager for caller verification. cardFilter narrows the card list returned by Samsung Pay to the issuerName specified.

    However, as of API level 1.4, cardFilter retrieves this information from the Samsung Pay Developers portal. Certain issuers may need to use multiple ISSUER NAMEs depending on their app and/or the requirements of their TSP.

    Therefore, cardFilter must include the ISSUER NAME(s) defined for the issuer’s APP2APP service type on the Samsung Pay Developers portal so that Samsung Pay returns only cards with an ISSUER NAME match for a getAllCards() call.

    The getAllCards() method is typically called when the partner app wants to check card status. It does not need to be called every time the partner app resumes. For example, the issuer app should call this API method when creating the card list in the onCreate() method, rather than the onResume() method.

    The result of a getAllCards() call is delivered to GetCardListener, which provides the following events:

    • onSuccess() - called when the operation succeeds; provides the list of all filtered cards and their status. Card information includes cardId, cardStatus, and extra cardInfo data.
    • onFail() - called when the operation fails.
  • The following example shows how to use the getAllCards() API method in the issuer app.
  • Bundle cardFilter = new Bundle();
    // Since API level 1.4, cardFileter param will be ignored. Partner does not need to use it here.
    // It will be retrieved from Samsung Pay Developers portal.
    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 error, Bundle errorData) {
    			// Getting card status is failed
           }
    });