To add a standard debit or credit card to Samsung Wallet, use the addCard() method, provided by the CardManager (for the Samsung Pay SDK for Android) or SamsungPaySdkFlutter (for the Samsung Pay SDK for Flutter) class. As you can provide the necessary card details without customer input, this method allows direct provisioning without switching between apps:
NoteIf your app is running on a Samsung Watch, create a WatchManager class instead of CardManager.
Gather the necessary card and wallet details in a provisioning payload, following the card network's requirements.
Call the addCard() 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 card.
onFail(): Called when the operation fails.
The following code snippet is an example of using the addCard() method:
Samsung Pay SDK for Android:
val cardType = Card.CARD_TYPE_CREDIT
val tokenizationProvider: String = AddCardInfo.PROVIDER_ABCD
// Samsung Pay does not provide detailed payload information; generate the provisioning payload in
// accordance with your card network specifications
val testPayload = "ThisIsTestPayloadCardInfo1234567890"
val cardDetail = Bundle()
cardDetail.putString(EXTRA_PROVISION_PAYLOAD, testPayload)
val addCardInfo = AddCardInfo(cardType, tokenizationProvider, cardDetail)
cardManager.addCard(addCardInfo, object : AddCardListener {
override fun onSuccess(status: Int, card: Card?) {
Log.d(TAG, "onSuccess callback is called");
}
override fun onFail(errorCode: Int, errorData: Bundle?) {
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)
}
})
We use cookies to improve your experience on our website and to show you relevant
advertising. Manage you settings for our cookies below.
Essential Cookies
These cookies are essential as they enable you to move around the website. This
category cannot be disabled.
Company
Domain
Samsung Electronics
developer.samsung.com, .samsung.com
Analytical/Performance Cookies
These cookies collect information about how you use our website. for example which
pages you visit most often. All information these cookies collect is used to improve
how the website works.
Company
Domain
Samsung Electronics
.samsung.com
Functionality Cookies
These cookies allow our website to remember choices you make (such as your user name, language or the region your are in) and
tailor the website to provide enhanced features and content for you.
Company
Domain
Samsung Electronics
developer.samsung.com, google.account.samsung.com
Preferences Submitted
You have successfully updated your cookie preferences.