# Initial Setup

## Overview

The Ryft **Android Drop-In SDK** lets you integrate card (and optionally Google Pay) payments into your Android application with minimal effort.

In the next sections on this page, you will learn how to set up a basic payment form using the Ryft Android Drop-In SDK.

## Requirements

Before you begin, ensure that you have the following prerequisites in place:

- `minSdkVersion` set to at least 24 in your `build.gradle` file.
- `compileSdkVersion` set to at least 36 in your `build.gradle` file (required for [Google Pay](https://developer.ryftpay.com/docs/payment-methods/google-pay) support).


## Installation

The Ryft Android Drop-In SDK is distributed via [Maven Central](https://repo1.maven.org/maven2/com/ryftpay/ryft-android/).

To install the Ryft Android SDK, you can follow these steps:

1. Add the required Maven repositories to your project's `build.gradle` file (if not already added):

```groovy Add Maven Repositories
allprojects {
    repositories {
        // ...
        mavenCentral()
        maven { url 'https://maven.ravelin.com/public/repositories/threeds2service/' }
        // ...
    }
}
```
Please note that if you are using Gradle version 7.0 or higher, Maven Central is included by default. The Ravelin repository is required to resolve a transitive dependency used for 3D Secure authentication.
2. Add the Ryft Android SDK dependency to your app-level `build.gradle` file:

```groovy Add Ryft Android SDK Dependency - Groovy
dependencies {
    implementation "com.ryftpay:ryft-android:$latest_version"
}
```

```kotlin Add Ryft Android SDK Dependency - Kotlin
dependencies {
    implementation("com.ryftpay:ryft-android:$latest_version")
}
```

```xml Add Ryft Android SDK Dependency - Maven
<dependency>
    <groupId>com.ryftpay</groupId>
    <artifactId>ryft-android</artifactId>
    <version>$latest_version</version>
</dependency>
```
For the latest version of the Ryft Android SDK, please refer to the [GitHub releases](https://github.com/RyftPay/ryft-android/releases) page and use the associated tag.


## Initialisation

The drop-in component provides you with all the necessary functions to collect and process payments from your customers. It will also handle formatting and validation of card details.

The drop-in must be initialised within the `onCreate` method of your activity or fragment to ensure it is set up correctly before being used.

When initialising the drop-in, you should provide:

- The activity or fragment that handles your checkout process.
- A class for handling the result, e.g., the activity or fragment itself.


Here's an example of how to initialise the Ryft Android Drop-In SDK in your activity:

Kotlin (Fragment)
```kotlin Initialise Ryft Android Drop-In SDK - Kotlin (Fragment)
class CheckoutFragment : Fragment(), RyftDropInResultListener {

    private lateinit var ryftDropIn: RyftDropIn
    
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        ryftDropIn = DefaultRyftDropIn(
            fragment = this,
            listener = this
        )
    }
    
    override fun onPaymentResult(result: RyftPaymentResult) {
        // TODO see next section
    }
}
```

Kotlin (Activity)
```kotlin Initialise Ryft Android Drop-In SDK - Kotlin (Activity)
class CheckoutActivity : ComponentActivity(), RyftDropInResultListener {

    private lateinit var ryftDropIn: RyftDropIn
    
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        ryftDropIn = DefaultRyftDropIn(
            activity = this,
            listener = this
        )
    }
    
    override fun onPaymentResult(result: RyftPaymentResult) {
        // TODO see next section
    }
}
```

Java (Fragment)
```java Initialise Ryft Android Drop-In SDK - Java (Fragment)
class CheckoutFragment extends Fragment implements RyftDropInResultListener {

    private RyftDropIn ryftDropIn; 
    
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        ryftDropIn = new DefaultRyftDropIn(this, this);
    }
    
    @Override
    protected void onPaymentResult(final RyftPaymentResult result) {
        // TODO see next section
    }
}
```

Java (Activity)
```java Initialise Ryft Android Drop-In SDK - Java (Activity)
class CheckoutActivity extends ComponentActivity implements RyftDropInResultListener {

    private RyftDropIn ryftDropIn; 
    
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        ryftDropIn = new DefaultRyftDropIn(this, this);
    }
    
    @Override
    protected void onPaymentResult(final RyftPaymentResult result) {
        // TODO see next section
    }
}
```

## Next Steps

Now that you have initialised the Ryft Android Drop-In SDK, you can proceed to display the payment UI to your users.

For more information on how to do this, please refer to the [Showing the Drop-in UI](/documentation/get_started/process_payments/android/showing_drop_in) section.