Skip to content

Repository files navigation

android-drops-sdk

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.

Status

  • payer-auth only
  • Drops-backed
  • WebView-based
  • atoms-aligned callbacks

Usage

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
        )
    )
)

Callback contract

The public callbacks are aligned with safepay-atoms:

  • onPayerAuthenticationSuccess
  • onPayerAuthenticationFailure
  • onPayerAuthenticationRequired
  • onPayerAuthenticationFrictionless
  • onPayerAuthenticationUnavailable
  • onSafepayError

Notes

  • This project uses the Drops authlink route in an Android WebView.
  • 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.

About

No description, website, or topics provided.

Resources

Code of conduct

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages