Filter
-
Content Type
-
Category
Mobile/Wearable
Visual Display
Digital Appliance
Platform
Recommendations
Filter
Develop Samsung Pay
apioverview package class tree index help package com samsung android sdk samsungpay v2 class watchmanager java lang object samsungpaybase com samsung android sdk samsungpay v2 watchmanager all implemented interfaces apptoappconstants public final class watchmanager extends samsungpaybase implements apptoappconstants this class provides apis for watch management partner apps must check the samsung pay watch status on the device before performing any card management also, this class provides apis getting cards information, adding new card to samsung pay on watch, and so on since api level 2 5 field summary fields modifier and type field description static final string device_serial_num key to represent device serial number to generate the paymentappinstanceid static final int error_invalid_parameter this error indicates that the given parameter is invalid this is returned as spaysdk extra_error_reason for spaysdk error_registration_fail error static final int error_spay_pin_lock_setup_canceled this error indicates that user canceled the pin lock setup partner app should ask user to setup pin for samsung pay gear static final int error_spay_watch_connection this error indicates that samsung pay watch plug-in can not connect with samsung pay watch partner app should ask user to check bluetooth connection or pairing static final int error_spay_watch_pay_progress this error indicates that samsung pay watch is in a process of payment static final int error_spay_watch_pin_lock_setup_canceled this error indicates that user canceled the pin lock setup partner app should ask user to setup pin for samsung pay watch static final int spay_watch_taking_log_for_report this error indicates that samsung pay watch is taking log for error report static final int spay_watch_update_is_ongoing this error indicates that samsung pay watch being updated fields inherited from interface com samsung android sdk samsungpay v2 apptoappconstants error_auth_code_expired, error_auth_code_invalid, error_auth_code_max_try_reached, error_auth_code_type_invalid, error_authentication_closed, error_authentication_failed, error_authentication_not_ready, error_authentication_timed_out, error_card_already_registered, error_card_idv_not_supported, error_card_not_supported, error_framework_internal, error_invalid_card, error_invalid_cardinput, error_max_card_num_reached, error_max_pan_provision_num_reached, error_server_reject, error_tsm_fail, error_verify_card, error_wallet_id_mismatch, extra_app2app_intent, extra_app2app_payload, extra_card_balance, extra_card_status_reason, extra_issuer_app_card_linked constructor summary constructors constructor description watchmanager android content context context, partnerinfo partnerinfo api to get the watchmanager instance the caller should set valid serviceid method summary all methodsinstance methodsconcrete methods modifier and type method description void activatesamsungpay api to bring the samsung pay on watch app to a state in which cards can be added samsung pay on watch might be samsung account is not signed in state partner app checks the samsung pay on watch status with getsamsungpaystatus statuslistener api if the status is #spay_not_ready and #extra_error_reason is #error_spay_setup_not_completed, partner app can call this api to launch samsung pay on watch and user can sign in to the app void addcard addcardinfo addcardinfo, addcardlistener listener api to add a card from partner app example issuer/bank app to samsung pay on watch partner app uses this api to add card to samsung pay on watch by providing the required card details void getallcards android os bundle cardfilter, getcardlistener listener api to get all the cards from samsung pay on watch for the given filter void getsamsungpaystatus statuslistener listener api to get the samsung pay on watch status on the device partner issuers applications must call this api to check the current state of samsung pay on watch before doing any operation void getwalletinfo list<string> keys, statuslistener listener api to get the requested wallet information from samsung pay on watch partner app can use this information to uniquely identify the user and samsung pay on watch app on a particular device void gotoupdatepage api to go to samsung pay on watch update page partner app checks the samsung pay on watch status with getsamsungpaystatus statuslistener api if the status is #spay_not_ready and #extra_error_reason is #error_spay_app_need_to_update, partner app can call this api to go to update samsung pay on watch app methods inherited from class java lang object equals, getclass, hashcode, notify, notifyall, tostring, wait, wait, wait field details device_serial_num public static final string device_serial_num key to represent device serial number to generate the paymentappinstanceid since api level 2 5 see also constant field values error_spay_pin_lock_setup_canceled public static final int error_spay_pin_lock_setup_canceled this error indicates that user canceled the pin lock setup partner app should ask user to setup pin for samsung pay gear since api level 2 5 see also constant field values error_invalid_parameter public static final int error_invalid_parameter this error indicates that the given parameter is invalid this is returned as spaysdk extra_error_reason for spaysdk error_registration_fail error since api level 2 5 see also constant field values error_spay_watch_pin_lock_setup_canceled public static final int error_spay_watch_pin_lock_setup_canceled this error indicates that user canceled the pin lock setup partner app should ask user to setup pin for samsung pay watch since api level 2 5 see also constant field values spay_watch_update_is_ongoing public static final int spay_watch_update_is_ongoing this error indicates that samsung pay watch being updated since api level 2 5 see also constant field values spay_watch_taking_log_for_report public static final int spay_watch_taking_log_for_report this error indicates that samsung pay watch is taking log for error report since api level 2 5 see also constant field values error_spay_watch_pay_progress public static final int error_spay_watch_pay_progress this error indicates that samsung pay watch is in a process of payment since api level 2 5 see also constant field values error_spay_watch_connection public static final int error_spay_watch_connection this error indicates that samsung pay watch plug-in can not connect with samsung pay watch partner app should ask user to check bluetooth connection or pairing since api level 2 5 see also constant field values constructor details watchmanager public watchmanager android content context context, partnerinfo partnerinfo api to get the watchmanager instance the caller should set valid serviceid partnerinfo is passed to samsung pay on watch for caller verification context ct = activity; // or context ct = service; string issuername = "mybank"; // set the serviceid which is assigned by the samsung pay developer during on boarding string serviceid = "sampleserviceid"; bundle bundle = new bundle ; bundle putstring watchmanager extra_issuer_name, issuername ; bundle putstring watchmanager partner_service_type, watchmanager servicetype app2app tostring ; partnerinfo pinfo = new partnerinfo serviceid, bundle ; watchmanager watchmanager = new watchmanager ct, pinfo ; parameters context - activity context or service context partnerinfo - partner information throws nullpointerexception - thrown if parameters are null since api level 2 5 method details getsamsungpaystatus public void getsamsungpaystatus statuslistener listener api to get the samsung pay on watch status on the device partner issuers applications must call this api to check the current state of samsung pay on watch before doing any operation // set the serviceid which is assigned by the samsung pay developer during on boarding string serviceid = "sampleserviceid"; bundle bundle = new bundle ; bundle putstring watchmanager partner_service_type, watchmanager servicetype app2app tostring ; partnerinfo pinfo = new partnerinfo serviceid, bundle ; watchmanager watchmanager = new watchmanager context, pinfo ; watchmanager getsamsungpaystatus new statuslistener { @override public void onsuccess int status, bundle data { // success case if status == spay_ready { log d tag, "samsung pay on watch is ready on the device" ; // perform your operation } else if status == spay_not_ready { // samsung pay on watch is supported but not fully ready // if extra_error_reason is error_spay_app_need_to_update, // call gotoupdatepage // if extra_error_reason is error_spay_setup_not_completed, // call activatesamsungpay } else { // samsung pay on watch is not supported on this device log d tag, "device does not support samsung pay on watch" ; } } @override public void onfail int errorcode, bundle errordata { log e tag, "onfail callback is called, errorcode " + errorcode ; // to get more reason of the failure, // check some extra error codes in the errordata bundle such as watchmanager extra_error_reason if provided } } ; parameters listener - callback through which the result is provided on success, samsung pay on watch status code is provided via statuslistener onsuccess int status, bundle data if samsung pay on watch is ready to be used, #spay_ready will be returned otherwise, #spay_not_ready or #spay_not_supported can be returned with #extra_error_reason from bundle also, partner can get extra information from bundle data bundle keys if provided bundle values spaysdk extra_country_code device country code iso 3166-1 alpha-2 on any failure, the failure code is provided via statuslistener onfail int errorcode, bundle errordata note please refer spaysdk common_status_table in detail throws nullpointerexception - thrown if the callback passed is null since api level 2 5 gotoupdatepage public void gotoupdatepage api to go to samsung pay on watch update page partner app checks the samsung pay on watch status with getsamsungpaystatus statuslistener api if the status is #spay_not_ready and #extra_error_reason is #error_spay_app_need_to_update, partner app can call this api to go to update samsung pay on watch app // set the serviceid which is assigned by the samsung pay developer during on boarding string serviceid = "sampleserviceid"; bundle bundle = new bundle ; bundle putstring watchmanager partner_service_type, watchmanager servicetype app2app tostring ; partnerinfo pinfo = new partnerinfo serviceid, bundle ; watchmanager watchmanager = new watchmanager context, pinfo ; watchmanager gotoupdatepage ; since api level 2 5 activatesamsungpay public void activatesamsungpay api to bring the samsung pay on watch app to a state in which cards can be added samsung pay on watch might be samsung account is not signed in state partner app checks the samsung pay on watch status with getsamsungpaystatus statuslistener api if the status is #spay_not_ready and #extra_error_reason is #error_spay_setup_not_completed, partner app can call this api to launch samsung pay on watch and user can sign in to the app // set the serviceid which is assigned by the samsung pay developer during on boarding string serviceid = "sampleserviceid"; bundle bundle = new bundle ; bundle putstring watchmanager partner_service_type, watchmanager servicetype app2app tostring ; partnerinfo pinfo = new partnerinfo serviceid, bundle ; watchmanager watchmanager = new watchmanager context, pinfo ; watchmanager activatesamsungpay ; since api level 2 5 getwalletinfo public void getwalletinfo list<string> keys, statuslistener listener api to get the requested wallet information from samsung pay on watch partner app can use this information to uniquely identify the user and samsung pay on watch app on a particular device // set the serviceid which is assigned by the samsung pay developer during on boarding string serviceid = "sampleserviceid"; bundle bundle = new bundle ; bundle putstring watchmanager extra_issuer_name, "issuer name" ; bundle putstring watchmanager partner_service_type, watchmanager servicetype app2app tostring ; partnerinfo pinfo = new partnerinfo serviceid, bundle ; watchmanager watchmanager = new watchmanager context, pinfo ; // bundle keys added to get wallet information from samsung pay on watch // this information can be delivered to the partner server for eligibility check arraylist<string> keys = new arraylist<> ; keys add watchmanager wallet_user_id ; keys add watchmanager device_id ; watchmanager getwalletinfo keys, new statuslistener { @override public void onsuccess int status, bundle walletdata { // log d tag, "dowalletinfo onsuccess callback is called" ; // for visa, deviceid can be set to "clientdeviceid" as defined by visa string deviceid = walletdata get watchmanager device_id ; // for visa, walletuserid can be set to "clientwalletaccountid" as defined by visa string walletuserid = walletdata get watchmanager wallet_user_id ; } @override public void onfail int errorcode, bundle errordata { log e tag, "onfail callback is called, errorcode " + errorcode ; // to get more reason of the failure, // check some extra error codes in the errordata bundle such as watchmanager extra_error_reason if provided } } parameters keys - key list to get wallet information if the list is empty, all possible key values are returned the possible keys are #wallet_dm_id #device_id #wallet_user_id device_serial_num listener - callback through which the result is provided on success, statuslistener onsuccess int status, bundle data is invoked with wallet information the success code can be one of the following codes with bundle data status bundle keys bundle values usage vts mdes #error_none #wallet_dm_id string device management id n/a paymentappinstanceid = device_serial_num + wallet_dm_id *if you need 'paymentappinstanceid', you can generate it as above #device_id string device id clientdeviceid #wallet_user_id string wallet user id clientwalletaccountid device_serial_num string device serial number n/a on any failure, the error code is provided via statuslistener onfail int errorcode, bundle errordata note please refer spaysdk common_status_table in detail throws nullpointerexception - thrown if parameters are null since api level 2 5 addcard public void addcard addcardinfo addcardinfo, addcardlistener listener api to add a card from partner app example issuer/bank app to samsung pay on watch partner app uses this api to add card to samsung pay on watch by providing the required card details this helps user to add their cards to samsung pay on watch directly from partner app watchmanager watchmanager = new watchmanager ct, pinfo ; string cardtype = card card_type_credit; string tokenizationprovider = addcardinfo provider_abcd; // get it from issuer app // samsung pay on watch does not provide detailed payload information // generate provisioning payload in accordance with your card network specifications string testpayload = "thisistestpayloadcardinfo1234567890"; bundle carddetail = new bundle ; carddetail putstring addcardinfo extra_provision_payload, testpayload ; addcardinfo addcardinfo = new addcardinfo cardtype, tokenizationprovider, carddetail ; watchmanager addcard addcardinfo, new addcardlistener { @override public void onsuccess int status, card card { log d tag, "onsuccess callback is called" ; } @override public void onfail int errorcode, bundle errordata { log e tag, "onfail callback is called, errorcode " + errorcode ; // to get more reason of the failure, // check some extra error codes in the errordata bundle // such as watchmanager extra_error_reason or watchmanager extra_request_id if provided } @override public void onprogress int currentcount, int totalcount, bundle bundledata { log d tag,"onprogress callback is called " + currentcount + " / " + totalcount ; } } ; parameters addcardinfo - detail card information to add listener - callback through which the result is provided on success, addcardlistener onsuccess int, card is invoked with #error_none status code with added card information on any failure, the error code is provided via addcardlistener onfail int errorcode, bundle errordata the failure code can be one of the following codes with bundle data status bundle keys bundle values #error_registration_fail -104 #extra_error_reason apptoappconstants error_card_already_registered -500 apptoappconstants error_framework_internal -501 apptoappconstants error_invalid_card -502 apptoappconstants error_invalid_cardinput -503 error_invalid_parameter -504 apptoappconstants error_server_reject -505 apptoappconstants error_max_card_num_reached -506 apptoappconstants error_card_not_supported -514 apptoappconstants error_max_pan_provision_num_reached -515 apptoappconstants error_wallet_id_mismatch -516 error_spay_watch_pin_lock_setup_canceled -701 spay_watch_update_is_ongoing -702 spay_watch_taking_log_for_report -703 error_spay_watch_pay_progress -704 error_spay_watch_connection -705 #extra_request_id string value returned from server note please refer spaysdk common_status_table for other error status throws nullpointerexception - thrown if parameters are null since api level 2 17 getallcards public void getallcards android os bundle cardfilter, getcardlistener listener api to get all the cards from samsung pay on watch for the given filter since api level 2 5, partner must define issuer names as a card filter on samsung pay developers while on-boarding bundle cardfilter = new bundle ; watchmanager getallcards cardfilter, new getcardlistener { @override public void onsuccess list<card> cards { // getting card status is success if cards == null || cards isempty { log e tag,"no card is found" ; return; } else { // perform operation with card data for card s cards { log d tag, "cardid " + s getcardid + "cardstatus" + s getcardstatus ; // get extra card data if s getcardinfo != null { string last4fpan = s getcardinfo getstring watchmanager extra_last4_fpan ; string last4dpan = s getcardinfo getstring watchmanager extra_last4_dpan ; string cardtype = s getcardinfo getstring watchmanager extra_card_type ; string cardissuername = s getcardinfo getstring watchmanager extra_issuer_name ; log d tag, "last4fpan " + last4fpan + "last4dpan" + last4dpan + "app2apppayload " + app2apppayload ; } } } } @override public void onfail int errorcode, bundle errordata { log e tag, "onfail callback is called, errorcode " + errorcode ; // to get more reason of the failure, // check some extra error codes in the errordata bundle such as watchmanager extra_error_reason if provided } } ; parameters listener - callback through which the result is provided on success, getcardlistener onsuccess list is invoked with list of cards on any failure, the error code is provided via getcardlistener onfail int, bundle note please refer spaysdk common_status_table in detail throws nullpointerexception - thrown if listener is null since api level 2 13 samsung electronics samsung pay sdk 2 19 00 - jun 12 2024
Develop Samsung Pay
docinbound general contract base url https //s2p-api mpay samsung com/ext/v1 security mutual ssl is required common headers header name type validation description request-id uuid required unique identifier for the request partner-id uuid required unique identifier that is provided to partner during onboarding partner-id uuid required request-id echoed back in the response headers common http error codes http code description application code message 400 bad request 400 1 invalid data 500 internal server error 500 1 internal server error 503 service not available 503 1 service temporarily unavailable retry-after header is required 503 service not available 503 2 api temporarily unavailable retry-after header is required registration partner server registers a session for the user as a result, a unique registration id will be generated partner server should make sure that this is called only once for one card a welcomeurl will also be returned partner server can display the welcomeurl in browser or email upon rendering, a qr code will be displayed and users can use their spay wa to scan the qr code welcomeurl has an expiration date, partner server should check if it's still valid before rendering if it's expired, a get call will return the new url request post /registrations body registration email description user email address type string validation optional example registration enforceemailmatching description enforce only spay wa with the same email address can provision enforcement is only against the email address that's provided by the partner type boolean default is false validation optional example true registration hideemail description hide email field type boolean default is false validation optional example registration phone description user phone number type phonenumber validation optional example registration enforcephonematching description enforce only spay wa with the same phone number can provision enforcement is only against the phone number that's provided by the partner type boolean validation optional default is false example true registration hidephone description hide phone field type boolean validation optional default is false example registration welcomecallbackurl description callback url that the welcome ui will redirect to once the user successfully linked a spay wa account type url validation optional example registration allowofflinecommunication description if true, s2p will communicate to the user via email and/or phone number to facilitate the provisioning process type boolean validation optional default is false example registration data description arbitrary data blob that'll be passed to the device when an account is linked type object validation optional example registration custom cardname description card name that'll show on the welcome page type string validation required example registration custom cardarturl description cardart url that'll show on the welcome page type url validation required example registration custom partnername description partner name that'll show on the welcome page type string validation required example registration custom partnerlogourl description partner logo url that'll show on the welcome page type url validation required example registration custom partnertncurl description partner tnc url that'll show on the welcome page type url validation optional example response status http/1 1 201 created header name value content-type application/json body registration id description registration id that identify this session type uuid validation required example registration status description registration status type enum - pending, linked validation required example pending registration welcomeurl description this is the url that partner can show to the user as an iframe a separate page it shows the qrcode and optionally user can enter email and phone number type url validation required example registration welcomeurlexpiration description welcomeurl expiration timestamp in milliseconds type timestamp validation required example example post /ext/v1/registrations { "email" "user@gmail com", "enforceemailmatching" true, "phone" "14089998888", "enforcephonematching" true, "custom" { "cardname" "xyz bank credit card", "cardarturl" "https //xyz com/cardart png", "partnername" "xyz bank", "partnerlogourl" "https //xyz com/logo png" } } http/1 1 201 created { "id" "395ce2e29485442cbd9bacdc77105126", "welcomeurl" "https //s2p stg mpay samsung com/v1/welcome/eyjlbmmioijbmju2r0nniiw iywxnijoizglyin0 s0dnxrskdkjw8sbh kg4uqhfwkkdnqrviihkaqshq_jayb99ct tizdzrwrn-qlhuzj4imuyv1sagehavyxluamarwa tlekqcerr0jklc-fnqkcva", "status" "pending", "welcomeurlexpiration" 1505953396844 } get registration check existing registration status and/or get new welcomeurl request get /registrations/{regid} headers name value validation partner-id partner id value assigned by samsung wallet required response status http/1 1 200 ok status name value content-type application/json body registration id description registration id that identify this session type uuid validation required example registration status description registration status type enum - pending, linked validation required example pending registration welcomeurl description this is the url that partner can show to the user as an iframe a separate page it shows the qrcode and optionally user can enter email and phone number type url validation required example registration welcomeurlexpiration description welcomeurl expiration timestamp in milliseconds type timestamp validation required example example http/1 1 200 ok { "id" "395ce2e29485442cbd9bacdc77105126", "welcomeurl" "https //s2p stg mpay samsung com/v1/welcome/eyjlbmmioijbmju2r0nniiw iywxnijoizglyin0 s0dnxrskdkjw8sbh kg4uqhfwkkdnqrviihkaqshq_jayb99ct tizdzrwrn-qlhuzj4imuyv1sagehavyxluamarwa tlekqcerr0jklc-fnqkcva", "status" "pending", "welcomeurlexpiration" 1505953396844 } errors common http error codes http code description application code message 400 bad request 400 1 invalid data 500 internal server error 500 1 internal server error 503 service not available 503 1 service temporarily unavailable retry-after header is required 503 service not available 503 2 api temporarily unavailable retry-after header is required
Develop Samsung Pay
docintroduction detailed flow step 1 → 2 partner server is ready to show the user the "add to spay ui" partner server registers to save2pay and gets a regid and welcomeurl back regid uniquely identifies this session and should be cached by partner server and used throughout the entire flow welcomeurl provides the ui to lead the user to add the card to spay step 3 the partner server shows the welcome ui on the browser, presumably in an iframe the welcome ui would show qr code as well as necessary instructions step 4 user launches spay wa and scans the qr code displayed on the welcome ui if spay wa was not installed, the instructions on welcome ui would lead the user to download the app if necessary , register samsung account and login into the spay client step 5 → 6 the spay wa qr scanner would attempt to invoke the url embedded in the qrcode, more specifically the "initiate" request to save2pay server the server verifies the payload and notifies partner server that the spay wa is ready device specific information such as the device id, wallet id & user id will also be sent this step essentially links the samsung account with the regid the welcome ui would also show a message indicating the linking is successful step 7 → 8 partner server talks to the issuer to pre-provision the card and get encrypted issuerblob step 9 partner server returns the issuerblob in the notify response the issuerblob will be encrypted and can only be decrypted by the issuer server the blob will also have device and wallet specific information so it can only be provisioned to the device that made the 'initiate' request the exact format of the issuerblob depends on the issuer step 10 the issuerblob and additional information are returned to the device in the 'initiate' response steps 11 → 16 spay wa would go through the normal tokenization flow to add the token into spay using the issuerblob step 17 spay wa report to s2p server that the provision is completed for this regid step 18 s2p notifies partner server that provisioning is completed for this regid data types type json type format description string string size 2048 boolean boolean object object enum string pattern [a-za-z0-9_]{1,256 values from a limited set are only allowed each field of type enum will define the values allowed phonenumber string pattern [0-9+ -]+ uuid string pattern [a-za-z0-9-_]{26,128} unique identifie url string size 2048 must be an absolute url defined by rfc 2396 uniform resource identifiers uri generic syntax supported schemes - http, https timestamp number int64 - signed 64 bits unix epoch time in milliseconds countrycode string size 2 unique identifie
Learn Code Lab
codelabdevelop a blockchain shopping app objective create a shopping application with samsung blockchain platform sdk and pay using ethereum network overview the blockchain industry is expanding in many ways it is growing the most as a means of payment samsung blockchain platform sdk helps to make payments easily with cryptocurrency you can interact with blockchain through a simple api call to create a transaction in this code lab, you can pay for a product using the ethereum network in a simple shopping app, which is a decentralized application dapp dapps run and store data on the blockchain network instead of a central server set up your environment you will need the following java se development kit 8 or later android studio latest version recommended mobile phone with samsung blockchain sample code here is a sample code for you to start coding in this code lab download it and start your learning experience! platform sdk sample code 3 94 mb enable developer mode to activate developer mode on your mobile device, follow the steps below navigate through settings > biometrics and security > samsung blockchain keystore and click about blockchain keystore tap the samsung blockchain keystore app name quickly, ten times or more if succeeded, developer mode will show import project file open the downloaded sample code containing the shopping app project go to file > open and select the open file or project window every gui resources are already included in the provided project you simply need to fill out the code by following the next steps moreover, it is recommended to go through the documentations of samsung blockchain platform sdk initialize the instance create an sblockchain instance this is the first step since sblockchain is the initial base class of sdk along with that are hardwarewalletmanager responsible for wallet operations accountmanager responsible for account operations msblockchain = new sblockchain ; msblockchain initialize mcontext ; maccountmanager = msblockchain getaccountmanager ; mhardwarewalletmanager = msblockchain gethardwarewalletmanager ; mcoinnetworkinfo = new coinnetworkinfo cointype eth, ethereumnetworktype goerli, rpcurl ; connecttokeystore ; connect to samsung blockchain keystore you can get hardware wallet instance from hardwarewalletmanager hardwarewallettype refers to the type of cold wallet to be connected, such as samsung blockchain keystore and ledger nano s mhardwarewalletmanager connect hardwarewallettype samsung, false setcallback new listenablefuturetask callback<hardwarewallet> { @override public void onsuccess hardwarewallet hardwarewallet { handler post new runnable { @override public void run { log i tag,"hardwarewallet is connected successfully" ; mprogressbar setvisibility view invisible ; setaccountstatus ; } } ; } @override public void onfailure @notnull executionexception e { mprogressbar setvisibility view invisible ; e printstacktrace ; } @override public void oncancelled @notnull interruptedexception e { mprogressbar setvisibility view invisible ; e printstacktrace ; } } ; the second parameter of connect api refers to reset if you do not want to reset the wallet then keep it false, otherwise true manage your account now, your shopping dapp is connected to the keystore it means that if you have your own account with balance, you can now buy using ether or eth let’s create an ethereum account to be used for payment for generating a new account with samsung blockchain platform sdk you need an instance of the accountmanager from sblockchain accountmanager provides methods for fetching, creating, restoring accounts, and other more once you have an instance of accountmanager, you can call generatenewaccount as shown below it has methods regarding accounts such as get, create, and restore refer to the samsung blockchain platform sdk documentations for more details hardwarewallet connectedhardwarewallet = mhardwarewalletmanager getconnectedhardwarewallet ; if connectedhardwarewallet != null { try { maccountmanager generatenewaccount connectedhardwarewallet, mcoinnetworkinfo get ; } catch interruptedexception e { e printstacktrace ; } catch executionexception e { e printstacktrace ; } } if an account is already created, textview is shown at the top of the app and the create account button is disabled to prevent further account creation list<account> accounts = maccountmanager getaccounts null, cointype eth, ethereumnetworktype goerli ; if !accounts isempty { methereumaccount = ethereumaccount accounts get accounts size - 1 ; tvaccountstatus settext methereumaccount getaddress ; btncreateaccount setenabled false ; } get instance for ledger service after creating an account, you can use it for payment in your shopping dapp each coin blockchain ledgers has its own system to be stored in blocks samsung blockchain platform sdk provides abstracted api sets to developers for signing and sending supported cryptocurrency transactions over the blockchain network create coinservicefactory and just use any ledger you want in this scenario, use ethereumservice ethereumservice service = ethereumservice coinservicefactory getcoinservice mcontext, mcoinnetworkinfo ; at this point, your shopping dapp is ready to provide payment methods working on ethereum notebefore the next step, you need at least one valid ethereum account show payment sheet when a user selects an item, the app should show the payment screen it must show “who will pay how much amount of ether to whom” in the blockchain world, ethereum ledgers require more information, such as transaction nonce, to record that transaction into ledgers with samsung blockchain platform sdk, developers can do everything needed to show the payment sheet, intent should be created, which is to call the payment activity on click event of product object fill the parameters required and startactivityforresult to show a payment sheet item item = itemlist get position ; biginteger price = ethereumutils convertethtowei item getprice ; ethereumservice service = ethereumservice coinservicefactory getcoinservice mcontext, mcoinnetworkinfo ; hardwarewallet connectedhardwarewallet = mhardwarewalletmanager getconnectedhardwarewallet ; intent intent = service createethereumpaymentsheetactivityintent mcontext, connectedhardwarewallet, ethereumtransactiontype eip1559, methereumaccount, sample_to_adderss, price, null, null ; startactivityforresult intent, 0 ; get ether from faucet you need money when you buy something a free faucet site is provided to get ether if you have an ethereum account, just go to webview fragment and press send me eth button see the result of transaction if the payment was performed successfully from the payment screen, the result of transaction can be received from onactivityresult if the transaction is performed properly, you can find the result_ok at resultcode from the intent, a txid is shown which can be used to check your transaction’s status call gettransactiondetail txid string api method in ethereumservice and check the block# if there’s any valid countable number, your transaction is stored in blocks successfully and the payment is done if you can’t find it, just wait it’s processing among ethereum nodes alternatively, simply find the txid in goerli testnet explorer run the project you have created and verify that it works properly open the app and select the product from the list in the payment screen, select the fee to pay to the ethereum network and confirm the transaction then, check the result of the generated transaction sample images of the app screen can be seen below you're done! congratulations! you have successfully achieved the goal of this code lab now, you can develop a shopping dapp using samsung blockchain platform sdk by yourself! if you're having trouble, you may download this file platform sdk complete code 3 95 mb to learn more about developing apps with samsung blockchain, visit developer samsung com/blockchain
Learn Code Lab
codelabtransfer erc20 token with blockchain app objective develop a decentralized application dapp to transfer erc20 tokens between ethereum accounts using samsung blockchain platform sdk overview blockchain technology has been creating a significant impact in multiple sectors, such as banking, cybersecurity, and supply chain management it is widely used as a means of secure payment between different parties samsung blockchain platform sdk brings developers and consumers to the blockchain world by providing a complete set of functions that the decentralized app dapp or blockchain app needs ethereum is a decentralized blockchain network where you can perform transactions using its native currency, ether, and token you can interact with the network through simple api calls provided by the sdk for detailed information, see samsung blockchain platform sdk set up your environment you will need the following java se development kit 8 or later android studio latest version recommended samsung galaxy device that supports samsung blockchain sample code here is a sample code for you to start coding in this code lab download it and start your learning experience! token transaction sample code 2 73 mb enable developer mode to activate developer mode on your mobile device, follow the steps below navigate through settings > biometrics and security > samsung blockchain keystore and click about blockchain keystore tap the samsung blockchain keystore app name quickly, ten times or more if succeeded, developer mode will show start your project after downloading the sample code containing the project files, in android studio, click open to open the existing project locate the downloaded android project codelab-send-token-transaction-blank-code from the directory and click ok noteuser interface ui resources are already included in the provided project simply apply the code in the next steps in this code lab moreover, going through the sdk document is recommended initialize the instance since sblockchain is the initial base class of the samsung blockchain platform sdk, the first thing you need to do is create an sblockchain instance along with that, create the following in sendtokenfragment java hardwarewalletmanager for wallet operations accountmanager for account operations ethereumservice for transactions msblockchain = new sblockchain ; try { msblockchain initialize mcontext ; } catch ssdkunsupportedexception e { e printstacktrace ; } maccountmanager = msblockchain getaccountmanager ; mhardwarewalletmanager = msblockchain gethardwarewalletmanager ; mcoinnetworkinfo = new coinnetworkinfo cointype eth, ethereumnetworktype goerli, rpcurl ; mcoinservice = coinservicefactory getcoinservice getcontext , mcoinnetworkinfo ; ethereumservice = ethereumservice mcoinservice; connecttohardwarewallet ; connect to samsung blockchain keystore connect the app to the hardware wallet, which, in this case, is the samsung blockchain keystore you can get a hardware wallet instance from hardwarewalletmanager if you want to reset the wallet, set the second parameter of connect api to true otherwise, set it to false mhardwarewalletmanager connect hardwarewallettype samsung, false setcallback new listenablefuturetask callback<hardwarewallet> { @override public void onsuccess hardwarewallet hardwarewallet { handler post new runnable { @override public void run { log i tag, "hardwarewallet is connected " ; mprogressbar setvisibility view invisible ; getaccount ; } } ; } @override public void onfailure @nonnull executionexception e { mprogressbar setvisibility view invisible ; log e tag, "hardwarewallet connection failed " + e ; } @override public void oncancelled @nonnull interruptedexception e { mprogressbar setvisibility view invisible ; log e tag, "hardwarewallet connection cancelled " + e ; } } ; generate new account samsung blockchain platform sdk manages the address on blockchain as an account it contains the information required for signing and the blockchain address accountmanager provides apis dedicated for fetching, creating, and restoring accounts use generatenewaccount api for the creation of a new ethereum account upon clicking the create account button in the app hardwarewallet connectedhardwarewallet = mhardwarewalletmanager getconnectedhardwarewallet ; maccountmanager generatenewaccount connectedhardwarewallet, mcoinnetworkinfo setcallback new listenablefuturetask callback<account> { @override public void onsuccess account account { mprogressbar setvisibility view invisible ; log i tag, "generate new account successful " + account ; handler post new runnable { @override public void run { getaccount ; } } ; } @override public void onfailure @nonnull executionexception e { mprogressbar setvisibility view invisible ; log e tag, "generate new account failed " + e ; } @override public void oncancelled @nonnull interruptedexception e { mprogressbar setvisibility view invisible ; log e tag, "generate new account cancelled " + e ; } } ; after creating a new account, call the getaccounts api to get the account list if you already have an account, the textview will show the account's address and the create account button will be disabled in the app accounts = maccountmanager getaccounts null, cointype eth, ethereumnetworktype goerli ; if !accounts isempty { methereumaccount = ethereumaccount accounts get accounts size - 1 ; showaccounttextview settext methereumaccount getaddress ; generateaccountbutton setenabled false ; } create a token account to perform a token transaction, add the token address with the corresponding ethereum account and create a token account by calling the addtokenaddress api use the generated token account to perform token-related actions an ethereum account can add one or more tokens ethereumservice addtokenaddress methereumaccount, tokenaddress setcallback new listenablefuturetask callback<ethereumaccount> { @override public void onsuccess ethereumaccount ethereumaccount { mprogressbar setvisibility view invisible ; log i tag, "add token successful " + ethereumaccount ; handler post new runnable { @override public void run { toast maketext getcontext , "add token successful", toast length_short show ; } } ; } @override public void onfailure @nonnull executionexception e { mprogressbar setvisibility view invisible ; log e tag, "add token failed " + e ; } @override public void oncancelled @nonnull interruptedexception e { mprogressbar setvisibility view invisible ; log e tag, "add token cancelled " + e ; } } ; get token balance fetch the balance of the added token using gettokenbalance api ethereumservice gettokenbalance mtokenaccount, ethereumblockparameter latest setcallback new listenablefuturetask callback<biginteger> { @override public void onsuccess biginteger biginteger { mprogressbar setvisibility view invisible ; bigdecimal tokendecimal = bigdecimal ten pow 18 ; bigdecimal balance = new bigdecimal biginteger divide tokendecimal ; log d tag, "gettokenbalance success " + balance ; handler post new runnable { @override public void run { tokenbalance settext balance tostring ; } } ; } @override public void onfailure @nonnull executionexception e { mprogressbar setvisibility view invisible ; log e tag, "gettokenbalance failed " + e ; } @override public void oncancelled @nonnull interruptedexception e { mprogressbar setvisibility view invisible ; log e tag, "gettokenbalance cancelled " + e ; } } ; transfer token to transfer tokens between accounts, set the receiver address and the amount of tokens to send the trusted ui of the samsung blockchain keystore hardware wallet appears upon pressing the send button in the app, showing all the information regarding the transaction for confirmation generate a transaction hash upon confirmation of the transaction ethereumservice sendtokentransaction mhardwarewalletmanager getconnectedhardwarewallet , mtokenaccount, mtoaddress, tokenaddress, maxpriorityfee, methereumfeeinfo getestimatedbasefee add maxpriorityfee , mgaslimit, msendtokenamount, null setcallback new listenablefuturetask callback<transactionresult> { @override public void onsuccess transactionresult transactionresult { mprogressbar setvisibility view invisible ; log i tag, "send token successful " + transactionresult gethash ; handler post new runnable { @override public void run { toast maketext getcontext , "transaction hash " + transactionresult gethash , toast length_short show ; } } ; } @override public void onfailure @nonnull executionexception e { mprogressbar setvisibility view invisible ; log e tag, "send token failed " + e ; } @override public void oncancelled @nonnull interruptedexception e { mprogressbar setvisibility view invisible ; log i tag, "send token cancelled " + e ; } } ; run the app after building the apk, follow the steps below to test the application on a samsung blockchain-compatible device in send token tab, click create account copy the generated account address go to eth faucet tab to open the free faucet site already added to the application paste the account address and press the send me eth button click the hash string under your transactions to open etherscan and wait until the transaction succeeded go to token faucet tab and press get token to add some tokens in the account confirm the transaction go back to send token tab, click add token and press token balance to see added tokens press gas limit and max priority fee lastly, press send to transfer tokens confirm the transaction check the transaction status and details by finding the account address or the generated transaction hash txn hash in goerli testnet explorer you're done! congratulations! you have successfully achieved the goal of this code lab now, you can develop a decentralized application that can transfer erc20 tokens using samsung blockchain platform sdk if you face any trouble, you may download this file token transaction complete code 2 73 mb to learn more about developing apps with samsung blockchain, visit developer samsung com/blockchain
Develop Samsung Blockchain
docresources sdk samsung blockchain platform sdk (sdk version : 1.2.03 | dec 29, 2023 | 2.49mb) api reference(javadoc) (doc version : 1.2.03 | dec 29, 2023 | 372kb) programming guide programming guide includes getting started, using the sblockchain class, explanation on how to implement features and glossary programming guide sample application sample application (aerowallet) includes most functions supported by samsung blockchain platform sdk. sample application - aero wallet (app version : 1.2.03 | dec 29, 2023 | 3.41mb) codelab contents create shopping application with samsung blockchain platform sdk and pay using ethereum network. project files and instruction guide is also supported. developing a simple blockchain payment application introduction to samsung blockchain platform sdk video
Develop Samsung Blockchain
docgetting started the following steps should be followed before integrating the samsung blockchain platform sdk: prepare samsung galaxy device to run your apk. check your development environment. android minimum api level for samsung blockchain platform sdk : 24 noteminimum build level for samsung blockchain platform sdk is 21, but will properly work from level 24. configure your ide to integrate samsung blockchain platform sdk with your android app. create an “aar” directory if you don’t have one, and add the blockchainplatformsdk_1.2.03.aar to ”aar” directory in your android project. go to gradle scripts > build.gradle and enter the following dependencies: dependencies { repositories { flatdir{ dirs 'aar' } } implementation name: 'blockchainplatformsdk_1.2.03', ext: 'aar' // network implementation 'com.squareup.retrofit2:retrofit:2.6.0' implementation 'com.squareup.retrofit2:converter-gson:2.6.0' implementation 'com.squareup.okhttp3:logging-interceptor:3.8.0' implementation 'com.google.code.gson:gson:2.8.5' // web3j implementation 'org.web3j:core:4.8.8-android' // for check developer mode implementation 'org.ini4j:ini4j:0.5.4' // dagger implementation 'com.google.dagger:dagger:2.21' annotationprocessor 'com.google.dagger:dagger-compiler:2.21' implementation "io.reactivex.rxjava2:rxjava:2.2.8" implementation "io.reactivex.rxjava2:rxandroid:2.1.1" // protobuf implementation 'com.google.protobuf:protobuf-java:3.9.1' implementation 'com.google.protobuf:protobuf-gradle-plugin:0.8.10' } import the package into your code. import com.samsung.android.sdk.blockchain.*; samsung blockchain platform sdk supports 2 kinds of hardware wallet: samsung blockchain keystore ledger's devices like nano x, nano s. notetransactions on evm-compatible networks binance smart chain, klaytn, polygon, avalanche (c-chain) and fantom are signed from the hardware wallets using the same pathway as that of ethereum. for these transactions, currency unit displayed on hardwarewallet, such as samsung keystore or ledger, will show eth as currency unit instead of bnb, klay, matic, avax and ftm. development setting guide for each environment is as follows: integration with samsung blockchain keystore samsung blockchain keystore is compatible with selected samsung devices only. you need to have one of selected samsung devices to run your app with samsung blockchain keystore. please refer to the restrictions. check your development environment. android minimum api level for samsung blockchain keystore : 28 notesamsung blockchain platform sdk requires samsung blockchain keystore that is higher than 1.5.1. download the samsung blockchain keystore sdk. set 'developer mode' to test your app without app id verification. you can find more information about app id (scw_app_id), here. add "blockchainkeystoresdk_v1.6.0.aar" to "aar" directory in your android project. go to gradle script > build.gradle and add below dependency: dependencies { ... // keystore sdk implementation name: 'blockchainkeystoresdk_v1.6.0', ext: 'aar' ... } integration with nano x or nano s by ledger there is no restrictions to link with ledger device. so any samsung galaxy mobile is ok to test your app which is integrated with samsung blockchain platform sdk when you sign with ledger device. check your development environment. ledger nano x : 1.2.4-1 or higher ledger nano s : 1.6 or higher ledger : ethereum app: 1.9.8 or higher you can refer ledger's guide page to get started. go to gradle > build.gradle and add below dependency: dependencies { ... // ledger implementation 'com.ledger.lib:ledger-android-library:1.2.2' }
Develop Samsung Blockchain
docapi implementation samsung blockchain keystore api level get instance get seedhash check for mandatory app update is root seed backed up get supported coins get hd path get a list of addresses get a list of extended public keys sign a transaction is reboot authentication required go to samsung blockchain keystore settings handle error codes deeplinks samsung blockchain keystore api level samsung blockchain keystore api level plays a key role to ensure that the required api level of samsung blockchain keystore on a user’s device is properly installed to support the api that your android app tries to call. for example, if your android app is trying to implement a new samsung blockchain keystore api that requires “api level 2”, your android app will need to check whether samsung blockchain keystore app installed on user’s device also supports api level 2. if a user’s app supports api level 1, then your app will need to guide users to update samsung blockchain keystore app to the latest version. users can be directed to the update page in galaxy store. otherwise, there will be a runtime exception due to api level exception when calling apis with level higher than the level supported by the user’s version. the api level for each api will be mentioned in the javadoc, under “since” title, and developers can call “getkeystoreapilevel api” to check the current api level on the user’s device. your android app will need to check the api level whenever needed – it may be at the beginning of running samsung blockchain keystore app or every time your app calls an api. public void getkeystoreapilevel() { int keystoreapilevel = scwservice.getinstance().getkeystoreapilevel(); boolean iskeystoreapisupported = keystoreapilevel > 0; } get instance scwservice.getinstance( ) will need to be used to call any of the apis provided by samsung blockchain keystore. if samsung blockchain keystore is supported on the device, an instance will be returned. if it is not available on the device, then null will be returned. if null is returned, it means samsung blockchain keystore is not supported on the user’s device. a different keystore or a wallet needs to be used. scwservice scwserviceinstance = scwservice.getinstance(); get seed hash getseedhash api aims to help developers distinguish two things: (1) check whether user has set up samsung blockchain keystore. (2) check whether root seed (recovery phrase) has been changed or not. every time a new root seed (or a wallet) is created or restored, the seed hash in a string value will be changed. actually, this is not the preimage of the real seed, but a pseudo hash value. so, it is not possible to calculate the real seed with the pseudo one. it is strongly recommended for the application to cache the returned hash value to reduce the number of times to check the derived address’s validity. if the returned value is same as cached, the derived addresses are still valid, so the application keeps using these addresses. otherwise, the application should refresh the addresses from new seed with getaddresslist() or getextendedpublickeylist() api. whenever the application starts, it needs to call getseedhash(). in case that the returned value is a zero-length string, it means that there is no wallet in the samsung blockchain keystore. so, the application ui needs to guide users to jump to samsung blockchain keystore to create a wallet with scwdeeplink.main deeplink. public void getseedhash() { string seedhash = scwservice.getinstance().getseedhash(); boolean initialized = (seedhash != null && seedhash.length() > 0); } check mandatory app update checkformandatoryappupdate api is to help developers check if a user must update samsung blockchain keystore. because samsung blockchain keystore handles only one task at a time, make sure to not call the checkformandatoryappupdate api in the background as it may cause other api calls or requests to be cancelled. if a mandatory app update is needed, users can be directed to the galaxy store using a deeplink, scwdeeplink.galaxy_store. otherwise, users will see the mandatory app update popups during an operation process, such as signing a transaction, and will need to update samsung blockchain keystore before proceeding. note: scwservice.scwcheckformandatoryappupdatecallback will need to be implemented correspondingly . scwservice.scwcheckformandatoryappupdatecallback callback = new scwservice.scwcheckformandatoryappupdatecallback() { @override public void onmandatoryappupdateneeded(boolean needed) { if(needed){ startdeeplink(scwdeeplink.galaxy_store); } } }; scwservice.getinstance().checkformandatoryappupdate(callback); how to handle the returned value a boolean needed value of whether a mandatory update is needed or not will be returned. if needed, developers will need to guide users to go to samsung blockchain keystore app page in galaxy store to update. is root seed backed up isrootseedbackedup api helps developers check if there is a backup of root seed. since a user can create a wallet without a backup of root seed, developers can advise the user to make root seed backup. if a backup of root seed is needed, the users will be directed to the page which backs up the mnemonic phrases in the samsung blockchain keystore using a deep link, scwdeeplink.backup_wallet. boolean isbackedup = scwservice.getinstance().isrootseedbackedup(); if (!isbackedup) { startdeeplink(scwdeeplink.backup_wallet); } how to handle the returned value the result of root seed backup will be returned in a boolean type. get supported coins getsupportedcoins api is used to find out which type of cryptocurrencies are supported, in case there is a different logic that developers must implement for different cryptocurrencies. it is returned in an int array of standard coin types according to bip standard – for example, 60 for ethereum. int[] supportedcoins = scwservice.getinstance().getsupportedcoins(); stringbuilder sb = new stringbuilder(); sb.append("supported coins").append('\n'); for (int i = 0; i < supportedcoins.length; i++ ) { sb.append('[').append(i).append("] ").append(supportedcoins[i]).append('\n'); } string s = sb.tostring(); get hd path gethdpath api helps developers derive hd path for a specified coin type. this api can be used as a parameter when deriving an address and requesting to sign a transaction. note that utxo-based cryptocurrency, such as bitcoin will not be supported for this api. no callback will be needed for this api as hd path in string type will be returned immediately. //derive hd path for the cryptocurrency that your app supports string ethereumhdpath = scwservice.gethdpath(scwcointype.eth, 0); string klaytnhdpath = scwservice.gethdpath(scwcointype.klay, 0); string tronhdpath = scwservice.gethdpath(scwcointype.tron, 0); string stellarhdpath = scwservice.gethdpath(scwcointype.xlm, 0); there are two parameters needed: coin type and address index. coin type use scwcointype class to specify the cryptocurrency that your app uses. address index address index is like an account number. it is recommended to use 0 as the default address index. increasing the address index will generate a different account. for example, if you need another ethereum account, then you can increase this address index to 1. if you need just one address for your service, then make sure to use the same coin type and same address index throughout your service so that user does not get confused with multiple addresses. examples the returned value will be hd path in a string format. this hd path will be needed for getaddresslist api and signing cryptocurrency apis. scwservice.gethdpath(scwcointype.eth, 0) will return “m/44’/60’/0’/0/0” scwservice.gethdpath(scwcointype.eth, 1) will return “m/44’/60’/0’/0/1” scwservice.gethdpath(scwcointype.klay, 0) will return “m/44’/8217’/0’/0/0” scwservice.gethdpath(scwcointype.tron, 0) will return “m/44’/195’/0’/0/0” scwservice.gethdpath(scwcointype.xlm, 0) will return “m/44’/148’/0’” for more details on hd path refer to key management section in understanding keystore. you can find how hd path is used in samsung blockchain keystore. get a list of addresses getaddresslist api allows developers to request to get a list of addresses that correspond to a list of hd paths. a list of the hd path, compatible with bip-44 needs to be passed on to bring the addresses. the depth of hd path should be between 3 and 6. also, scwservice.scwgetaddresslistcallback will need to be implemented correspondingly. scwservice.scwgetaddresslistcallback callback = new scwservice.scwgetaddresslistcallback() { @override public void onsuccess(list<string> addresslist) { } @override public void onfailure(int errorcode, string errormessage) { //handle errors } }; string hdpath = scwservice.gethdpath(scwcointype.eth, 0); arraylist<string> hdpathlist = new arraylist<>(); hdpathlist.add(hdpath); scwservice.getinstance().getaddresslist(callback, hdpathlist); hierarchical deterministic path (hd path) examples hdpath for ethereum: m/44'/60'/0'/0/0 hdpath for bitcoin: m/44'/0'/0'/0/0 if you are unsure about what hd path is, then you can generate hd path with gethdpath api. (except for bitcoin) how to handle the returned value the returned value will be a list of addresses in a list** format. each address will correspond to the hd path in the arraylist. minimize calling getaddresslist api by checking seed hash value to avoid calling getaddresslist api as much as possible, please utilize getseedhash api to check whether the root seed has been changed or not, since different seed hash value implies that the corresponding address has also been updated. get a list of extended public keys getextendedpublickeylist api allows developers to request to get a list of extended public keys that correspond to a list of hd paths. a list of the hd path, compatible with bip-44 needs to be passed on to bring the public key. the depth of path should be between 3 and 6. take note that the scwservice.scwgetextendedpublickeylistcallback will need to be implemented correspondingly. scwservice.scwgetextendedpublickeylistcallback callback = new scwservice.scwgetextendedpublickeylistcallback() { @override public void onsuccess(list<byte[]> extendedpublickeylist) { } @override public void onfailure(int errorcode, string errormessage) { //handle errors } }; string hdpath = scwservice.gethdpath(scwcointype.eth, 0); arraylist<string> hdpathlist = new arraylist<>(); hdpathlist.add(hdpath); scwservice.getinstance().getextendedpublickeylist(callback, hdpathlist); hierarchical deterministic path (hd path) examples hdpath for ethereum: m/44'/60'/0'/0/0 hdpath for bitcoin: m/44'/0'/0'/0/0 how to handle the returned value the returned value will be list <byte[]> that corresponds to each hd path requested in the arraylist. each byte array is composed of 33 bytes of compressed public key and 32 bytes of chain code. you can derive the child public key based on this data. note that you need to derive the address of the compressed public key or call getaddresslist api to get the address. minimize calling getextendedpublickeylist api by checking seed hash value use getseedhash api to check whether the root seed has been changed or not, since different seed hash value implies that corresponding public keys have also been updated. sign a transaction there are seven apis that support signing cryptocurrency transactions: ethereum, personal sign message in ethereum, bitcoin, klaytn, tron, personal sign message in tron, and stellar. note: only signing a transaction is included in the samsung blockchain keystore scope. 1. signethtransaction api signethtransaction api as the name implies, sends a request to samsung blockchain keystore to sign an ethereum transaction. likewise, scwservice.scwsignethtransactioncallback will need to be implemented. scwservice.scwsignethtransactioncallback callback = new scwservice.scwsignethtransactioncallback() { @override public void onsuccess(byte[] signedethtransaction) { } @override public void onfailure(int errorcode, string errormessage) { //handle error } }; string toaddress = "0xe7425ee1bc64ab7c51ce3617cb83e76fd545f1a9"; string ethamount = "123.456789"; string ethgasprice = "12000000000"; string ethgaslimit = "21000"; string data = ""; long chainid = 1; string hdpath = scwservice.gethdpath(scwcointype.eth, 0); byte[] encodedunsignedethtx = createrawtransaction(toaddress, ethamount, ethgasprice, ethgaslimit, data); private byte[] createrawtransaction(param1, param2, …){ //implement your code here } scwservice.getinstance().signethtransaction(callback, encodedunsignedethtx, hdpath, chainid); the parameters to take note are as follows: encodedunsignedethtx : a byte array of an rlp-encoded unsigned ethereum raw transaction. hdpath : hd path that corresponds to the address linked to your android app that also corresponds to the private key which is used for signing chainid : chain id to prevent replay attacks between different chain. for eip1559 transaction, chainid should be null. how to handle the returned value the signed transaction will be returned in a byte array type in a rlp-encoded format. 2. signethpersonalmessage api signethpersonalmessage api can be used to request to samsung blockchain keystore to sign a message in ethereum. scwservice.scwsignethpersonalmessagecallback will need to be implemented. scwservice.scwsignethpersonalmessagecallback callback = new scwservice.scwsignethpersonalmessagecallback() { @override public void onsuccess(byte[] signedpersonalmessage) { } @override public void onfailure(int errorcode, string errormessage) { //handle error } }; string hdpath = scwservice.gethdpath(scwcointype.eth, 0); byte[] unsignedmsg = "to sign up, please sign this message.".getbytes(); scwservice.getinstance().signethpersonalmessage(callback, unsignedmsg, hdpath); the parameters to take note are as follows: unsignedmsg – a byte array of raw message to be signed by samsung blockchain keystore. the "\u0019ethereum signed message:\n" prefix will be added by samsung blockchain keystore, so your android app should not include the prefix in the message. hdpath : hd path that corresponds to the address linked to your android app that also corresponds to the private key which is used for signing how to handle the returned value: the type of return is a byte array of signed message based on r, s, v (values for a transaction’s signature) respectively. 3. signbtctransaction api signbtctransaction api can be used to create a request to samsung blockchain keystore to sign a bitcoin transaction. the scwservice.scwsignbtctransactioncallback will need to be implemented. scwservice.scwsignbtctransactioncallback callback = new scwservice.scwsignbtctransactioncallback() { @override public void onsuccess(byte[] signedbtctransaction) { } @override public void onfailure(int errorcode, string errormessage) { //handle error } }; list<utxo> utxos = new arraylist<>(); arraylist<string> inputhdpathlist = new arraylist<>(); string changehdpath = "m/44'/0'/0'/0/0"; string inputhdpath1 = "m/44'/0'/0'/0/0"; string inputhdpath2 = "m/44'/0'/0'/0/1"; utxos.add(getunspentoutputs(inputhdpath1)); utxos.add(getunspentoutputs(inputhdpath2)); transactionextended unsignedtx = makeunsignedtransaction(networkparams, utxos, to, value, fee); for (int i = 0; i < unsignedtx.getinputs().size(); i++) { string inputhdpath = unsignedtx.getinputs().gethdpath(i); inputhdpathlist.add(inputhdpath); } private transaction makeunsignedtransaction ( networkparameters networkparams, list<utxo> utxos, string to, long value, long fee){ //make unsigned transaction among unspent outputs to spend value with fee //implement your code here } scwservice.getinstance().signbtctransaction(callback, transaction, inputhdpathlist, changehdpath); the parameters to take note are as follows: transaction a byte array of a serialized unsigned bitcoin transaction to be signed by samsung blockchain keystore. inputhdpathlist : a list of hd path that corresponds to the addresses linked to the transaction inputs in transaction. this list also corresponds to the private key which is used for signing. bip-44, 49, 84 are supported and coin type “1” in hd path can be used for bitcoin test network. parameter check: samsung blockchain keystore will verify the requested transaction using transactioninput in transaction and inputhdpathlist. each transactioninput should correspond to an hd path in inputhdpathlist. if there are multiple transactioninput, then corresponding inputhdpathlist and transactioninputs should be listed in the same order. changehdpath : if there is a return change, then include the hd path that corresponds to the change address. if the change address is not needed, then this value should be null. how to handle the returned value: the signed transaction will be returned in a byte array type. 4. signklaytransaction api signklaytransaction api can be used to request to samsung blockchain keystore to sign a klaytn transaction. scwservice.scwsignklaytransactioncallback will need to be implemented. scwservice.scwsignklaytransactioncallback callback = new scwservice.scwsignklaytransactioncallback() { @override public void onsuccess(byte[] signedklaytransaction) { } @override public void onfailure(int errorcode, string errormessage) { //handle error } }; string hdpath = scwservice.gethdpath(scwcointype.klay, 0); byte[] unsignedtransaction = getunsignedtx(); int klaytnchainid = 1001; scwservice.getinstance().signklaytransaction(callback, unsignedtransaction, hdpath, klaytnchainid); the parameters to take note are as follows: unsignedtransaction a byte array of raw transaction to be signed by samsung blockchain keystore. it is same as the sigrlp value mentioned in klaytn official document. hdpath - hd path that corresponds to the public key linked to your android app that also corresponds to the private key which is used for signing. klaytnchainid – the klaytn network id or the integer to identify the network. "8217" is klaytn cypress mainnet and "1001" is klaytn baobab testnet how to handle the returned value: the signed transaction will be returned in a byte array type in a rlp-encoded format. 5. signtrxtransaction api signtrxtransaction api can be used to request to samsung blockchain keystore to sign a tron transaction. scwservice.scwsigntrxtransactioncallback will need to be implemented. scwservice.scwsigntrxtransactioncallback callback = new scwservice.scwsigntrxtransactioncallback() { @override public void onsuccess(byte[] signedtrxtransaction) { //handle signed tron transaction } @override public void onfailure(int errorcode, string errormessage) { //handle error } }; string hdpath = scwservice.gethdpath(scwcointype.tron, 0); string from = “tdcmwosbafcegqqnuarnjghy4tabdcmdwi” string to = “tq6pm81jdc2ghruonytzgvpc7svyqcemeu”; int amount = 2; byte[] unsignedtransaction = createunsignedtransaction(hdpath from, to, amount); private byte[] createunsignedtransaction (param1, param2, …){ //implement your code here } scwservice.getinstance().signtrxtransaction(callback, unsignedtransaction, hdpath); the parameters to take note are as follows: unsignedtransaction a byte array of raw tron transaction to be signed by samsung blockchain keystore. hdpath - hd path that corresponds to the public key linked to your android app that also corresponds to the private key which is used for signing. how to handle the returned value: signed transaction will be returned in a byte array. 6. signtrxpersonalmessage api signtrxpersonalmessage api can be used to request to the samsung blockchain keystore to sign a message in tron. the scwservice.scwsigntrxpersonalmessagecallback will need to be implemented. scwservice.scwsigntrxpersonalmessagecallback callback = new scwservice.scwsigntrxpersonalmessagecallback() { @override public void onsuccess(byte[] signedpersonalmessage) { } @override public void onfailure(int errorcode, string errormessage) { //handle error } }; string hdpath = scwservice.gethdpath(scwcointype.tron, 0); byte[] unsignedmsg = "to sign up, please sign this message.".getbytes(); scwservice.getinstance().signtrxpersonalmessage(callback, unsignedmsg, hdpath); the parameters to take note are as follows: unsignedmsg: a byte array of raw message to be signed by samsung blockchain keystore. a "\u0019tron signed message:\n32" prefix will be added by samsung blockchain keystore, so your android app should not include the prefix in the message. hdpath: hd path that corresponds to the address linked to your android app that also corresponds to the private key which is used for signing how to handle the returned value: the type of return is a byte array of signed message based on values for a transaction’s signature - r, s, v respectively. 7. signxlmtransaction api signxlmtransaction api can be used to request to the samsung blockchain keystore to sign a stellar transaction. the scwservice.scwsignxlmtransactioncallback will be needed to be implemented. scwservice.scwsignxlmtransactioncallback callback = new scwservice.scwsignxlmtransactioncallback() { @override public void onsuccess(byte[] signedxlmtransaction) { //handle signed stellar transaction } @override public void onfailure(int errorcode, string errormessage) { //handle error } }; string recipientaccount = “gay5dorarbd5l3fbbwuhxkciv7vcmqicsllj7gyr4664av4mxtx2fh4o”; string amount = “100”; paymentoperation operation = new paymentoperation.builder(recipientaccount, asset, amount).build(); string hdpath = scwservice.gethdpath(scwcointype.xlm, 0); arraylist<string> hdpathlist = new arraylist<>(); hdpathlist.add(hdpath); string sourceaccount = “gb7zviydvsww3ctfj2v3oproahgbuomebwib55xieii3aq6523pg4lm5”; string memo = "hello12347"; byte[] unsignedtransaction = createunsignedtransaction(sourceaccount, operation, memo, networkid); private byte[] createunsignedtransaction (param1, param2, …){ //implement your code here // include networkid, envelopetype (envelopte_type_tx), and xdr-encoded transaction } scwservice.getinstance().signxlmtransaction(callback, unsignedtransaction, hdpathlist); the parameters to take note are as follows: unsignedtransaction – a byte array of raw transaction to be signed by samsung blockchain keystore. it is the same as the signature base, which includes networkid, envelopetype, and xdr-encoded transaction. hdpathlist : a list of hd path that corresponds to the addresses linked to your android app that also corresponds to the private key which is used for signing. how to handle the returned value: the signed transaction will be returned in a byte array. developers can use base64 encoding to implement this result into envelopexdr, which can derive the transaction that can be submitted to the network. is reboot authentication required the isrebootauthenticationrequired api allows you to check whether pin authentication is required after reboot. some keystore api calls can require pin authentication after device reboot. these calls are successful only after the user enters their blockchain keystore pin at the prompt. the isrebootauthenticationrequired() method allows you to determine whether accessing the keystore api requires pin authentication. boolean isrebootauthenticationrequired = scwservice.getinstance().isrebootauthenticationrequired(); if(isrebootauthenticationrequired) { // user prompted for pin authentication } else { // user not prompted for pin authentication } • handling the returned value: the isrebootauthenticationrequired() method returns a boolean value. go to samsung blockchain keystore settings samsung blockchain keystore provides a user-friendly setup page for the first time users and a settings page for existing users. developers can easily jump to samsung blockchain keystore settings by using a deeplink, scwdeeplink.main.. there are two purposes of calling the samsung blockchain keystore main activity. setup samsung blockchain keystore for first time users after calling getseedhash api, if the wallet is not created, a zero length value will be returned. this is when your android app should call samsung blockchain keystore settings via a deep link as shown below. samsung blockchain keystore will check if a user needs to set up a new wallet and if needed, will lead to a setup page. after the activity is finished, your android app should call the getseedhash api, once more, to make sure that the wallet has been created and the corresponding seed hash value is returned. samsung blockchain keystore settings for existing users for existing users, when samsung blockchain keystore settings is called, a user will see a list of menu related to samsung blockchain keystore management. features include changing the pin, removing the wallet, checking a recovery phrase to back up the wallet, enabling/disabling fingerprint as an authentication method, or changing alarm notifications settings. more information about the samsung blockchain keystore, such as notices, terms and conditions, and app information can be also found here. a sample code for calling samsung blockchain keystore via a deeplink is as follows. uri uri = uri.parse(scwdeeplink.main); intent intent = new intent(intent.action_view); intent.setdata(uri); intent.setflags(intent.flag_activity_new_task); mcontext.startactivity(intent); *do not call startactivityforresult(intent) as no results will be returned. make sure to use startactivity(intent) instead. handling error codes in addition to general error codes, the following are some special cases that developers may want to look out for. mandatory update is needed samsung blockchain keystore was removed due to user entering wrong pin more than n times api key is invalid the popups above will be shown from samsung blockchain keystore app, though the samsung blockchain keystore will still return corresponding error codes. in the mandatory update error case, the user will see a popup with a link to galaxy apps store page to update samsung blockchain keystore. if it was reset, due to entering a wrong pin more than n times, then the user will need to create or import the wallet via samsung blockchain keystore service again. it is recommended that developers call checkformandatoryappupdate api before calling other apis, to check whether a mandatory app update is needed. for this api, no ui or popup will be shown from samsung blockchain keystore. upon integration, developers may receive an “error_package_signature_verification_failed” error. in this case, developers can turn on developer mode to skip the app verification stage. yet, developers will need to implement proper app id, officially issued by the samsung blockchain keystore team before launching your android app in the market. public interface scwerrorcode { int error_mandatory_app_update_needed = -8; int error_package_signature_verification_failed = -11; int error_wallet_reset = -12; int error_check_app_version_failed = -15; int error_tnc_not_agreed = -6; } please refer to the scwerrorcode class in javadoc for more details on error codes. samsung blockchain keystore deeplinks deep links to samsung blockchain keystore and deep link to update samsung blockchain keystore app in galaxy store are provided. developers can implement the links below to direct users to go to the main page and back up root seed page in samsung blockchain keystore settings directly. deep link to galaxy store can be used when user needs to update samsung blockchain keystore app. features deeplink main page scwdeeplink.main galaxy apps store scwdeeplink.galaxy_store backup wallet scwdeeplink.backup_wallet
Learn Code Lab
codelabdevelop a secure blockchain app objective learn how to create your own decentralized applications dapp using samsung blockchain keystore sdk overview integrating with new technology like blockchain is a burden to most developers for this reason, we offer a way to interwork with samsung blockchain keystore sdk with less effort developers can easily become a dapp developer with our samsung blockchain keystore sdk decentralized applications dapps run and store data on the blockchain network instead of a central server dapps offer increased security and reliability compared to centralized applications moreover, it provides a simple method for in-app payments using cryptocurrency samsung blockchain keystore sdk is used to obtain account information and sign a transaction to transfer cryptocurrency or execute smart contract execution in this code lab, you can learn how to integrate samsung blockchain keystore sdk into your app and how to implement blockchain basic concepts such as account information and signing transactions set up your environment you will need the following java se development kit 8 or later android studio latest version recommended mobile phone which supports samsung blockchain sample code here is a sample code for you to start coding in this code lab download it and start your learning experience! keystore sdk sample code 897 12 kb enable developer mode the developer mode helps developers test the samsung blockchain keystore in developer mode, app id verification is bypassed, so samsung blockchain keystore apis will be enabled to activate developer mode on your mobile device, follow the steps below navigate through settings > biometrics and security > samsung blockchain keystore and click about blockchain keystore tap the samsung blockchain keystore app name quickly, ten times or more if succeeded, developer mode will show noteonly a limited number of devices can be activated for one test app open project file after downloading the sample code, open the given android application project this project is a simple comments dapp based on ethereum ropsten test network it retrieves comments data from smart contract, displays them on the screen, and makes a transaction to execute smart contract function to post user’s comment in the next steps, you can get an account address and execute dapp service with blockchain keystore and you can see the result of successful dapp execution set the app id here, you don’t need to set the application id to use samsung blockchain keystore sdk instead, you must enable developer mode as described previously for the release version of your android app, in your android manifest file, add a metadata with a name as scw_app_id and a value as the app id issued by samsung blockchain keystore team samsung blockchain keystore aar file will read this value when your android app is initialized and help your android app connect to samsung blockchain keystore <manifest xmlns android="http //schemas android com/apk/res/android" package="com samsung android sdk coldwallet test" android versioncode="1" android versionname="1 0"> <application> <meta-data android name="scw_app_id" android value= <!-- put your app id here --> /> </application> </manifest> import samsung blockchain keystore sdk library into the project the sdk library is located at aar/keystoresdk_v1 5 1 aar of the project file to import the library go to gradle scripts > build gradle and enter the following dependencies dependencies { repositories { flatdir{ dirs 'aar' } } implementation 'com samsung android sdk coldwallet keystoresdk_v1 5 1@aar' } check the status of samsung blockchain keystore the first thing to do is to check the status of samsung blockchain keystore in the sample application, it is implemented at initializekeystore in presenter intropresenter java you can find the following steps to check the status of keystore in your android app, call scwservice getinstance if the returned value is an instance and not null, then it means samsung blockchain keystore is supported on the device however, if null is returned, the user must use a different keystore in the sample code, toast a message to notify that the device doesn’t support the keystore // check samsung blockchain keystore is supported or not if scwservice getinstance == null { mcontract toastmessage "samsung blockchain keystore is not supported on your device " ; } call getkeystoreapilevel api to see if the current samsung blockchain keystore being used, properly supports the features that your android app is currently aiming for if the required api level is higher than the current samsung blockchain keystore level, users are directed to samsung blockchain keystore app page in galaxy store through the provided deeplink to update // check installed api level else if scwservice getinstance getkeystoreapilevel < 1 { // if api level is lower, jump to galaxy apps to update keystore app mcontract showdialog "" , "ok" , "the api level is too low jump to galaxy store" , -> mcontract launchdeeplink scwdeeplink galaxy_store ; } check if a user has set up the samsung blockchain keystore and is ready to use it by calling getseedhash api if the seed hash value in string is zero-length, this means the user has not set up samsung blockchain keystore yet hence, your app will need to guide the user to jump to samsung blockchain keystore via deeplink to either create or import a wallet // check seed hash exist else if scwservice getinstance getseedhash length == 0 { // if seed hash is empty, // jump to blockchain keystore to create or import wallet mcontract showdialog "" , "ok" , "the seed hash is empty " + "jump to blockchain keystore to create/import wallet " , -> mcontract launchdeeplink scwdeeplink main ; } if the getseedhash api returned value is not zero-length, it means that the user has successfully set up samsung blockchain keystore if there is a previously saved or cached seed hash value, compare the two seed hash values if those two values are not equal, nor if there is no such saved cached seed hash value, then the address has to be checked again if the seed hash value has been changed, it means the master seed has been changed as well, meaning the address that your android app was linked to may no longer be the same address // check seed hash cached else if !textutils equals cachedseedhash, scwservice getinstance getseedhash { // if the seed hash is different from cached, update seed hash and address // go to next activity final string ethereumhdpath = "m/44'/60'/0'/0/0"; getethereumaddress ethereumhdpath , success, errorcode, address, seedhash -> { if success { updateaddress address ; updateseedhash seedhash ; mcontract showtimelineactivity true ; } else { mcontract toastmessage "cannot get address error code " + errorcode ; } mcontract setloading false ; } ; return false; } if those two values are equal, it means checking the keystore status was successful, and you can move on to the next step // success else { // set address from cached value // go to next activity string address = prefshelper getinstance getcachedaddress ; updateseedhash cachedseedhash ; updateaddress address ; mcontract showtimelineactivity false ; } get the ethereum address in the blockchain network, the address can be used like a user’s account as the balance and the transaction history can be checked using the address in this sample project, get the address from keystore and display the address and account balance in the bottom sheet of the screen keystore is a hierarchical deterministic hd wallet, a standard tree structure represented by derivation paths for the ethereum address, use “m/44'/60'/0'/0/0” follow bip44 it is implemented at getethereumaddress string hdpath, getethereumaddresscallback callback in presenter/intropresenter java arraylist<string> path = new arraylist<> ; path add hdpath ; scwservice getinstance getaddresslist new scwservice scwgetaddresslistcallback { @override public void onsuccess list<string> list { string seedhash = scwservice getinstance getseedhash ; string address = list get 0 ; callback onaddressreceived true, 0, address, seedhash ; } @override public void onfailure int errorcode, string errormessage { callback onaddressreceived false, errorcode, "", "" ; } }, path ; sign a transaction ether value transfer or smart contract execution is executed by transactions that users create and sign signing a transaction is the process of generating a signature on it using the private key of the transaction sender samsung blockchain keystore can be utilized to sign a cryptocurrency transaction, such as ethereum by implementing the following steps creates an unsigned transaction, and requests samsung blockchain keystore to sign the transaction via apis like signethtransaction then the user will see a transaction confirmation page on a secure screen called, trusted user interface tui executed in trusted execution environment tee by samsung blockchain keystore once the user confirms the transaction with pin or biometrics authentication, like fingerprint, samsung blockchain keystore will sign a transaction with the private key derived from the given hd path when samsung blockchain keystore returns the signed transaction, your app can submit or send the signed transaction to the blockchain network in this sample project, create an unsigned transaction to execute posting a comment smart contract in addition, sign the transaction with keystore and send the transaction it is implemented at signtransaction in presenter/writefeedpresenter java // sign the transaction with samsung blockchain keystore // use hdpath m/44'/60'/0'/0/0 final string hdpath = "m/44'/60'/0'/0/0"; scwservice getinstance signethtransaction new scwservice scwsignethtransactioncallback { @override public void onsuccess byte[] signedtransaction { boolean result = sendsignedtransaction signedtransaction ; listener transactiondidfinish result, "" ; } @override public void onfailure int errorcode, string errormessage { listener transactiondidfinish false, "error code " + errorcode ; } }, unsignedtx, hdpath, null ; run the app and try it out the app screen should look like below you're done! congratulations! you have successfully achieved the goal of this code lab now, you can create a decentralized app by yourself! if you're having trouble, you may download this file keystore sdk complete code 897 07 kb
Develop Samsung Pay
apioverview package class tree index help package com samsung android sdk samsungpay v2 interface apptoappconstants all known implementing classes cardmanager, watchmanager public interface apptoappconstants this interface provides the common values of watchmanager and cardmanager since api level 2 5 field summary fields modifier and type field description static final int error_auth_code_expired this error indicates that auth code is expired this is returned as spaysdk extra_error_reason for error_verify_card error static final int error_auth_code_invalid this error indicates that auth code is invalid this is returned as spaysdk extra_error_reason for error_verify_card error static final int error_auth_code_max_try_reached this error indicates that maximum idnv try reached this is returned as spaysdk extra_error_reason for error_verify_card error static final int error_auth_code_type_invalid this error indicates that auth code type is invalid this is returned as spaysdk extra_error_reason for error_verify_card error static final int error_authentication_closed this error indicates that authentication is force closed during update card service static final int error_authentication_failed this error indicates that authentication is failed during update card service static final int error_authentication_not_ready this error indicates that authentication is not ready state during update card service static final int error_authentication_timed_out this error indicates that authentication is closed due to timeout during update card service static final int error_card_already_registered this error indicates that the requested operation is already done and this operation cannot be performed again this is returned as spaysdk extra_error_reason for spaysdk error_registration_fail error static final int error_card_idv_not_supported this error indicates that the card does not support any idnv this is returned as spaysdk extra_error_reason for error_verify_card error static final int error_card_not_supported this error indicates that card is not supported this is returned as spaysdk extra_error_reason for spaysdk error_registration_fail error static final int error_framework_internal this error indicates that an error occurred in payment framework while processing the request this is returned as spaysdk extra_error_reason for spaysdk error_registration_fail error for example, unable to load certificate from ta, unable to access payment framework db, and so on static final int error_invalid_card this error indicates that the card is invalid this is returned as spaysdk extra_error_reason for spaysdk error_registration_fail error static final int error_invalid_cardinput this error indicates that the user entered invalid card information this is returned as spaysdk extra_error_reason for spaysdk error_registration_fail error static final int error_max_card_num_reached this error indicates that the maximum number of card limit has reached and user cannot add more card to samsung pay this is returned as spaysdk extra_error_reason for spaysdk error_registration_fail error static final int error_max_pan_provision_num_reached this error indicates that the limit number of enrollments of this pan has reached and user cannot add this pan this time static final int error_server_reject this error indicates that the server declined the request this is returned as spaysdk extra_error_reason for spaysdk error_registration_fail error static final int error_tsm_fail this error indicates that tsm error is reported during card downloading static final int error_verify_card this error indicates that server was unable to verify the card operation this may be due to invalid verification code static final int error_wallet_id_mismatch this error indicates that wallet id is mismatch this is returned as spaysdk extra_error_reason for spaysdk error_registration_fail error static final string extra_app2app_intent key to represent app2app intent name defined by issuer server static final string extra_app2app_payload key to represent app2app payload sent by issuer server static final string extra_card_balance key to represent card balance static final string extra_card_status_reason key to represent extra card status for issuer app static final string extra_issuer_app_card_linked key to represent extra card information for card link field details error_verify_card static final int error_verify_card this error indicates that server was unable to verify the card operation this may be due to invalid verification code since api level 1 2 see also constant field values error_card_already_registered static final int error_card_already_registered this error indicates that the requested operation is already done and this operation cannot be performed again this is returned as spaysdk extra_error_reason for spaysdk error_registration_fail error since api level 1 2 see also constant field values error_framework_internal static final int error_framework_internal this error indicates that an error occurred in payment framework while processing the request this is returned as spaysdk extra_error_reason for spaysdk error_registration_fail error for example, unable to load certificate from ta, unable to access payment framework db, and so on since api level 1 2 see also constant field values error_invalid_card static final int error_invalid_card this error indicates that the card is invalid this is returned as spaysdk extra_error_reason for spaysdk error_registration_fail error since api level 1 2 see also constant field values error_invalid_cardinput static final int error_invalid_cardinput this error indicates that the user entered invalid card information this is returned as spaysdk extra_error_reason for spaysdk error_registration_fail error since api level 1 2 see also constant field values error_server_reject static final int error_server_reject this error indicates that the server declined the request this is returned as spaysdk extra_error_reason for spaysdk error_registration_fail error since api level 1 2 see also constant field values error_max_card_num_reached static final int error_max_card_num_reached this error indicates that the maximum number of card limit has reached and user cannot add more card to samsung pay this is returned as spaysdk extra_error_reason for spaysdk error_registration_fail error since api level 1 2 see also constant field values error_tsm_fail static final int error_tsm_fail this error indicates that tsm error is reported during card downloading this is for tsm solution only since api level 1 4 see also constant field values error_authentication_not_ready static final int error_authentication_not_ready this error indicates that authentication is not ready state during update card service since api level 1 8 see also constant field values error_authentication_failed static final int error_authentication_failed this error indicates that authentication is failed during update card service since api level 1 8 see also constant field values error_authentication_closed static final int error_authentication_closed this error indicates that authentication is force closed during update card service since api level 1 8 see also constant field values error_authentication_timed_out static final int error_authentication_timed_out this error indicates that authentication is closed due to timeout during update card service since api level 1 8 see also constant field values error_card_not_supported static final int error_card_not_supported this error indicates that card is not supported this is returned as spaysdk extra_error_reason for spaysdk error_registration_fail error since api level 2 5 see also constant field values error_max_pan_provision_num_reached static final int error_max_pan_provision_num_reached this error indicates that the limit number of enrollments of this pan has reached and user cannot add this pan this time user needs to contact issuer to resolve this issue this is returned as spaysdk extra_error_reason for spaysdk error_registration_fail error since api level 2 5 see also constant field values error_wallet_id_mismatch static final int error_wallet_id_mismatch this error indicates that wallet id is mismatch this is returned as spaysdk extra_error_reason for spaysdk error_registration_fail error since api level 2 5 see also constant field values error_auth_code_invalid static final int error_auth_code_invalid this error indicates that auth code is invalid this is returned as spaysdk extra_error_reason for error_verify_card error since api level 2 7 see also constant field values error_auth_code_expired static final int error_auth_code_expired this error indicates that auth code is expired this is returned as spaysdk extra_error_reason for error_verify_card error since api level 2 7 see also constant field values error_auth_code_max_try_reached static final int error_auth_code_max_try_reached this error indicates that maximum idnv try reached this is returned as spaysdk extra_error_reason for error_verify_card error since api level 2 7 see also constant field values error_auth_code_type_invalid static final int error_auth_code_type_invalid this error indicates that auth code type is invalid this is returned as spaysdk extra_error_reason for error_verify_card error since api level 2 7 see also constant field values error_card_idv_not_supported static final int error_card_idv_not_supported this error indicates that the card does not support any idnv this is returned as spaysdk extra_error_reason for error_verify_card error since api level 2 7 see also constant field values extra_app2app_intent static final string extra_app2app_intent key to represent app2app intent name defined by issuer server since api level 1 1 see also constant field values extra_app2app_payload static final string extra_app2app_payload key to represent app2app payload sent by issuer server since api level 1 1 see also constant field values extra_card_balance static final string extra_card_balance key to represent card balance since api level 1 8 see also constant field values extra_card_status_reason static final string extra_card_status_reason key to represent extra card status for issuer app since api level 1 4 see also constant field values extra_issuer_app_card_linked static final string extra_issuer_app_card_linked key to represent extra card information for card link since api level 2 2 see also constant field values samsung electronics samsung pay sdk 2 19 00 - jun 12 2024
We use cookies to improve your experience on our website and to show you relevant advertising. Manage you settings for our cookies below.
These cookies are essential as they enable you to move around the website. This category cannot be disabled.
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.
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.
These cookies gather information about your browser habits. They remember that you've visited our website and share this information with other organizations such as advertisers.
You have successfully updated your cookie preferences.