Filter
-
Content Type
-
Category
Mobile/Wearable
Visual Display
Digital Appliance
Platform
Recommendations
Filter
Develop Samsung Pay
docinitiate in-app payment merchant applications can use apis to fetch payment information details with custom payment sheet the following functionalities are ready to perform a variety of payment operations checking registered/enrolled card information creating a transaction request requesting payment with a custom payment sheet checking registered/enrolled card information before displaying the samsung pay button, a partner app can query card brand information for the user’s currently enrolled payment cards in samsung wallet to determine if payment is supported with the enrolled card to query the card brand, use the requestcardinfo api method of the samsungpaysdkflutter class the merchant app does not need to set a value for it now however, before calling this method, cardinfolistener must be registered so its listener can provide onresult and onfailure events the following snippet shows how to retrieve the list of supported card brands from samsung wallet samsungpaysdkflutterplugin requestcardinfo cardinfolistener {onresult paymentcardinfo showcardlist paymentcardinfo ; }, onfailure errorcode, bundle { showerror errorcode, bundle ; } ; creating a transaction request upon successful initialization of the samsungpaysdkflutter class, the merchant app needs to create a transaction request with payment information using the custom payment sheet to initiate a payment transaction with samsung wallet’s custom payment sheet, your merchant app must populate the following mandatory fields in customsheetpaymentinfo merchant name - as it will appear in samsung wallet’s payment sheet, as well as the user's card account statement customsheet - is called when the user changes card on the custom payment sheet in samsung wallet optionally, the following fields can be added to the payment information merchant id - can be used for the merchant’s own designated purpose at its discretion unless the merchant uses an indirect pg like stripe or braintree if an indirect pg is used, this field must be set to the merchant’s payment gateway id fetched from the samsung pay developers portal order number - usually created by the merchant app via interaction with a pg this number is required for refunds and chargebacks in the case of visa cards, the value is mandatory the allowed characters are [a-z][a-z][0-9,-] and the length of the value can be up to 36 characters address - the user’s billing and/or shipping address allowed card brands - specifies card brands accepted by the merchant if no brand is specified, all brands are accepted by default if at least one brand is specified, all other card brands not specified are set to "card not supported’ on the payment sheet here’s the 'customsheetpaymentinfo' structure string? merchantid; string merchantname; string? ordernumber; addressinpaymentsheet? addressinpaymentsheet; list<brand>? allowedcardbrand; paymentcardinfo? cardinfo; bool? iscardholdernamerequired; bool? isrecurring; string? merchantcountrycode; customsheet customsheet; map<string,dynamic>? extrapaymentinfo; your merchant app sends this customsheetpaymentinfo to samsung wallet via the applicable samsung pay sdk flutter plugin api methods upon successful user authentication in direct mode, samsung wallet returns the above "payment info" structure and a result string the result string is forwarded to the pg by your merchant app to complete the transaction it will vary based on the pg you’re using the following example demonstrates how to populate customsheet in the customsheetpaymentinfo class list<brand> brandlist = []; brandlist add brand visa ; brandlist add brand mastercard ; brandlist add brand americanexpress ; customsheetpaymentinfo customsheetpaymentinfo= customsheetpaymentinfo merchantname "merchantname", customsheet customsheet ; customsheetpaymentinfo setmerchantid "123456" ; customsheetpaymentinfo setmerchantname "sample merchant" ; customsheetpaymentinfo setaddressinpaymentsheet addressinpaymentsheet need_billing_send_shipping ; customsheetpaymentinfo setcardholdernameenabled true ; customsheetpaymentinfo setrecrringenabled false ; customsheetpaymentinfo setcustomsheet customsheet ; customsheetpaymentinfo allowedcardbrand = brandlist; return customsheetpaymentinfo; requesting payment with a custom payment sheet the startinapppaywithcustomsheet method of the samsungpaysdkflutter class is applied to request payment using a custom payment sheet in samsung wallet the two methods are defined as follows startinapppaywithcustomsheet - initiates the payment request with a custom payment sheet the payment sheet persist for 5 minutes after the api is called if the time limit expires, the transaction fails updatesheet - updates the custom payment sheet if any values on the sheet are changed as of api level 1 5, a merchant app can update the custom sheet with a custom error message refer to updating sheet with custom error message when you call the startinapppaywithcustomsheet method, a custom payment sheet is displayed on the merchant app screen from it, the user can select a registered card for payment and change the billing and shipping addresses, as necessary the result is delivered to customsheettransactioninfolistener, which provides the following events onsuccess - called when samsung wallet confirms payment it provides the customsheetpaymentinfo object and the paymentcredential json string customsheetpaymentinfo is used for the current transaction it contains amount, shippingaddress, merchantid, merchantname, ordernumber api methods exclusively available in the onsuccess callback comprise getpaymentcardlast4dpan – returns the last 4 digits of the user's digitized personal/primary identification number dpan getpaymentcardlast4fpan – returns the last 4 digits of the user's funding personal/primary identification number fpan getpaymentcardbrand – returns the brand of the card used for the transaction getpaymentcurrencycode – returns the iso currency code in which the transaction is valued getpaymentshippingaddress – returns the shipping/delivery address for the transaction getpaymentshippingmethod – returns the shipping method for the transaction for pgs using the direct model network tokens , the paymentcredential is a json object containing encrypted cryptogram which can be passed to the pg pgs using the indirect model gateway tokens like stripe, it is a json object containing reference card reference – a token id generated by the pg and status i e , authorized, pending, charged, or refunded refer to payment credential sample for details oncardinfoupdated - called when the user changes the payment card in this callback, updatesheet method must be called to update current payment sheet onfailure - called when the transaction fails, returns the error code and errordata bundle for the failure here’s how to call the startinapppaywithcustomsheet method of the samsungpaysdkflutter class class customsheettransactioninfolistener{ function paymentcardinfo paymentcardinfo, customsheet customsheet oncardinfoupdated; function customsheetpaymentinfo customsheetpaymentinfo, string paymentcredential, map<string, dynamic>? extrapaymentdata onsuccess; function string errorcode, map<string, dynamic> bundle onfail; customsheettransactioninfolistener {required this oncardinfoupdated, required this onsuccess, required this onfail} ; } void oncardinfoupdated cardinfo selectedcardinfo, customsheet customsheet { amountboxcontrol amountboxcontrol = customsheet getsheetcontrol amount_control_id as amountboxcontrol; amountboxcontrol updatevalue product_item_id, 1000 ; amountboxcontrol updatevalue product_tax_id, 50 ; amountboxcontrol updatevalue product_shipping_id, 10 ; amountboxcontrol updatevalue product_fuel_id, 0, "pending" ; amountboxcontrol setamounttotal 1060, amountconstants format_total_price_only ; customsheet updatecontrol amountboxcontrol ; } } void startinapppaywithcustomsheet customsheetpaymentinfo customsheetpaymentinfo,customsheettransactioninfolistener? customsheettransactioninfolistener { try{ methodchannelsamsungpaysdkflutter? startinapppaywithcustomsheet customsheetpaymentinfo, customsheettransactioninfolistener ; }on platformexception catch e { print e ; } } override fun onsuccess response customsheetpaymentinfo, paymentcredential string, extrapaymentdata bundle {} override fun onfailure errorcode int, errordata bundle? {}
Develop Samsung Blockchain
docintroducing aerowallet the samsung blockchain platform sdk is a one stop solution to all your blockchain needs aerowallet is a sample application showcasing the features of sbp sdk the sbp sdk provides six primary features hardware wallet management account management transactions token transactions simple payment ui cucumber web-view dapp browser to ensure maximum security a hardware wallet is always recommended to interact with blockchain networks the sbp sdk provides support for three types of hardware wallets samsung blockchain keystore sbk ledger nano x ledger nano s aerowallet helps showcase most of the available services and apis of the sbp sdk understanding aerowallet welcome to aerowallet to use aerowallet, you need a stable connection to the internet the get started button redirects users to the hardware wallet selection page however, if you have no connection to the internet, the application will prompt you to try again when you have internet before diving into how aerowallet showcases all the features of the sbp sdk, we must understand the structure & design of aerowallet aerowallet follows the well-known mvvm pattern to design its core architecture the mvvm architecture helps maintain better separation of concerns, improved testing capacity, and transparent communication between the classes the codebase is divided into three separate layers view viewmodel model service the view layer consists of the layout, activity and fragment classes they provide the interface that displays the application data to interact it contains many ui elements that enable user interaction and helps reflect changes in the network/data from the server the activity/fragment classes in the view layer consist of observers that observe for changes in the data and update the ui, respectively the service layer or model layer in mvvm terminology consists of many service classes interacting with the sbp sdk it enables direct communication with the sbp sdk and is the last layer of the architecture service classes receive requests from the viewmodel and interact with the sbp sdk the viewmodel layer consists of the viewmodels that help encapsulate all the application's business logic it contains mutable livedata objects that change depending on user and server feedback the view layer observes these changes and updates the ui where necessary the viewmodel also gets/sets data by communicating with the service layer hardware wallet management sbp sdk provides an instance of hardwarewalletmanager that can be retrieved from the sblockchain currently, the sbp sdk supports three types of hardware wallets samsung blockchain keystore sbk and ledger nano devices usb & ble hardware wallet selection page in the aerowallet codebase, you can find the walletselectionactivity class inside the view folder the logic behind setting the hardware wallet has been decoupled as such walletselectionactivity -> setupviewmodel -> setupservice -> sbpmanager in the walletselectionactivity, listeners are implemented on the buttons of the page when you press on your desired hardware wallet, the listener calls the connecthardwarewallet function from the setupviewmodel this function calls the connecthardwarewallet function of setupservice which in turn calls the connecthardwarewallet function of sbpmanager finally, sbpmanager calls the connect api of the sbp sdk's hardwarewalletmanager module to connect with the respective hardware wallet when you are done connecting to the hardware wallet, you can move to select your desired cointype note sbpmanager is a core service class that provides direct interaction with the sbp sdk it contains instances of sblockchain, hardwarewalletmanager, and accountmanager the sblockchain class provides methods to get the accountmanager singleton instance , hardwarewalletmanager singleton instance and supportedhardwarewallet account management the samsung blockchain platform sdk manages the address on a blockchain network as an account these accounts contain all the necessary information required to sign a transaction on the blockchain network before fetching or generating an account, you must provide your walletid, cointype and networktype to the api coin selection page network selection page of ethereum after selecting the wallettype, cointype, and networktype, you can now communicate with the sbp sdk to fetch your account the sbpmanager class stores the data for all these variables now we have all the necessary pieces of the puzzle to use the accountmanager instance to manage our account the accountmanager has the following apis at our disposal getaccounts required parameters are walletid, cointype, and networktype returns the accounts that are stored locally by the sbp sdk generatenewaccount required parameters are connectedhardwarewallet and coinnetworkinfo generates a new account with the root seed of connected hardware wallet restoreaccounts required parameters are connectedhardwarewallet, reset and coinnetworkinfo restores all accounts based on the current root seed stored accounts in the sdk's repository are deleted and restored coinnetworkinfo is a special class in the sbp sdk that allows the packing of coin/platform, network, and rpc node information to create a coinnetworkinfo, you need to pass the cointype, networktype, and rpc url to its constructor reset is a boolean parameter that is usually set to false if set to true it removes all accounts in the shared preferences and writes restored accounts there is also a navigation bar that helps to navigate between the fragments all the account information is displayed within the dashboard fragment of aerowallet the send button redirects to transfer fragment and the receive button redirects to the receive fragment receive fragment showcases the public address of your account to copy/share dashboard displaying the public address and balance of the account account tree to switch between accounts and add new button to generate a new account transactions one of the primary goals achieved by the sbp sdk is to provide simple transactions through abstracted apis for each type of ledger system to learn how to use the apis from sbp sdk to sign transactions, please look into the respective service classes in the programming guide section of sbp sdk to perform a transaction on the blockchain network, you need the receiver's public address and sufficient balance in aerowallet, you can use a qr scanner to scan the receive's public address qr code enter the desired amount of funds to transfer please note that a transaction fee gas is required to perform transactions on the blockchain network ethereum transaction fragment sbp sdk supports both legacy and eip-1559 transactions for ethereum you can also choose your desired transaction speed token transactions besides fund transfers, the sbp sdk provides apis to perform token, nft and safenft transactions aerowallet has a separate fragment to showcase token transfer from one account to another however before sending a token, you must add the token into your account in the token fragment press on the '+' button to add a new token to your account you can type in the address of the token or use the qr code scanner and aerowallet will automatically fill in the rest of the fields from the blockchain network add token fragment after the token has been added, you will find it displayed in the token fragment along with all its details you can now send tokens to any account of your choice by simply filling in the receiver's address and token amount send token fragment payment sheet one of the key selling features of the sbp sdk is our simple payment ui or payment sheet this feature is embedded inside the sbp sdk and comes with a complete ui for your application's payment solutions error handling, null checking and balance checking are also added to the payment sheet there are a lot of possible use cases for the sbp sdk's payment sheet developers can easily use our payment solution to process in-app transactions aerowallet presents such a use case by showcasing an online marketplace where the transactions are processed by the sbp sdk's payment sheet mobi dapp marketplace ethereum payment sheet eth, erc20, and erc721 showcased in aerowallet all the required information has been passed into the payment sheet the gas fee will depend on the transaction speed of your choice payment sheet allows you to easily complete a transaction without the need of handling all your intricacies yourself cucumber web-view dapp browser cucumber webview is a customized webview dedicated to web dapp this allows users to integrate their web dapp into their mobile with zero changes to their web code currently, cucumberwebview is capable of javascript sdks for ethereum and tron, more specifically web3 js tronweb demo ethereum crypto store you can easily integrate your own crypto store or any other web dapp using cucumberwebview after the successful integration, the web dapp of your choice will be able to implement our built-in payment sheet activity of the sbp sdk that will cater to all your transaction needs use the addcoinserviceconnector method with your desired cointype to inject the cucumberwebview provider this injection will allow you to delegate the sendtransaction of javascript api to our onsendtransaction method you can use this to initiate the desired payment sheet or the sdk's available transaction apis payment sheet triggered through cucumber webview the complete codebase of aerowallet and api reference of the sbp sdk can be found here
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 @nonnull 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, @nonnull 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 @nonnull addcardinfo addcardinfo, @nonnull 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 @nullable android os bundle cardfilter, @nonnull 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 22 00 - nov 19 2024
Develop Samsung Pay
docthe following figure illustrates the ui flow for app-to-app id&v when the user wants to add a payment card to samsung wallet and selects the “open banking app” option
tutorials blockchain
blogdistributed ledger-based technologies are becoming more popular and easy to use. anyone can now build a new cryptocurrency or token in the blockchain world. this rise in popularity and value makes crypto assets a big target for hackers. if you want to keep your valuable crypto assets safe, using a hardware cold wallet such as trezor or ledger nano s has become a necessity. unfortunately, that adds up to one more item in your pocket that you always have to carry around. thankfully, gone are the days of carrying clunky, old wallets. recent galaxy phones, such as the s10e, s10, s10+, note10, and fold, can now securely store your cryptocurrency wallet using the samsung blockchain keystore (sbk). along with storing your cryptocurrency wallet, the sbk sdk allows you to get your blockchain address and sign cryptocurrency transactions. in this article, we explore one of the key features offered by the keystore sdk--how to get your blockchain address from the sbk sdk and three ways to share it: display as qr code copy to clipboard share through android’s share intent setting up the project and handling sbk data to set up your android project with the sbk sdk, follow these instructions. to use functionalities offered by the sdk, first fetch an instance of the service. private scwservice mscwservice = scwservice.getinstance(); after you have fetched the scwservice instance, you can check whether your device is keystore-supported. if (mscwservice == null) { log.e("keystoreapp", "keystore is not supported on this device."); } if the device is keystore-supported, you can fetch the address list with getaddresslist(): mscwservice.getaddresslist(addresslistcallback, hdpathlist); the first parameter to getaddresslist() is a scwgetaddresslistcallback, which is executed after getting a response from keystore. scwgetaddresslistcallback() has two functions: onsuccess(): this function is called when the address list has been fetched successfully from keystore. onfailure(): this function is called if any errors occur while fetching the address list from keystore. scwservice.scwgetaddresslistcallback addresslistcallback = new scwservice.scwgetaddresslistcallback() { @override public void onsuccess(list addresslist) { //you can share your address from the address list here } @override public void onfailure(int failurecode) { //based on the failure code you can show appropriate alerts here } }; the second parameter is an arraylist of hierarchical deterministic (hd) path(s) whose addresses you want to fetch. if you want to learn more about hd paths, please refer to bip-44. for example, if you want to find the public address of your first five accounts, pass the following list as a parameter: arraylist hdpathlist = new arraylist<>(); hdpathlist.add("m/44'/60'/0'/0/0"); hdpathlist.add("m/44'/60'/0'/0/1"); hdpathlist.add("m/44'/60'/0'/0/2"); hdpathlist.add("m/44'/60'/0'/0/3"); hdpathlist.add("m/44'/60'/0'/0/4"); a sample app with the sbk sdk now that we are familiar with getaddresslist(), let’s dive into our sample application. features of our public address with sbk app are: fetch your public address from the keystore switch between multiple public addresses display qr code of the selected account copy selected address into the clipboard send the selected address with supported applications with android’s share intent initially, only the address of the first account is loaded. when you press the add button, the hd path of a new account is added to hdpathlist, and public addresses are fetched. public void addaccount(view view) { //account index is incremented by 1 to get the new account accountindex++; //hdpath of new account is added to hdpathlist hdpathlist.add("m/44'/60'/0'/0/" + accountindex); showtoast("hdpath added to list"); //public address of new account is fetched getpublicaddress(); } public addresses are fetched using the getpublicaddress() function depicted below. if the address list is fetched successfully, onsuccess() is called, and: the spinner’s previous data is cleared. the newly fetched list is added to the spinner. the ui is updated. if an error occurs, it is logged and available from logcat. common errors such as error_invalid_scw_app_id can be fixed very easily by enabling developer mode from the keystore application. you can find instructions on how to enable developer mode here. private void getpublicaddress() { scwservice.scwgetaddresslistcallback addresslistcallback = new scwservice.scwgetaddresslistcallback() { @override public void onsuccess(final list publicaddresslist) { //after address list has been fetched spinner is updated with new list runonuithread(new runnable() { @override public void run() { //clear existing list spinneradapter.clear(); //new list is added spinneradapter.addall(publicaddresslist); spinneradapter.notifydatasetchanged(); if (publicaddresslist.size() == 1) { showtoast(publicaddresslist.size() + " address fetched."); } else { showtoast(publicaddresslist.size() + " addresses fetched."); } } }); } @override public void onfailure(int errorcode) { switch (errorcode) { case scwerrorcode.error_invalid_scw_app_id: log.e(log_tag,"developer option not enabled."); break; case scwerrorcode.error_check_app_version_failed: log.e(log_tag,"check internet connection."); break; case scwerrorcode.error_op_fail: log.e(log_tag,"operation failed"); break; default: log.e(log_tag,"error with error code: "+errorcode); break; } } }; if (mscwservice == null) { log.e(log_tag, "keystore is not supported in this device."); } else { //if keystore is supported on device address list is requested mscwservice.getaddresslist(addresslistcallback, hdpathlist); } } after loading all addresses into the spinner, we can now select any address from it. once an address is selected, its qr code is generated and displayed. publicaddressspinner.setonitemselectedlistener(new adapterview.onitemselectedlistener() { @override public void onitemselected(adapterview<?> adapterview, view view, int position, long l) { //get selected address from spinner selectedaddress = adapterview.getitematposition(position).tostring(); selectedaddresstextview.settext(selectedaddress); qrcodeimageview.setimagebitmap(generateqrcode(selectedaddress)); } } in this application, we used “zxing” to generate the qr bitmap of the selected public address. private bitmap generateqrcode(string text) { multiformatwriter multiformatwriter = new multiformatwriter(); bitmap bitmap = bitmap.createbitmap(10, 10, bitmap.config.rgb_565); try { //text encoded to qr bitmatrix bitmatrix bitmatrix = multiformatwriter.encode(text, barcodeformat.qr_code, 1000, 1000); barcodeencoder barcodeencoder = new barcodeencoder(); //qr bitmatrix encoded to bitmap bitmap = barcodeencoder.createbitmap(bitmatrix); } catch (writerexception e) { e.printstacktrace(); } finally { return bitmap; } } when you press the copy button, the address is copied to the clipboard. public void copyaddress(view view) { clipboardmanager clipboardmanager = (clipboardmanager) getsystemservice(context.clipboard_service); clipdata clipdata = clipdata.newplaintext("public address", selectedaddress); clipboardmanager.setprimaryclip(clipdata); toast.maketext(this, "address copied", toast.length_short).show(); } we can also share the selected public address using the android action_send intent. public void shareaddress(view view) { intent sendintent = new intent(); sendintent.setaction(intent.action_send); sendintent.putextra(intent.extra_text, selectedaddress); sendintent.settype("text/plain"); startactivity(sendintent); } conclusion now that you know more about the samsung blockchain keystore sdk, you can use it to enrich your blockchain application. additional resources: download the sbk example app more information on keystore sdk
Shuvo Saha
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
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
tutorials blockchain
blogwhether you are an enthusiast or veteran tron developer, samsung is here to help your decentralized application (dapp) reach more people. by using the features in the samsung blockchain platform sdk, you can enable millions of users to access your dapp on their samsung galaxy devices. in a few easy steps, this article demonstrates how to make a simple android application that can integrate with an existing web dapp. start by using the samsung blockchain platform sdk to connect to a hardware wallet. next, use the account manager to retrieve the user’s tron account. finally, display the web dapp using cucumber webview and enable it to send and receive payments. let’s get started! initialize samsung blockchain platform sdk before using the samsung blockchain platform sdk, include the required supporting libraries. to learn more about the prerequisite libraries and supported hardware wallets, refer to the samsung blockchain platform sdk getting started guide. to begin, initialize the samsung blockchain platform sdk for your application. the sblockchain object enables you to use the samsung blockchain platform sdk features. try { msblockchain = new sblockchain(); msblockchain.initialize(this); } catch (ssdkunsupportedexception e) { handleplatformsdkunsupportederror(e); } connect to a hardware wallet many samsung galaxy devices, such as the galaxy note10 and s20, already have a hardware wallet available: the samsung blockchain keystore. you will connect to it in this demonstration. however, you can adapt the following code to connect to other supported hardware wallets, such as the ledger nano x, simply by changing the hardware wallet type. private hardwarewallet connectedhardwarewallet; listenablefuturetask<hardwarewallet> connectiontask = msblockchain.gethardwarewalletmanager().connect(hardwarewallettype.samsung, true); connectiontask.setcallback(new listenablefuturetask.callback<hardwarewallet>() { @override public void onsuccess(hardwarewallet hardwarewallet) { connectedhardwarewallet = hardwarewallet; setupaccounts(connectedhardwarewallet); } @override public void onfailure(executionexception e) { log.e(log_tag, "connecting to hardware wallet failed."); log.e(log_tag, e.getmessage()); } @override public void oncancelled(interruptedexception e) { log.e(log_tag, "connecting to hardware wallet cancelled."); log.e(log_tag, e.getmessage()); } }); once successfully connected to the hardware wallet, you can retrieve the accounts associated with it. retrieve tron accounts the samsung blockchain platform account manager can retrieve the list of accounts associated with the hardware wallet. accountmanager accountmanager = msblockchain.getaccountmanager(); list<account> accountlist = accountmanager.getaccounts(connectedwallet.getwalletid(), coin_network_info.getcointype(), coin_network_info.getnetworktype()); to retrieve the account list, specify the wallet id from the connected hardware wallet, the coin type (cryptocurrency), and the desired network type, such as mainnet or shasta_testnet. in this case, the cryptocurrency is tron. if the account list is empty, the account manager can generate a new account, based on the connected hardware wallet and the specified cryptocurrency and network. accountmanager.generatenewaccount(connectedwallet, coin_network_info).setcallback(new listenablefuturetask.callback<account>() { @override public void onsuccess(account newaccount) { defaultaccount = newaccount; log.d(log_tag, "account fetched."); } after the account is retrieved, you can proceed to loading the web dapp using cucumber webview. initialize cucumber webview the next step is to prepare the cucumber webview and enable it to make transactions through the dapp. dappwebview = findviewbyid(r.id.dapp_web_view); dappwebview.addcoinserviceconnector(coin_network_info.getcointype(), troncoinservice, defaultaccount, transactionlistener); to communicate with the tron blockchain network, use the coinservice interface of the samsung blockchain platform. the coin service enables you to retrieve the information needed for the transaction, and also uploads the signed transaction to the blockchain network. browser-based web dapps built using the tronweb library typically use tronlink as their tron web provider. in your mobile application, cucumber webview acts as the tron web provider and forwards the tron web javascript-prepared transaction to the baseonsendtransactionlistener event handler, which handles the transaction created by the web dapp. after preparing the transaction, a payment intent powered by the samsung blockchain platform sdk can be launched, which provides an interactive ui with the transaction details. coinservice troncoinservice = coinservicefactory.getcoinservice(mainactivity.this, coin_network_info); baseonsendtransactionlistener transactionlistener = new onsendtrontransactionlistener() { @override public void onsendtransaction(@notnull string requestid, @notnull tronpaymenttype tronpaymenttype, @notnull tronaccount fromaccount, @notnull string toaddress, @org.jetbrains.annotations.nullable biginteger productprice, @org.jetbrains.annotations.nullable string tokenid, @org.jetbrains.annotations.nullable biginteger tokenvalue, @org.jetbrains.annotations.nullable string data, @org.jetbrains.annotations.nullable biginteger feelimit) { //write code for what happens when transaction is sent intent paymentintent = dappwebview.createtronpaymentsheetactivityintent( mainactivity.this, requestid, connectedhardwarewallet, fromaccount, toaddress, productprice); mainactivity.this.startactivityforresult(paymentintent, 0); } }; dappwebview.addcoinserviceconnector(coin_network_info.getcointype(), troncoinservice, defaultaccount, transactionlistener); your cucumber webview (dappwebview) is now ready to load the web dapp using its url. dappwebview.loadurl("https://www.example.com"); when the marketplace has loaded, the samsung blockchain platform prompts the user to allow the dapp to connect to their hardware wallet. the samsung blockchain platform’s payment intent ui enables the user to easily purchase items from the marketplace. bonus: display transaction id in addition to enabling users to sign in and send a transaction with your dapp, the samsung blockchain platform sdk can also retrieve the transaction id. the payment intent returns the transaction information, which can be parsed using the onactivityresult method, if desired. @override protected void onactivityresult( int requestcode, int resultcode, @nullable intent data) { super.onactivityresult(requestcode, resultcode, data); if (requestcode == 0 && data != null) { dappwebview.onactivityresult(requestcode, resultcode, data); switch (resultcode) { case activity.result_ok: string transactionid = data.getstringextra("txid"); log.d(log_tag, "transactionid : " + transactionid); showalertdialog("transaction successful with id : " + transactionid); break; case activity.result_canceled: log.d(log_tag, "transaction canceled by user."); break; default: log.d(log_tag, "unknown activity result code. result code: " + resultcode); } } } conclusion with the samsung blockchain platform sdk, your dapp is no longer confined to pcs. both new and existing users can have your dapp at their fingertips on samsung galaxy devices. it’s also easy to add support for new crypto-currencies and hardware wallets to your dapp; the samsung blockchain platform has you covered. submit your application to the samsung galaxy store and reach millions of new users today! additional resources download the samsung blockchain platform sdk example app more information on samsung blockchain platform sdk more information on samsung blockchain keystore sdk
Shuvo Saha
Develop Samsung Wallet
docapi guidelines the adding samsung wallet card templates section defines interfaces for providers to conveniently create wallet cards in samsung wallet the generated wallet card templates can be updated by following the instructions on the updating wallet card templates section authorized partners can add wallet cards to users directly from the partner server by following the instructions on the adding wallet cards section below [service domain] environment domain public domain https //tsapi-card walletsvc samsung com adding wallet card templates this section describes how to create a wallet card in samsung wallet [request] type value description method post url /partner/v1/card/template headers authorization string 1024 required credential token the token can have prefix "bearer" as an authorization type i e , bearer <credentials>* see json web token x-smcs-partner-id string 32 required partner id x-request-id string 32 required request identifier random generated uuid string body parameters ctemplate object required actual payload data in basic json format to establish the communication between partners and samsung wallet this must be in the secure jwt json web token format * see the chapter security for more details payload object cardtemplate object required wallet card template object cardtemplate prtnrid string 32 required partner id cardtemplate templaterefid string 19 required partner template id unique value for each template created by a partner this value is set to a number of 19 digits or less cardtemplate title string 32 required wallet card name cardtemplate countrycode string 2 required the main headquarters location code refer to iso-3166-1 alpha-2 for the country code cardtemplate cardtype string 100 required template card type for details, refer to wallet cards cardtemplate subtype string 100 required template card sub type for details, refer to wallet cards cardtemplate designtype string 100 optional the value that defines the design type of the wallet card for details, refer to wallet cards cardtemplate applogoimg string 200 optional the banner logo image url the maximum size of the image is 1024*1024 e g http //www yourdomain com/banner_logo_image png cardtemplate saveinserveryn string 1 optional sets whether to save the card data this value can only be set for the ‘id card’ type cardtemplate prtnrapppckgname string 128 optional the application package name cardtemplate nonetworksupportyn string 1 optional sets whether to support opening the wallet card under 'no network' status this feature cannot be modified after the wallet card is approved this must be set to either 'y' or 'n' * default 'n' cardtemplate sharebuttonexposureyn string 1 optional sets whether to support the sharing function this feature cannot be modified after the wallet card is approved this must be set to either 'y' or 'n' * default 'y' cardtemplate privacymodeyn string 1 optional if this value is set, the user authentication is required when using the card to protect the user's sensitive information this must be set to either 'y' or 'n' * default 'n' cardtemplate preventcaptureyn string 1 optional this value is a screen capture prevention flag that defines whether the content view prevents screen capture cardtemplate category string 20 optional this item can only be set if the card type is “generic” set the category to get more detailed statistical information for instance, parking pass, membership, reservations, insurance, health, receipt, coupon stamp, note, photo, and others cardtemplate prtnrcarddata string 1000 optional [get card data] partner url check the url format below and implement the api according to the url refer to partner server api specification for instance, you can use https //yourdomain cardtemplate prtnrcardstate string 1000 optional [get card state] partner url check the url format below and implement api according to url refer to partner server api specification for instance, you can use https //yourdomain cardtemplate prtnrmempoint string 1000 optional [get membership point] partner url cardtemplate cardmetacp string 1000 optional [get card meta cp] partner url cardtemplate getfulfillmentlist string 1000 optional [get fulfillment list] partner url cardtemplate prtnrbalance string 1000 optional [get card balance] partner url cardtemplate state string 15 optional when creating a card, you can transition the card's state from “draft” to “verifying” you can only choose “draft” or “verifying” * default 'draft' cardtemplate desc string 500 optional description [example] /** example card template object **/ { "prtnrid" "4083254626439156160", "templaterefid" "123456781864545365", "title" "coupon", "countrycode" "kr", "cardtype" "coupon", "subtype" "others", "nonetworksupportyn" "n", "sharebuttonexposureyn" "y" } /** example **/ post /partner/v1/card/template [headers] authorization eyjjdhkioijbvvriiiwidmvyijoxlcjwyxj0bmvyswqioiixmjg1o x-smcs-partner-id partner-id-0001 x-request-id req-202303140003 x-request-cc2 kr /** payload **/] { "ctemplate" "eyjjdhkioijkv1qilcjhbgcioijsinrpbwvzdgftcci6imnyzwf0z…" } [response] type value description http status 200 ok payload cardid wallet card id [example] 200 ok { "cardid" "3hdpejr6qi380", "resultcode" "0", "resultmessage" "success" } [result] http status code description 200 200 ok 400 400 bad request requests cannot or will not be processed the request due to something that is perceived to be a client error 401 401 unauthorized authorization token is invalid or expired 500 500 internal server error 503 503 service unavailable updating wallet card templates wallet card tmplates updated through api can also be checked and managed in the same way on the ‘wallet partners portal' partners can manage all wallet cards they have created [request] type value description method post url /partner/v1/card/template/{card id} headers authorization string 1024 required credential token the token can have prefix "bearer" as an authorization type i e , bearer <credentials>* see json web token x-smcs-partner-id string 32 required partner id x-request-id string 32 required request identifier random generated uuid string path parameters card id string 32 required the wallet card identifier granted through the partner portal * the identifier is needed when updating a specific card template body parameters ctemplate object required actual payload data in basic json format to establish the communication between partners and samsung wallet this must be in the secure jwt json web token format * see the chapter security for more details payload object cardtemplate object required wallet card template object cardtemplate prtnrid string 32 required partner id cardtemplate cardid string 32 required the cardid response received when creating a card cardtemplate templaterefid string 19 required partner template id the unique value for each template created by a partner this value is set to a number with 19 digits or less cardtemplate title string 32 optional wallet card name cardtemplate countrycode string 2 optional the main headquarters location code refer to iso-3166-1 alpha-2 for the country code cardtemplate prtnrapppckgname string 128 optional the application package name cardtemplate applogoimg string 200 optional the banner logo image url the maximum size of that image is 1024*1024 cardtemplate saveinserveryn string 1 optional sets whether to save the card data this value can only be set for the ‘id card’ type cardtemplate nonetworksupportyn string 1 optional sets whether to support opening the wallet card under 'no network' status this feature cannot be modified after the wallet card is approved this must be set to either 'y' or 'n' * default 'n' cardtemplate sharebuttonexposureyn string 1 optional sets whether to support the sharing function this feature cannot be modified after the wallet card is approved this must be set to either 'y' or 'n' * default 'y' cardtemplate privacymodeyn string 1 optional if this value is set, user authentication is required when using the card to protect the user's sensitive information this must be set to either 'y' or 'n' * default 'n' cardtemplate preventcaptureyn string 1 optional this value is a screen capture prevention flag that defines whether the content view prevents screen capture cardtemplate category string 20 optional this item can only be set if the card type is “generic” set the category to get more detailed statistical information for instance parking pass, membership, reservations, insurance, health, receipt, coupon stamp, note, photo, and others cardtemplate prtnrcarddata string 1000 optional [get card data] partner url check the url format below and implement the api according to the url refer to partner server api specification for instance, you can use https //yourdomainn cardtemplate prtnrcardstate string 1000 optional partner url check the url format below and implement the api according to the url refer to partner server api specification for instance, you can use https //yourdomain cardtemplate prtnrmempoint string 1000 optional [get membership point] partner url cardtemplate cardmetacp string 1000 optional [get card meta cp] partner url cardtemplate getfulfillmentlist string 1000 optional [get fulfillment list] partner url cardtemplate prtnrbalance string 1000 optional [get card balance] partner url cardtemplate state string 15 optional if the card status is “draft”, you can only select “verifying” cardtemplate testingmodeoff string 1 optional this value can be set only when the card status is active normal service is possible only when the testing mode is changed to off * default ‘n’ cardtemplate desc string 500 optional description [example] /* *example card template object **/ { "prtnrid" "4083254626439156160", "cardid" "3hdpejr6qi380", "templaterefid" "123456781864545365", "title" "coupon", "countrycode" "kr", "nonetworksupportyn" "n", "sharebuttonexposureyn" "y" } /** example **/ post /partner/v1/card/template/cardid=3hdpejr6qi380 [headers] authorization eyjjdhkioijbvvriiiwidmvyijoxlcjwyxj0bmvyswqioiixmjg1o x-smcs-partner-id partner-id-0001 x-request-id req-202303140003 x-request-cc2 kr /** payload **/ { "ctemplate" "eyjjdhkioijkv1qilcjhbgcioijsinrpbwvzdgftcci6imnyzwf0z…" } [response] type value description http status 200 ok payload cardid wallet card id [example] 200 ok { "cardid" "3hdpejr6qi380", "resultcode" "0", "resultmessage" "success" } [result] http status code description 200 200 ok 400 400 bad request requests cannot or will not be processed the request due to something that is perceived to be a client error 401 401 unauthorized authorization token is invalid or expired 500 500 internal server error 503 503 service unavailable adding wallet cards a typical addition to the wallet card is triggered by user interaction, such as pressing the add to wallet button or link the api also supports adding a wallet card automatically to the user for a special purpose with user’s consent this api allows partners to provide wallet cards to users the request payload must contain information about the target to which the card is added this information may be related to the user’s account, or it may contain information about a card that is already registered a push notification is sent to the user’s device to confirm successful card registration the success of card registration must be determined that the card is registered normally when it is updated to added of send card state an administrator must grant permission for partners to use this api card data specification card id {card id} is an id issued when the partner manager signs up for partner services and register the wallet card they want to service refer to partner onboarding guide document for details cdata actual payload data in basic json format to establish the communication between partners and samsung wallet see the details in the table below card data token the specific wallet card data mentioned as cdata must be secured in jwt json web token format see a chapter security for details [request] type value description method post url /atw/v1/cards/{card id} headers authorization string 1024 required credential token the token can have prefix "bearer" as an authorization type i e , bearer <credentials>* see json web token x-smcs-partner-id string 32 required partner id x-request-id string 32 required request identifier random generated uuid string path parameters card id string 32 required wallet card identifier granted through the partner portal body parameters cdata object required actual payload data in basic json format to establish the communication between partners and samsung wallet this must be in the secure jwt json web token format * see the chapter security for more details payload object card object required wallet card object card type string 16 required wallet card type *see wallet cards card subtype string 16 required wallet card sub type *see wallet cards card data[] array of object required wallet card data container data[] refid string 32 required a unique content identifier defined by the content provider data[] createdat long 13 required data creation timestamp epoch timestamp in milliseconds *utc±00 00 data[] updatedat long 13 required data update timestamp epoch timestamp in milliseconds *utc±00 00 data[] language string 8 required default card language code e g en, ko data[] attributes object required attributes container data[] attributes {fields} required attributes fields by card type*see wallet cards data[] localization[] array of object optional localized language container *see wallet cards localization[] language string 8 required multilingual content language code, e g en, ko localization[] attributes {fields} for displaying a given language, ‘data[] attributes’ can be replaced by localized versions *see wallet cards account object conditional user account object account type string 16 required type of user identifier, e g phonenumber, email account value string 64 required user identifier [example] /** example card object **/ { "card" { "type" "ticket", "subtype" "movies", "data" [{ "refid" "ref-20230304-001", "createdat" 1612660039000, "language" "en", "attributes" { "title" "samsung wallet", "mainimg" "https // /main png" *refer to wallet cards }, "localization" [{ "language" "ko", "attributes" { "title" "삼성 월렛" } }] }] }, "account" { "type" "phonenumber", "value" "+821012345678” } } /** example **/ post /atw/v1/cards/1656147182764415319 [headers] authorization eyjjdhkioijbvvriiiwidmvyijoxlcjwyxj0bmvyswqioiixmjg1o x-smcs-partner-id partner-id-0001 x-request-id req-202303140003 x-request-cc2 kr /** payload **/ { "cdata" "eyjjdhkioijkv1qilcjhbgcioijsinrpbwvzdgftcci6imnyzwf0z…" } [response] type value description http status 200 ok payload n/a example 200 ok [result] http status code description 200 200 ok 400 400 bad request requests cannot or will not be processed the request due to something that is perceived to be a client error 401 401 unauthorized authorization token is invalid or expired 500 500 internal server error 503 503 service unavailable
FAQ marketplace, mobile, web
docfaq & troubleshooting if the samsung pay app throws error_not_allowed -6 / error_unable_to_verify_caller -359 , what needs to be checked on the partner app side? for debug verify that the serviceid is correct; make sure it was generated for the test mode and not for release verify that the servicetype is correct; make sure it is same as the value assigned by the samsung pay developers portal when you create the service verify that the device’s samsung account is registered allowed under test accounts in the service details for release verify that the serviceid is correct; make sure it was generated for release and not for the test mode verify that the servicetype is correct; make sure it is same as the value assigned by the samsung pay developers portal when you create the service ask your samsung pay relationship manager rm to confirm that the status of your service is approved i received an onsuccess callback for a `getallcards ` response but the card list is empty even though there already one or more installed cards in samsungpay one of the most common exceptions during development is that “getallcard ” returns an empty list even though the card has already been added to the samsung wallet the main reason for this exception is the mismatch of an issuer name with the samsung pay portal the issuer name on the samsung pay portal and the actual issuer name of the card must be the same to overcome this problem if you cannot confirm the actual issuer name of the card, just add the card to samsung wallet app and see its details information open wallet app > tap on the card > three-dot menu > customer service option > under the title you will find the issuer name the following screenshot would be helpful for better understanding, i have received an onfail callback for `getsamsungpaystatus ` with a `spay_not_supported` status code if your app’s target api level is set to 30 or higher, refer to setting up your sdk development environmen part and follow guide for android r os targetsdkversion 30 i am getting 500 error when registering a csr while creating the 'web payment' service what should i do? if your csr was signed using your own private key rather than signed by a payment gateway, please select payment gateway with 'none default ' note the default pg name is 'none default '
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.