SDK Programming Guide
  • 3.3.4 Checking registered/enrolled card brand information
  • Partner apps: Merchant, Issuer

    Before displaying the Samsung Pay button, a partner app can query card brand information for the user’s currently enrolled payment cards in Samsung Pay to determine if payment is supported with the enrolled card. For example, if a merchant app accepts one card brand exclusively but the user has not registered any cards matching this brand in Samsung Pay, the merchant app will need to determine whether or not to display the Samsung Pay button for this purchase checkout.

    To query the card brand, use the requestCardInfo() API method of the PaymentManager class. The requestFilter is optional bundle data reserved for future use. The merchant app does not need to set a value for it now. However, before calling this method, CardInfoListener must be registered so its listener can provide the following events:

    • onResult() - Called when the Samsung Pay SDK returns card information from Samsung Pay; result returns information for supported cards or is empty if no card is registered.
    • onFailure() - Called when the query fails; for example, if SDK service in the Samsung Pay app ends abnormally.
  • The following snippet shows how to retrieve the list of supported card brands from Samsung Pay:
  • Bundle bundle = new Bundle();
    bundle.putString(SamsungPay.PARTNER_SERVICE_TYPE, SamsungPay.ServiceType.INAPP_PAYMENT.toString());
    PartnerInfo partnerInfo = new PartnerInfo(serviceId, bundle);
    paymentManager = new PaymentManager(context, partnerInfo);
    paymentManager.requestCardInfo(new Bundle(), cardInfoListener); // get Card Brand List
    //CardInfoListener is for listening requestCardInfo() callback events
    final PaymentManager.CardInfoListener cardInfoListener = new PaymentManager.CardInfoListener() {
    		 * This callback is received when the card information is received successfully.
    		public void onResult(List<CardInfo> cardResponse) {
    				int visaCount = 0, mcCount = 0, amexCount = 0, dsCount = 0;
    				String brandStrings = "- Card Info : ";
    				if (cardResponse != null) {
    					PaymentManager.Brand brand;
    					for (int i = 0; i < cardResponse.size(); i++) {
    						brand = cardResponse.get(i).getBrand();
    						switch (brand) {
    							case AMERICANEXPRESS:
    							case MASTERCARD:
    							case VISA:
    							case DISCOVER:
    				brandStrings += "  VI=" + visaCount + ", MC=" + mcCount + ", AX=" + amexCount + ", DS=" + dsCount;
    				Toast.makeText(context, "cardInfoListener onResult" + brandStrings, Toast.LENGTH_LONG).show();
    		 * This callback is received when the card information cannot be retrieved.
    		 * For example, when SDK service in the Samsung Pay app dies abnormally.
    		public void onFailure(int errorCode, Bundle errorData) {
    		//Called when an error occurs during In-App cryptogram generation
    				Toast.makeText(context, "cardInfoListener onFailure : " + errorCode, Toast.LENGTH_LONG).show();