Partner apps: Merchant, Issuer
The first step in implementing the Samsung Pay SDK within your partner app is to create the SamsungPay instance and check Samsung Pay status on the device to determine its support for Samsung Pay (or lack thereof) and whether or not to display the Samsung Pay button to the user for selection as a payment option. The Samsung Pay button also lets issuer apps add a card to Samsung Pay. In both instances, the partner app must have valid PartnerInfo to pass to SamsungPay for caller verification.
To set its PartnerInfo, the partner app passes its service ID (SID) and Service Type, both of which are assigned by the Samsung Pay Developers portal during onboarding. Used for checking blocked list and version control between the Samsung Pay SDK and Samsung Pay app, you must set their Service Type in PartnerInfo when calling any APIs.
You must also set the API level they are using. See Understanding the Debug API Key and API Level for additional details.
Bundle bundle = new Bundle(); bundle.putString(SamsungPay.PARTNER_SERVICE_TYPE, SamsungPay.ServiceType.INAPP_PAYMENT.toString()); PartnerInfo partnerInfo = new PartnerInfo(serviceId, bundle);
void getSamsungPayStatus(StatusListener callback)
Bundle bundle = new Bundle(); bundle.putString(SamsungPay.PARTNER_SERVICE_TYPE, SamsungPay.ServiceType.INAPP_PAYMENT.toString()); PartnerInfo partnerInfo = new PartnerInfo(serviceId, bundle); SamsungPay samsungPay = new SamsungPay(context, partnerInfo); /* * Method to get the Samsung Pay status on the device. * Partner (Issuers, Merchants, Wallet providers, and so on) applications must call this Method to * check the current status of Samsung Pay before doing any operation. */ samsungPay.getSamsungPayStatus(new StatusListener() { @Override public void onSuccess(int status, Bundle bundle) { switch (status) { case SamsungPay.SPAY_NOT_SUPPORTED: // Samsung Pay is not supported samsungPayButton.setVisibility(View.INVISIBLE); break; case SamsungPay.SPAY_NOT_READY: // Activate Samsung Pay or update Samsung Pay, if needed samsungPayButton.setVisibility(View.INVISIBLE); break; case SamsungPay.SPAY_READY: // Samsung Pay is ready samsungPayButton.setVisibility(View.VISIBLE); break; default: // Not expected result samsungPayButton.setVisibility(View.INVISIBLE); break; } } @Override public void onFail(int errorCode, Bundle bundle) { samsungPayButton.setVisibility(View.INVISIBLE); Log.d(TAG, "checkSamsungPayStatus onFail() : " + errorCode); } });