The status check includes various actions on the Samsung Wallet app and the Samsung Pay server:
With the Samsung Wallet app:
The SDK checks whether the Samsung Wallet app is installed on the device and Samsung Pay is supported.
The SDK checks whether the Samsung Wallet app setup is complete, whether the app needs an update, and whether the Samsung Pay-related SDK API level used in your app is compatible with the Samsung Wallet app version.
With the Samsung Pay server:
The SDK checks whether your app details - app name, service ID, and certificate signing request (CSR) - match their registration on the Samsung Pay Portal.
Step 1: Create a PartnerInfo or SamsungPaySdkFlutter object
Configure a valid PartnerInfo (for the Samsung Pay SDK for Android) or SamsungPaySdkFlutter (for the Samsung Pay SDK for Flutter) object. Samsung Pay uses this object for:
Validating the app’s identity and registration
Performing SDK version and API compatibility checks
Verifying the allowlist/blocklist status
To create the PartnerInfo or SamsungPaySdkFlutter object:
Include the following in the PartnerInfo or SamsungPaySdkFlutter object:
serviceId (SID): Unique ID for the service created during partner onboarding.
ServiceType: Type of service created during partner onboarding.
NoteYou must provide the ServiceType value within the data bundle.
Samsung Pay SDK for Android:
val serviceId = "partner_app_service_id"
val bundle = Bundle()
bundle.putString(SamsungPay.PARTNER_SERVICE_TYPE, SamsungPay.ServiceType.INAPP_PAYMENT.toString())
val partnerInfo = PartnerInfo(serviceId, bundle)
For the Samsung Pay SDK for Android only, you also need to create a SamsungPay instance with the PartnerInfo object:
Samsung Pay SDK for Android:
val samsungPay = SamsungPay(context, partnerInfo)
NoteIf your app is running on a Samsung Watch, create a WatchManager class instead of SamsungPay.
Step 2: Call the getSamsungPayStatus() method
Call the getSamsungPayStatus() method, provided by the SamsungPay (for the Samsung Pay SDK for Android) or SamsungPaySdkFlutter (for the Samsung Pay SDK for Flutter) class, to check whether Samsung Pay is available and ready for use on the device.
The getSamsungPayStatus() operation result is delivered to the StatusListener interface, which provides the following events:
onSuccess(): Called when the operation is successful. The listener returns the Samsung Pay status, as well as extra bundle data related to the request. The possible statuses are:
SPAY_READY: Samsung Pay is activated and ready to use. You can display the Samsung Pay button.
NoteThe bundle data contains the EXTRA_COUNTRY_CODE key that defines the current device’s country code set by Samsung Pay (in the ISO 3166-1 alpha-2 format). If your app is not supported in that country, hide the Samsung Pay button.
SPAY_NOT_SUPPORTED: Samsung Pay is not supported on this device; either the device is incompatible or the Samsung Wallet app is not installed.
SPAY_NOT_READY: Samsung Pay is not completely activated. Check the returned bundle date for the EXTRA_ERROR_REASON key and take appropriate action:
ERROR_SPAY_SETUP_NOT_COMPLETE: Samsung Pay setup is not complete. Display a pop-up message and ask the customer whether they want to activate Samsung Pay. If yes, call the activateSamsungPay() method to activate Samsung Pay.
ERROR_SPAY_APP_NEED_TO_UPDATE: Samsung Wallet app requires an update. Display a pop-up message and ask the customer whether they want to update the Samsung Wallet app. If yes, call the goToUpdatePage() method to update the Samsung Wallet app.
ERROR_PARTNER_INFO_INVALID: Partner app information is invalid, using an invalid SDK version, service type, or API level:
ERROR_PARTNER_SDK_API_LEVEL: Your app is using the wrong API level. To resolve the error, set a valid API level in your app.
ERROR_PARTNER_SERVICE_TYPE: Your app has either not set a ServiceType value in the PartnerInfo or SamsungPaySdkFlutter object, or the ServiceType value is invalid. To resolve the error, set a valid service type in the object.
onFail(): Called when the operation fails. The listener returns the error code, as well as extra bundle data with the EXTRA_ERROR_REASON key, defining the reason for the failure.
The following code snippet is an example of using the getSamsungPayStatus() method:
Samsung Pay SDK for Android:
val serviceId = "partner_app_service_id"
val bundle = Bundle()
bundle.putString(SamsungPay.PARTNER_SERVICE_TYPE, SamsungPay.ServiceType.INAPP_PAYMENT.toString())
val partnerInfo = PartnerInfo(serviceId, bundle)
val samsungPay = SamsungPay(context, partnerInfo)
/*
* Method to get the Samsung Pay status on the device.
* Partner apps must call this method to
* check the current status of Samsung Pay before any other operations.
*/
samsungPay.getSamsungPayStatus(object : StatusListener {
override fun onSuccess(status: Int, bundle: Bundle) {
when (status) {
SamsungPay.SPAY_NOT_SUPPORTED ->
// Samsung Pay is not supported
samsungPayButton.setVisibility(View.INVISIBLE)
SamsungPay.SPAY_NOT_READY -> {
// Activate or update Samsung Pay, as needed
samsungPayButton.setVisibility(View.INVISIBLE)
val errorReason = bundle.getInt(SamsungPay.EXTRA_ERROR_REASON)
if (errorReason == SamsungPay.ERROR_SETUP_NOT_COMPLETED) {
// Display an appropriate popup message to the user
samsungPay.activateSamsungPay()
} else if (errorReason == SamsungPay.ERROR_SPAY_APP_NEED_TO_UPDATE) {
// Display an appropriate popup message to the user
samsungPay.goToUpdatePage()
} else {
Toast.makeText(context, "error reason: $errorReason", Toast.LENGTH_LONG).show()
}
}
SamsungPay.SPAY_READY ->
// Samsung Pay is ready
samsungPayButton.setVisibility(View.VISIBLE)
else ->
// Unexpected result
samsungPayButton.setVisibility(View.INVISIBLE)
}
}
override fun onFail(errorCode: Int, bundle: Bundle) {
samsungPayButton.setVisibility(View.INVISIBLE)
Log.d(TAG, "checkSamsungPayStatus onFail() : $errorCode")
}
})
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.