Add a co-badge card

To add a co-badge card to Samsung Wallet, use the addCobadgeCard() method, provided by the CardManager (for the Samsung Pay SDK for Android) or SamsungPaySdkFlutter (for the Samsung Pay SDK for Flutter) class. As a co-badge card combines 2 payment networks, you must provide the card details for 2 different networks to provision the card. As you can provide the necessary card details without customer input, this method allows direct provisioning without switching between apps:

  1. Gather the necessary card and wallet details in separate provisioning payloads for the primary and secondary card network, following the card networks' requirements.

  2. Call the addCobadgeCard() method. The result is delivered to the AddCardListener interface, which provides the following events:

    • onSuccess(): Called when the operation is successful and returns information and status for the provisioned co-badge card.
    • onFail(): Called when the operation fails.

The following code snippet is an example of using the addCobadgeCard() method:

Samsung Pay SDK for Android:

String cardType = Card.CARD_TYPE_CREDIT;
String primaryTokenizationProvider = AddCardInfo.PROVIDER_ABCD;

// Provide your primary card network payload
String testPrimaryPayload = "ThisIsTestPrimaryPayloadCardInfo1234567890";

String secondaryTokenizationProvider = AddCardInfo.PROVIDER_EFGH;
// Provide your secondary card network payload
String testSecondaryPayload = "ThisIsTestSecondaryPayloadCardInfo1234567890";

Bundle primaryCardDetail = new Bundle();
primaryCardDetail.putString(AddCardInfo.EXTRA_PROVISION_PAYLOAD, testPrimaryPayload);
AddCardInfo primaryAddCardInfo = new AddCardInfo(cardType, primaryTokenizationProvider, primaryCardDetail);

Bundle secondaryCardDetail = new Bundle();
secondaryCardDetail.putString(AddCardInfo.EXTRA_PROVISION_PAYLOAD, testSecondaryPayload);
AddCardInfo secondaryAddCardInfo = new AddCardInfo(cardType, secondaryTokenizationProvider, secondaryCardDetail);

cardManager.addCobadgeCard(primaryAddCardInfo, secondaryAddCardInfo, 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");
        // Check extra error codes in the errorData bundle, such as 
        // SamsungPay.EXTRA_ERROR_REASON or SamsungPay.EXTRA_REQUEST_ID (if provided)
    }
})

Samsung Pay SDK for Flutter:

String cardType = WalletCard.CARD_TYPE_CREDIT_DEBIT;

String primarytokenProvider = AddCardInfo.PROVIDER_ABCD;
// Provide your primary card network payload
String testPrimaryPayload = "ThisIsTestPrimaryPayloadCardInfo1234567890";

String secondarytokenProvider = AddCardInfo.PROVIDER_EFGH;
// Provide your secondary card network payload
String testSecondaryPayload = "ThisIsTestSecondaryPayloadCardInfo1234567890";

Map<String, dynamic> primaryCardDetails={};
primaryCardDetails[AddCardInfo.EXTRA_PROVISION_PAYLOAD] = testPrimaryPayload;

Map<String, dynamic> secondaryCardDetails={};
secondaryCardDetails[AddCardInfo.EXTRA_PROVISION_PAYLOAD] = testSecondaryPayload;

var primaryAddCardInfo = AddCardInfo(cardType, primarytokenProvider, primaryCardDetails);
var secondaryAddCardInfo = AddCardInfo(cardType, secondarytokenProvider, secondaryCardDetails);

MyApp.samsungPaySdkFlutterPlugin.addCobadgeCard(primaryAddCardInfo, secondaryAddCardInfo, AddCardListener(onSuccess: (status, card){

    print("Success : $status / Data : $card");

},onFail: (errorCode, bundle){

    print("Error : $errorCode / Data : $bundle");

},ON-PROGRESS: (currentCount, totalCount, bundle){

    print("currentCount : $currentCount / totalCount : $totalCount / Data : $bundle");

}));