To request wallet information from Samsung Wallet, use the getWalletInfo() method, provided by the SamsungPay (for the Samsung Pay SDK for Android) or SamsungPaySdkFlutter (for the Samsung Pay SDK for Flutter) class. The method allows you to uniquely identify the customer and the Samsung Wallet app on a particular device and provides data needed for provisioning:
NoteIf your app is running on a Samsung Watch, create a WatchManager class instead of SamsungPay.
For the Samsung Pay SDK for Android only, define the information you want to retrieve as keys. If no keys are defined, DEVICE_ID, WALLET_USER_ID, and WALLET_DM_ID are returned.
For the Samsung Pay SDK for Flutter, all keys are returned by default.
Call the getWalletInfo() method. The result is delivered to the StatusListener interface, which provides the following events:
onSuccess(): Called when the operation is successful and returns the wallet details based on the defined keys.
onFail(): Called when the operation fails.
The following code snippet is an example of using the getWalletInfo() method:
Samsung Pay SDK for Android:
// Set the serviceId assigned by the Samsung Pay Portal during onboarding
val serviceId = "sampleServiceId"
val bundle = Bundle()
bundle.putString(SamsungPay.EXTRA_ISSUER_NAME, "issuer name")
bundle.putString(SamsungPay.PARTNER_SERVICE_TYPE, ServiceType.APP2APP.toString())
val pInfo = PartnerInfo(serviceId, bundle)
val samsungPay = SamsungPay(context, pInfo)
// Add bundle keys to get wallet information
// This information can be delivered to your server for an eligibility check.
val keys = ArrayList<String>()
keys.add(SamsungPay.WALLET_USER_ID)
keys.add(SamsungPay.DEVICE_ID)
samsungPay.getWalletInfo(keys, object : StatusListener{
override fun onSuccess(status: Int, walletData: Bundle) {
// Log.d(TAG, "doWalletInfo onSuccess callback is called");
// For VISA, deviceID can be set to "clientDeviceID" as defined by VISA
val deviceId = walletData.getString(SamsungPay.DEVICE_ID)
// For VISA, walletUserId can be set to "clientWalletAccountID" as defined by VISA
val walletUserId = walletData.getString(SamsungPay.WALLET_USER_ID)
}
override fun onFail(errorCode: Int, errorData: Bundle?) {
Log.e(TAG, "onFail callback is called, errorCode: " + errorCode);
// Check the extra error codes in the errorData bundle for all the reasons in
// SamsungPay.EXTRA_ERROR_REASON, when 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.