Skip to main content
Time: ~15 minutes
Prerequisites: Android project with Jetpack Compose, JDK 17, minSdk 21, compileSdk 35

Step 1: Add Dependencies

The SDK is distributed via Maven Central. In your app-level build.gradle.kts:
If Maven Central is not already in your project’s repository list, add it to settings.gradle.kts:
Sync your project.

Step 2: Fetch an Init Payload From Your Backend

The SDK requires an initialization payload from the Payrails API. Your backend should call the Payrails client-init endpoint and return the version and data fields. Kotlin
Java

Step 3: Initialize the SDK Session

Create a session before rendering any payment UI. This is typically done in your Activity or ViewModel. Kotlin
Java

Step 4: Build the Card Payment Screen

Kotlin/Compose onlyThe payment UI elements use Jetpack Compose and require Kotlin. There is no Java equivalent for this step. Session initialization (Step 3) and delegate callbacks are Java-compatible.
Create a Composable that renders a card form and a pay button:

Step 5: Handle Payment Results

The delegate callbacks tell you what happened:

Step 6: Test It

Use your Payrails sandbox environment and test card numbers to verify the integration. The card form validates input automatically — you’ll see inline error messages for invalid card numbers, expiry dates, and CVV codes.

What’s Next?

Now that you have a basic card payment working:
Last modified on September 30, 2026