Check the Samsung Pay status
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 samsung pay sdk for flutter string serviceid; map<string,dynamic> data; static final samsungpaysdkflutterplugin = samsungpaysdkflutter partnerinfo serviceid 'partner_app_service_id', data {spaysdk partner_service_type servicetype app2app name tostring } ; 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" } } samsung pay sdk for flutter myhomepage samsungpaysdkflutterplugin getsamsungpaystatus statuslistener onsuccess status, bundle async { showstatus status, bundle ; }, onfail errorcode, bundle { showerror errorcode, bundle ; } ;