Skip to content

Repository files navigation

Openpay Android SDK

Modern, Kotlin-first Android SDK for Openpay: card tokenization, validation, antifraud device sessions and ready-made Jetpack Compose UI — so card data goes straight from the user's device to Openpay and never touches your servers.

Documentation languages: English · Español · Français · Português

Features

  • 100% Kotlin, coroutines-first API with a callback flavor for non-coroutine consumers
  • Compose-first UI: a complete, themeable card form with live brand detection, input formatting and full accessibility — plus an AbstractComposeView wrapper for XML apps
  • Card validation: Luhn, brand detection (Visa, Mastercard incl. 2-series, Amex), brand-aware CVV and expiration rules
  • Tokenization against the Openpay API for Mexico, Colombia and Peru, sandbox and production
  • Antifraud device sessions matching the legacy fingerprint flow
  • 4 languages (en, es, pt, fr) with automatic device-locale resolution and a runtime override API
  • Clean architecture + Koin in an isolated container that never clashes with the host app
  • Tested: JUnit, Mockito and Robolectric with a JaCoCo-enforced 80% minimum line coverage

Installation

dependencies {
    implementation("mx.dev1.openpay:openpay-sdk:1.0.0")
}

Minimum Android version: 8.0 (API 26).

Quick start

// 1. Configure once
val openpay = Openpay(
    OpenpayConfig(
        merchantId = "your-merchant-id",
        publicApiKey = "pk_your_public_key",
        country = OpenpayCountry.MEXICO,
        environment = OpenpayEnvironment.SANDBOX,
    )
)

// 2. Capture the card with the built-in form and tokenize it
OpenpayCardForm(
    onCardValidated = { card ->
        scope.launch {
            openpay.createToken(card)
                .onSuccess { token -> sendToBackend(token.tokenId) }
                .onFailure { error -> showError(error) }
        }
    }
)

// 3. Antifraud device session (send it to your backend with the token)
val deviceSessionId = openpay.setupDeviceSession(activity)

A full walkthrough lives in docs/en/getting-started.md, and the :app module is a runnable sample of every feature.

Documentation

Guide en es fr pt
Getting started en es fr pt
Architecture (with diagrams) en es fr pt
UI components & accessibility en es fr pt
Internationalization en es fr pt
Contributing en es fr pt
Continuous integration en es fr pt

Repository layout

openpay-android/
├── openpay-sdk/   # the published library (Maven: mx.dev1.openpay:openpay-sdk)
├── app/           # sample application consuming the SDK
├── docs/          # documentation in en / es / fr / pt
└── gradle/libs.versions.toml  # every dependency version, in one place

Contributing

Pull requests are welcome — the project uses Git Flow (develop as the integration branch, master as production). Start with docs/en/contributing.md; it assumes no Android experience.

License

Licensed under the Apache License, Version 2.0.

About

A new implementation for Openpay SDK, 100% Kotlin, standarized for new developments.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages