Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 19 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ DerivedData
*.ipa
*.xcuserstate
project.xcworkspace
**/.xcode.env.local

# Android/IJ
#
Expand All @@ -42,10 +43,10 @@ android.iml

# Cocoapods
#
example/ios/Pods
apps/example/ios/Pods

# Ruby
example/vendor/
apps/example/vendor/

# node.js
#
Expand All @@ -60,15 +61,26 @@ buck-out/
android/app/libs
android/keystores/debug.keystore

# Yarn
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions

# Expo
.expo/*
.expo/

# Turborepo
.turbo/

# generated by bob
lib/

# generated by codegen
android/generated
# React Native Codegen
ios/generated
android/generated

# Config file
example/src/Config.ts
# React Native Nitro Modules
nitrogen/
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v22.20.0
1 change: 1 addition & 0 deletions .watchmanconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
942 changes: 942 additions & 0 deletions .yarn/releases/yarn-4.11.0.cjs

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
nodeLinker: node-modules
nmHoistingLimits: workspaces

yarnPath: .yarn/releases/yarn-4.11.0.cjs
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2025 Lyra Network
Copyright (c) 2026 Lyra Network
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
Expand Down
40 changes: 6 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
A React Native module for the native (iOS and Android) Lyra Payment SDK.

## Installation & usage
Documentation : https://payzen.io/fr-FR/mobp/integration_guide/react_native/

Integration App Example : https://github.com/lyra/react-native-sdk-payment-example
Documentation : https://payzen.io/fr-FR/mobp/integration_guide/react_native/

> [!IMPORTANT]
> @lyracom/react-native-sdk-payment-module **2.x.x** is now a TurboModule, and **requires the new architecture to be enabled and react-native 0.77+**.
Expand All @@ -18,49 +17,22 @@ Integration App Example : https://github.com/lyra/react-native-sdk-payment-examp
This project is a monorepo managed using [Yarn workspaces](https://yarnpkg.com/features/workspaces). It contains the following packages:

- The library package in the root directory.
- An example app in the `example/` directory.
- A bare React Native example in the `apps/example/` directory.
- An Expo example in the `apps/expoExample/` directory.

To get started with the project, run `yarn` in the root directory to install the required dependencies for each package:

```sh
yarn
```

The [example app](/example/) demonstrates usage of the library. You need to run it to test any changes you make.
The [example app](/apps/example/) demonstrates usage of the library. You need to run it to test any changes you make.

It is configured to use the local version of the library, so any changes you make to the library's source code will be reflected in the example app. Changes to the library's JavaScript code will be reflected in the example app without a rebuild, but native code changes will require a rebuild of the example app.

If you want to use Android Studio or XCode to edit the native code, you can open the `example/android` or `example/ios` directories respectively in those editors. To edit the Objective-C or Swift files, open `example/ios/SdkPaymentModuleExample.xcworkspace` in XCode and find the source files at `Pods > Development Pods > react-native-sdk-payment-module`.

To edit the Java or Kotlin files, open `example/android` in Android studio and find the source files at `react-native-sdk-payment-module` under `Android`.

You can use various commands from the root directory to work with the project.

To start the packager:

```sh
yarn example start
```

To run the example app on Android:

```sh
yarn example android
```

To run the example app on iOS:

```sh
yarn example ios
```

To confirm that the app is running with the new architecture, you can check the Metro logs for a message like this:

```sh
Running "SdkPaymentModuleExample" with {"fabric":true,"initialProps":{"concurrentRoot":true},"rootTag":1}
```
If you want to use Android Studio or XCode to edit the native code, you can open the `apps/example/android` or `apps/example/ios` directories respectively in those editors. To edit the Objective-C or Swift files, open `apps/example/ios/SdkPaymentModuleExample.xcworkspace` in XCode and find the source files at `Pods > Development Pods > react-native-sdk-payment-module`.

Note the `"fabric":true` and `"concurrentRoot":true` properties.
To edit the Java or Kotlin files, open `apps/example/android` in Android studio and find the source files at `react-native-sdk-payment-module` under `Android`.

## License

Expand Down
22 changes: 22 additions & 0 deletions ReactNativeSdkPaymentModule.podspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
require "json"

package = JSON.parse(File.read(File.join(__dir__, "package.json")))

Pod::Spec.new do |s|
s.name = "ReactNativeSdkPaymentModule"
s.version = package["version"]
s.summary = package["description"]
s.homepage = package["homepage"]
s.license = package["license"]
s.authors = package["author"]

s.platforms = { :ios => min_ios_version_supported }
s.source = { :git => "https://github.com/lyra/react-native-sdk-payment-module.git", :tag => "#{s.version}" }

s.source_files = "ios/**/*.{h,m,mm,swift,cpp}"
s.private_header_files = "ios/**/*.h"

s.dependency "LyraPaymentSDK", "~> 2.8.11"

install_modules_dependencies(s)
end
44 changes: 0 additions & 44 deletions SdkPaymentModule.podspec

This file was deleted.

65 changes: 20 additions & 45 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
buildscript {
ext.getExtOrDefault = {name ->
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['SdkPaymentModule_' + name]
ext.ReactNativeSdkPaymentModule = [
kotlinVersion: "2.0.21",
minSdkVersion: 24,
compileSdkVersion: 36,
targetSdkVersion: 36
]

ext.getExtOrDefault = { prop ->
if (rootProject.ext.has(prop)) {
return rootProject.ext.get(prop)
}

return ReactNativeSdkPaymentModule[prop]
}

repositories {
Expand All @@ -16,28 +27,19 @@ buildscript {
}


def isNewArchitectureEnabled() {
return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
}

apply plugin: "com.android.library"
apply plugin: "kotlin-android"

if (isNewArchitectureEnabled()) {
apply plugin: "com.facebook.react"
}

def getExtOrIntegerDefault(name) {
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["SdkPaymentModule_" + name]).toInteger()
}
apply plugin: "com.facebook.react"

android {
compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")
namespace "com.lyracom.reactnativesdkpaymentmodule"

compileSdkVersion getExtOrDefault("compileSdkVersion")

defaultConfig {
minSdkVersion getExtOrIntegerDefault("minSdkVersion")
targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
minSdkVersion getExtOrDefault("minSdkVersion")
targetSdkVersion getExtOrDefault("targetSdkVersion")
}

buildFeatures {
Expand All @@ -50,44 +52,17 @@ android {
}
}

lintOptions {
lint {
disable "GradleCompatible"
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

sourceSets {
main {
if (isNewArchitectureEnabled()) {
java.srcDirs += [
"generated/java",
"generated/jni"
]
}
}
}
}

repositories {
mavenCentral()
google()
}

def kotlin_version = getExtOrDefault("kotlinVersion")

dependencies {
implementation "com.facebook.react:react-android"
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'com.lyra:sdk:1.12.+'
}

if (isNewArchitectureEnabled()) {
react {
jsRootDir = file("../src/")
libraryName = "SdkPaymentModule"
codegenJavaPackageName = "com.sdkpaymentmodule"
}
}
5 changes: 0 additions & 5 deletions android/gradle.properties

This file was deleted.

3 changes: 1 addition & 2 deletions android/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.sdkpaymentmodule">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
</manifest>
Original file line number Diff line number Diff line change
@@ -1,25 +1,22 @@
package com.sdkpaymentmodule
package com.lyracom.reactnativesdkpaymentmodule

import android.util.Log
import androidx.fragment.app.FragmentActivity
import com.facebook.react.bridge.Promise
import com.facebook.react.bridge.ReactApplicationContext
import com.facebook.react.bridge.ReadableMap
import com.facebook.react.bridge.WritableMap
import com.facebook.react.module.annotations.ReactModule
import com.lyra.sdk.Lyra
import com.lyra.sdk.callback.LyraHandler
import com.lyra.sdk.callback.LyraResponse
import com.lyra.sdk.exception.LyraException
import com.lyra.sdk.exception.LyraMobException
import org.json.JSONException

class ReactNativeSdkPaymentModuleModule(reactContext: ReactApplicationContext) :
NativeReactNativeSdkPaymentModuleSpec(reactContext) {

@ReactModule(name = SdkPaymentModuleModule.NAME)
class SdkPaymentModuleModule(reactContext: ReactApplicationContext) :
NativeSdkPaymentModuleSpec(reactContext) {

private var lyraSDK: Lyra? = Lyra
private var lyraSDK: Lyra? = Lyra
private var context: ReactApplicationContext = reactContext

override fun getFormTokenVersion(): Double {
Expand Down Expand Up @@ -71,6 +68,6 @@ class SdkPaymentModuleModule(reactContext: ReactApplicationContext) :
}

companion object {
const val NAME = "SdkPaymentModule"
const val NAME = NativeReactNativeSdkPaymentModuleSpec.NAME
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package com.lyracom.reactnativesdkpaymentmodule

import com.facebook.react.BaseReactPackage
import com.facebook.react.bridge.NativeModule
import com.facebook.react.bridge.ReactApplicationContext
import com.facebook.react.module.model.ReactModuleInfo
import com.facebook.react.module.model.ReactModuleInfoProvider
import java.util.HashMap

class ReactNativeSdkPaymentModulePackage : BaseReactPackage() {
override fun getModule(name: String, reactContext: ReactApplicationContext): NativeModule? {
return if (name == ReactNativeSdkPaymentModuleModule.NAME) {
ReactNativeSdkPaymentModuleModule(reactContext)
} else {
null
}
}

override fun getReactModuleInfoProvider() = ReactModuleInfoProvider {
mapOf(
ReactNativeSdkPaymentModuleModule.NAME to ReactModuleInfo(
name = ReactNativeSdkPaymentModuleModule.NAME,
className = ReactNativeSdkPaymentModuleModule.NAME,
canOverrideExistingModule = false,
needsEagerInit = false,
isCxxModule = false,
isTurboModule = true
)
)
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.sdkpaymentmodule
package com.lyracom.reactnativesdkpaymentmodule

import org.json.JSONArray
import org.json.JSONException
Expand Down Expand Up @@ -67,4 +67,4 @@ object Util {
}
return array
}
}
}
Loading