SDK Programming Guide
  • 3.3.10 Adding a card to Samsung Pay
  • Partner apps: Issuer

  • An issuer app can call the addCard() API method of CardManager to add a card to Samsung Pay by providing required card details, making it convenient for users to add their debit/credit cards to Samsung Pay right from the issuer app without additional steps, like manually switching between apps.

    For most issuers, getWalletInfo() can be used for requesting current wallet information to determine if the issuer’s card is eligible to be added to Samsung Pay. When the Add to Samsung Pay button is pressed, the issuer app can optionally call the getWalletInfo() API method prior to calling the addCard() API.

    • Important
    • Issuers should obtain the governing issuer implementation guide and specifications from the respective card network and implement each network’s required handling in the partner app and server.
  • The addCard() result is delivered to AddCardListener, which provides the following events:
    • onSuccess() - called when the operation succeeds; provides information and status regarding the added card.
    • onFail() - called when the operation fails.
    • onProgress() - called to indicate the current progress of the addCard() operation; can be used to show a progress bar to the user in the issuer app. This callback is supported for TSM solution issuers in China and Spain.
  • The following example demonstrates how to use the addCard()API method in the issuer app.
  • String cardType = Card.CARD_TYPE_CREDIT;
    String tokenizationProvider = AddCardInfo.PROVIDER_ABCD;
    // 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 error, Bundle errorData ) { 
    			Log.d(TAG, "onFail callback is called, code: " + error); 
    	}
    
    	@Override
    	public void onProgress(int currentCount, int totalCount, Bundle bundleData) { 
    			Log.d(TAG,"onProgress callback is called : " + currentCount + " / " +  totalCount); 
    	} 
    });