Android library for Safepay payer authentication using Drops inside a native WebView.
This is intentionally separate from safepay-android-sdk. It mirrors the WebView-based approach used in the React Native SDK, rather than the native Cardinal flow used by the payment sheet.
- payer-auth only
- Drops-backed
- WebView-based
- atoms-aligned callbacks
Add the library module or publish it internally first. Then create the view and configure it:
val payerAuthView = SafepayPayerAuthenticationView(this)
payerAuthView.listener = object : SafepayPayerAuthenticationListener {
override fun onPayerAuthenticationSuccess(data: PayerAuthenticationSuccessData) {
Log.d("DropsSdk", "success: $data")
}
override fun onPayerAuthenticationFailure(data: PayerAuthenticationErrorData) {
Log.d("DropsSdk", "failure: $data")
}
override fun onPayerAuthenticationRequired(data: PayerAuthenticationData) {
Log.d("DropsSdk", "required: $data")
}
override fun onPayerAuthenticationFrictionless(data: PayerAuthenticationData) {
Log.d("DropsSdk", "frictionless: $data")
}
override fun onPayerAuthenticationUnavailable(data: PayerAuthenticationData) {
Log.d("DropsSdk", "unavailable: $data")
}
override fun onSafepayError(error: SafepayErrorData) {
Log.e("DropsSdk", "error: $error")
}
}
payerAuthView.configure(
SafepayPayerAuthenticationConfiguration(
environment = SafepayEnvironment.SANDBOX,
authToken = "your-auth-token",
tracker = "track_xxx",
deviceDataCollectionJWT = "jwt",
deviceDataCollectionURL = "https://centinelapistag.cardinalcommerce.com/V1/Cruise/Collect",
billing = BillingAddress(
street1 = "123 Main Street",
city = "Berlin",
country = "DE"
),
authorizationOptions = AuthorizationOptions(
doCapture = true,
doCardOnFile = false
)
)
)The public callbacks are aligned with safepay-atoms:
onPayerAuthenticationSuccessonPayerAuthenticationFailureonPayerAuthenticationRequiredonPayerAuthenticationFrictionlessonPayerAuthenticationUnavailableonSafepayError
- This project uses the Drops
authlinkroute in an AndroidWebView. - It injects a
window.ReactNativeWebView.postMessage(...)compatible bridge so Drops can send events back into native Android in the same way it does for the React Native SDK.