Samsung Pay Payment System Integration in Mobile Application
Samsung Pay has its own SDK, separate from Google Pay, and works exclusively on Samsung devices with Samsung Wallet support (formerly Samsung Pay). The main distinction is support for both NFC and MST (Magnetic Secure Transmission), enabling payments on terminals without contactless readers. Integration requires registration in Samsung Pay Developers Portal and obtaining a Service ID.
Registration and Service ID Acquisition
Before writing code:
- Register at pay.samsung.com/developers
- Create a Service Profile — specify service type (In-App Payment), country, and name
- Obtain Service ID for sandbox and production environments
- Upload CSR to generate a certificate (similar to Apple Pay)
Samsung Pay API supports two tokenization models: via Payment Gateway (your acquirer supports Samsung Pay) or direct integration with Samsung Pay Server.
SDK Integration
// build.gradle (app)
dependencies {
implementation files('libs/SamsungPaySDK-2.x.x.jar')
// or via Maven if available
}
Permissions in AndroidManifest:
<uses-permission android:name="com.samsung.android.spay.permission.ACCESS_SERVICE" />
Samsung Pay Availability Check
import com.samsung.android.sdk.samsungpay.v2.SamsungPay
import com.samsung.android.sdk.samsungpay.v2.SpaySdk
import com.samsung.android.sdk.samsungpay.v2.StatusListener
val bundle = Bundle().apply {
putString(SamsungPay.PARTNER_SERVICE_TYPE, SpaySdk.ServiceType.INAPP_PAYMENT.toString())
}
val samsungPay = SamsungPay(context, bundle)
samsungPay.getSamsungPayStatus(object : StatusListener {
override fun onSuccess(status: Int, bundle: Bundle) {
when (status) {
SpaySdk.SPAY_READY -> showSamsungPayButton()
SpaySdk.SPAY_NOT_READY -> {
// Samsung Pay installed, but not configured (no cards)
samsungPay.goToUpdatePage() // offer to add card
}
SpaySdk.SPAY_NOT_SUPPORTED -> hideSamsungPayButton()
SpaySdk.SPAY_NOT_ALLOWED_TEMPORALLY -> {
// Temporarily blocked (MDM, device protection)
hideSamsungPayButton()
}
}
}
override fun onFail(errorCode: Int, bundle: Bundle) {
hideSamsungPayButton()
}
})
Creating and Launching Payment Request
import com.samsung.android.sdk.samsungpay.v2.payment.CustomSheetPaymentInfo
import com.samsung.android.sdk.samsungpay.v2.payment.PaymentManager
import com.samsung.android.sdk.samsungpay.v2.payment.sheet.*
val paymentInfo = CustomSheetPaymentInfo.Builder()
.setMerchantId("YOUR_MERCHANT_ID")
.setMerchantName("Your Company")
.setOrderNumber("ORDER-1234")
.setAddressInPaymentSheet(CustomSheetPaymentInfo.AddressInPaymentSheet.DO_NOT_SHOW)
.setAllowedCardBrands(listOf(
SpaySdk.Brand.VISA,
SpaySdk.Brand.MASTERCARD,
SpaySdk.Brand.MIR
))
.setCardHolderNameEnabled(false)
.setRecurringEnabled(false)
.build()
val customSheet = CustomSheet()
val amountControl = AmountBoxControl("amountId", "RUB")
amountControl.addItem("subtotal", "Товары", 1250.0, "")
amountControl.addItem("shipping", "Доставка", 250.0, "")
amountControl.setAmountTotal(1500.0, AmountConstants.FORMAT_TOTAL_PRICE_ONLY)
customSheet.addControl(amountControl)
val paymentManager = PaymentManager(context, partnerInfo)
paymentManager.startInAppPayWithCustomSheet(
paymentInfo,
customSheet,
object : PaymentManager.CustomSheetTransactionInfoListener {
override fun onCardInfoUpdated(cardInfo: CardInfo, customSheet: CustomSheet) {
// Called when card changes — update total amount if needed
paymentManager.updateSheet(customSheet)
}
override fun onSuccess(response: CustomSheetPaymentInfo, paymentCredential: String, extraPaymentData: Bundle) {
// paymentCredential — encrypted token for backend transmission
sendCredentialToBackend(paymentCredential)
}
override fun onFailure(errorCode: Int, bundle: Bundle) {
handleError(errorCode)
}
}
)
Common Integration Pitfalls
SPAY_NOT_SUPPORTED on Samsung device. Occurs when: Samsung Pay not installed (on some markets — Samsung Wallet), Android < 5.0, or device from older lineup without MST/NFC support.
ERROR_NOT_SUPPORTED_ENVIRONMENT error. Sandbox Service ID used with production environment or vice versa. Samsung enforces strict separation — sandbox application does not work with production Service ID.
onCardInfoUpdated called but updateSheet not invoked. Samsung Pay waits for updateSheet call after each onCardInfoUpdated — otherwise interface freezes. This is not a bug, it is a mandatory pattern.
Testing
Samsung Pay requires a physical Samsung device. Emulator is not supported. For sandbox testing, add a test card through Samsung Pay Developer section in Samsung Pay settings.
Work Scope
- Service Profile registration in Samsung Pay Developers Portal
- Samsung Pay SDK integration in Android project
- Status checking and button display implementation
- CustomSheet configuration with order line items
- Payment credential processing and provider transmission
- Testing on physical Samsung device
Timeline
2–3 days. Cost calculated individually.







