Minimal examples showing how to render the Conekta tokenizer form on Android and iOS.
Both examples require a Conekta public key to work. Replace YOUR_PUBLIC_KEY_HERE in the following files:
| Platform | File |
|---|---|
| Android | android/src/main/java/com/conekta/example/MainActivity.kt (line 36) |
| iOS | ios/Local.xcconfig (see iOS setup below) |
You can get your public key from the Conekta Dashboard.
- Production keys start with
key_(from the production environment)
- Android Studio
- JDK 17+
- Conekta Elements SDK published to Maven Local or a remote repository
- Add the SDK dependency in
build.gradle.kts:
implementation("io.conekta:conekta-elements-compose:0.2.0-beta.2")conekta-elements-shared is included transitively.
- Register
ExampleApplicationinAndroidManifest.xmlto enable card brand icon loading:
<application android:name=".ExampleApplication" ...>- Set your public key in
MainActivity.kt:
private const val CONEKTA_PUBLIC_KEY = "YOUR_PUBLIC_KEY_HERE"- Build and run.
| File | Description |
|---|---|
MainActivity.kt |
Renders ConektaTokenizer composable and handles token/error callbacks |
ExampleApplication.kt |
Configures Coil image loader for SVG card brand icons |
build.gradle.kts |
Dependencies: SDK, Compose |
AndroidManifest.xml |
Internet permission and Application class registration |
- Xcode 15+
- iOS 15+ deployment target
- XCFramework built from the
composemodule
- Build the XCFramework:
./gradlew :compose:assembleComposeKitReleaseXCFramework-
Add the SDK as a local Swift Package in Xcode:
- File > Add Package Dependencies
- Select "Add Local..." and point to the
conekta-elementsroot directory - Add the
composeKitlibrary to your target
-
Create the local config file (this file is gitignored):
cp ios/Local.xcconfig.example ios/Local.xcconfig- Edit
ios/Local.xcconfigand set your keys:
DEVELOPMENT_TEAM = YOUR_TEAM_ID
CONEKTA_PUBLIC_KEY = YOUR_PUBLIC_KEY_HERE
-
In Xcode, set
Local.xcconfigfor both Debug and Release configurations:- Select the project (not the target) in the navigator
- Go to the Info tab
- Under Configurations, select
Localfrom the dropdown for each configuration
-
Build and run.
| File | Description |
|---|---|
ContentView.swift |
Renders ConektaTokenizerView and handles token/error callbacks |
ConektaTokenizerView.swift |
UIViewControllerRepresentable wrapper for the Compose UI |
ConektaExampleApp.swift |
SwiftUI app entry point |