Skip to content

Latest commit

 

History

History
110 lines (73 loc) · 2.96 KB

File metadata and controls

110 lines (73 loc) · 2.96 KB

Conekta Elements SDK - Examples

Minimal examples showing how to render the Conekta tokenizer form on Android and iOS.

Configuration

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

Prerequisites

  • Android Studio
  • JDK 17+
  • Conekta Elements SDK published to Maven Local or a remote repository

Setup

  1. 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.

  1. Register ExampleApplication in AndroidManifest.xml to enable card brand icon loading:
<application android:name=".ExampleApplication" ...>
  1. Set your public key in MainActivity.kt:
private const val CONEKTA_PUBLIC_KEY = "YOUR_PUBLIC_KEY_HERE"
  1. Build and run.

Key files

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

iOS

Prerequisites

  • Xcode 15+
  • iOS 15+ deployment target
  • XCFramework built from the compose module

Setup

  1. Build the XCFramework:
./gradlew :compose:assembleComposeKitReleaseXCFramework
  1. Add the SDK as a local Swift Package in Xcode:

    • File > Add Package Dependencies
    • Select "Add Local..." and point to the conekta-elements root directory
    • Add the composeKit library to your target
  2. Create the local config file (this file is gitignored):

cp ios/Local.xcconfig.example ios/Local.xcconfig
  1. Edit ios/Local.xcconfig and set your keys:
DEVELOPMENT_TEAM = YOUR_TEAM_ID
CONEKTA_PUBLIC_KEY = YOUR_PUBLIC_KEY_HERE
  1. In Xcode, set Local.xcconfig for both Debug and Release configurations:

    • Select the project (not the target) in the navigator
    • Go to the Info tab
    • Under Configurations, select Local from the dropdown for each configuration
  2. Build and run.

Key files

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