Skip to content

yuno-payments/yuno-antifraud-signifyd-android

Repository files navigation

yuno-antifraud-signifyd-android

The YunoSignifyd library is a tool that allows integration with Signifyd's fraud detection service. This library uses the ThreatMetrix library to generate a device profile and send it to Signifyd's server for fraud analysis.

To integrate this library into your application, follow these steps:

##Step 1.

Add the YunoSignifyd library dependency to your app module's build.gradle file. Make sure to add the latest available version and configure the Maven repository where the library is hosted. Add the following line to your settings.gradle file:

dependencyResolutionManagement {
    repositories {
        maven { url "https://yunopayments.jfrog.io/artifactory/snapshots-libs-release" }
        // Otros repositorios
        mavenCentral()
        google()
    }
}

Then, in your app module's build.gradle file, add the dependency:

dependencies {
    implementation 'com.yuno.fraud-signifyd:yunosignifyd:0.1.6'
}

##Step 2.

Initialize the YunoSignifyd library in your application. Call the initYunoSignifyd function in the onCreate method of your Application class:

class MyApp : Application() {

    override fun onCreate() {
        super.onCreate()
        initYunoSignifyd()
    }
}

##Step 3.

Call the onCreateYunoSignifyd function in the onCreate method of your main activity to obtain the SessionId generated by the SDK:

class MainActivity : AppCompatActivity() {
    private var yunoSignifydSessionId: String = ""

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        // Obtener el SessionId
        yunoSignifydSessionId = onCreateYunoSignifyd()
    }
}

##Step 4.

Once you have obtained the SessionId, you can use it in the checkout process by calling the corresponding function. Make sure to pass the SessionId as a parameter to the startCheckout method in the merchantSessionId parameter. This will allow the YunoSignifyd library to associate the generated device profile with the corresponding payment transaction.

override fun onResume() {
    super.onResume()

    // Generar perfil de dispositivo y enviar a Yuno
    startCheckout(
        callbackPaymentState = this::onPaymentStateChange,
        merchantSessionId = yunoSignifydSessionId
    )
}

With this, your application should be ready to integrate with Signifyd's fraud detection service. Remember that you need to have an organization identifier and the URL of the fraud detection server provided by Signifyd to use this library effectively.