From f622855a59f88bdafc404e5d515dc5cac9cee9cc Mon Sep 17 00:00:00 2001 From: vladimir Date: Fri, 23 Jan 2026 15:57:28 +0100 Subject: [PATCH 1/6] chore: remove obsolite obj-c and Java from README --- README.md | 108 +++++++++++++++++++++++++----------------------------- 1 file changed, 49 insertions(+), 59 deletions(-) diff --git a/README.md b/README.md index 3644da5d..335a436d 100644 --- a/README.md +++ b/README.md @@ -72,7 +72,7 @@ Add `@adyen/react-native` plugin to your `app.json`; ### merchantIdentifier -Sets ApplePay Merchant ID to your iOS app's entitlment file. Empty by default. +Sets ApplePay Merchant ID to your iOS app's entitlement file. Empty by default. ### useFrameworks @@ -101,54 +101,43 @@ Adjust `import` on iOS in case your `Podfile` have `use_frameworks!` enabled. ## iOS integration 1. run `pod install` -2. add return URL handler to your `AppDelegate.m(m)` -```objc -#import - -... - -- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary *)options { - return [ADYRedirectComponent applicationDidOpenURL:url]; -} -``` - -For Swift: +2. add return URL handler to your `AppDelegate.swift` ```swift -import Adyen +import adyen_react_native -... +// ... -func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey: Any] = [:]) -> Bool { - return RedirectComponent.applicationDidOpen(from: url) +func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool { + return ADYRedirectComponent.applicationDidOpen(url) } ``` -In case you are using `RCTLinkingManager` or other deep-linking techniques, place `ADYRedirectComponent.applicationDidOpenURL` before them. +In case you are using `RCTLinkingManager` or other deep-linking techniques, place `ADYRedirectComponent.applicationDidOpen` before them. -```objc -- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary *)options { - return [ADYRedirectComponent applicationDidOpenURL:url] || [RCTLinkingManager application:application openURL:url options:options]; +```swift +func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool { + return ADYRedirectComponent.applicationDidOpen(url) || RCTLinkingManager.application(app, open: url, options: options) } ``` For Universal Link support, use: -```objc -- (BOOL)application:(UIApplication *)application continueUserActivity:(nonnull NSUserActivity *)userActivity restorationHandler:(nonnull void (^)(NSArray> * _Nullable))restorationHandler { - if ([[userActivity activityType] isEqualToString:NSUserActivityTypeBrowsingWeb]) { - NSURL *url = [userActivity webpageURL]; - if (![url isEqual:[NSNull null]] && [ADYRedirectComponent applicationDidOpenURL:url]) { - return YES; + +```swift +func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool { + if userActivity.activityType == NSUserActivityTypeBrowsingWeb, + let url = userActivity.webpageURL, + ADYRedirectComponent.applicationDidOpen(url) { + return true } - } - return [RCTLinkingManager application:application continueUserActivity:userActivity restorationHandler:restorationHandler]; + return RCTLinkingManager.application(application, continue: userActivity, restorationHandler: restorationHandler) } ``` -> ❕ If your `Podfile` has `use_frameworks!`, then change import path in `AppDelegate.m(m)` to use underscore(`_`) instead of hyphens(`-`): -> -> ```objc -> #import +> ❕ If your `Podfile` does **not** have `use_frameworks!`, then change import to use hyphens(`-`) instead of underscores(`_`): +> +> ```swift +> import adyen_react_native > ``` 3. Add [custom URL Scheme](https://developer.apple.com/documentation/xcode/defining-a-custom-url-scheme-for-your-app) to your app. @@ -159,23 +148,24 @@ Follow general [Enable ApplePay for iOS](https://docs.adyen.com/payment-methods/ ## Android integration -1. Provide your Checkout activity to `AdyenCheckout` in `MainActivity.java`. -```java -import com.adyenreactnativesdk.AdyenCheckout; -import android.os.Bundle; +1. Provide your Checkout activity to `AdyenCheckout` in `MainActivity.kt`. + +```kotlin +import com.adyenreactnativesdk.AdyenCheckout +import android.os.Bundle -... +// ... -@Override -protected void onCreate(Bundle savedInstanceState) { - super.onCreate(null); - AdyenCheckout.setLauncherActivity(this); +override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(null) + AdyenCheckout.setLauncherActivity(this) } ``` ### For standalone components 1. Add `intent-filter` to your Checkout activity: + ```xml @@ -185,29 +175,29 @@ protected void onCreate(Bundle savedInstanceState) { ``` -2. To enable standalone redirect components, return URL handler to your Checkout activity `onNewIntent` in `MainActivity.java`: -```java -import android.content.Intent; +2. To enable standalone redirect components, return URL handler to your Checkout activity `onNewIntent` in `MainActivity.kt`: + +```kotlin +import android.content.Intent -... +// ... -@Override -public void onNewIntent(Intent intent) { - super.onNewIntent(intent); - AdyenCheckout.handleIntent(intent); +override fun onNewIntent(intent: Intent) { + super.onNewIntent(intent) + intent.let { AdyenCheckout.handleIntent(it) } } ``` -3. To enable GooglePay, pass state to your Checkout activity `onActivityResult` in `MainActivity.java`: -```java -@Override -public void onActivityResult(int requestCode, int resultCode, Intent data) { - super.onActivityResult(requestCode, resultCode, data); - AdyenCheckout.handleActivityResult(requestCode, resultCode, data); +3. To enable GooglePay, pass state to your Checkout activity `onActivityResult` in `MainActivity.kt`: + +```kotlin +override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { + super.onActivityResult(requestCode, resultCode, data) + AdyenCheckout.handleActivityResult(requestCode, resultCode, data) } ``` -4. Make sure your main app theme is decendent of `Theme.MaterialComponents`. +4. Make sure your main app theme is descendant of `Theme.MaterialComponents`. ```xml + ``` + + # Usage For general understanding of how prebuilt UI components of Adyen work you can follow [our documentation](https://docs.adyen.com/online-payments/prebuilt-ui). @@ -247,16 +262,16 @@ const configuration: Configuration = { Sessions flow - + - To make `\sessions` API call use `AdyenDropIn.getReturnURL()` to fetch `returnUrl`. +To make `\sessions` API call use `AdyenDropIn.getReturnURL()` to fetch `returnUrl`. - ```js - const returnUrl = Platform.select({ - ios: 'myapp://payment', - android: await AdyenDropIn.getReturnURL(), - }); - ``` +```js +const returnUrl = Platform.select({ + ios: 'myapp://payment', + android: await AdyenDropIn.getReturnURL(), +}); +``` @@ -283,19 +298,21 @@ const MyCheckoutView = () => { }; ``` -### Sessions flow +### Sessions Flow ```javascript import { AdyenCheckout } from '@adyen/react-native'; import { useCallback } from 'react'; - const onComplete = useCallback( (result, nativeComponent ) => { - /* When this callback executed, you must call `component.hide(true | false)` to dismiss the payment UI. */ - }, [some, dependency]); - const onError = useCallback( (error, component) => { - /* Handle errors or termination by shopper */ - /* When the API request is completed, you must now call `component.hide(false)` to dismiss the payment UI. */ - }, []); +const onComplete = useCallback((result, component) => { + // Payment was completed - call `component.hide(true)` to dismiss the payment UI. + // Call /sessions/(sessionId)?sessionResult={result} API to get more information about the payment outcome. +}, []); + +const onError = useCallback((error, component) => { + // Payment was terminated by shopper or encountered an error + // Call `component.hide(false)` to dismiss the payment UI. +}, []); ; ``` -### Advanced flow +### Advanced Flow ```javascript import { AdyenCheckout } from '@adyen/react-native'; import { useCallback } from 'react'; - const onSubmit = useCallback( (data, nativeComponent ) => { - /* Call your server to make the `/payments` request, make sure you pass `returnUrl:data.returnUrl` to make redirect flow work cross platform */ - /* When the API request contains `action`, you should call `component.handle(response.action)` to dismiss the payment UI. */ - /* When the API request is completed, you must now call `component.hide(true | false)` to dismiss the payment UI. */ - }, [some, dependency]); - const onAdditionalDetails = useCallback( (paymentData, component) => { - /* Call your server to make the `/payments/details` request */ - /* When the API request is completed, you must now call `component.hide(true | false)` to dismiss the payment UI. */ - }, []); - const onError = useCallback( (error, component) => { - /* Handle errors or termination by shopper */ - /* When the API request is completed, you must now call `component.hide(false)` to dismiss the payment UI. */ - }, []); +const onSubmit = useCallback((data, component) => { + // Call your server to make the `/payments` request + // Pass `returnUrl: data.returnUrl` for cross-platform redirect flow + // If response contains `action`, call `component.handle(response.action)` + // Otherwise, call `component.hide(true | false)` to dismiss the payment UI +}, []); + +const onAdditionalDetails = useCallback((paymentData, component) => { + // Call your server to make the `/payments/details` request + // Call `component.hide(true | false)` to dismiss the payment UI +}, []); + +const onError = useCallback((error, component) => { + // Payment was terminated by shopper or encountered an error + // Call `component.hide(false)` to dismiss the payment UI +}, []); Date: Fri, 23 Jan 2026 16:40:24 +0100 Subject: [PATCH 3/6] chore: align Contribution guidelines --- README.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c922dd09..c3e94ce4 100644 --- a/README.md +++ b/README.md @@ -405,9 +405,14 @@ result = await ApiClient.paymentDetails(data); - [Drop-in documentation][adyen-docs-dropin] - [Component documentation][adyen-docs-components] -# Contributing +## Contributing -We strongly encourage you to contribute to our repository. Find out more in our [contribution guidelines](https://github.com/Adyen/.github/blob/master/CONTRIBUTING.md). +We strongly encourage you to join us in contributing to this repository so everyone can benefit from: +* New features and functionality +* Resolved bug fixes and issues +* Any general improvements + +Read our [**contribution guidelines**](CONTRIBUTING.md) to find out how. # Support From ea3cc2f643c467881712ee181dfac8af8e77eedf Mon Sep 17 00:00:00 2001 From: Vladimir Abramichev <2648655+descorp@users.noreply.github.com> Date: Mon, 26 Jan 2026 10:46:29 +0100 Subject: [PATCH 4/6] chore: correct return url snippets Updated instructions for iOS and Android setup to correct terminology and improve clarity. --- README.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index c3e94ce4..521ff33e 100644 --- a/README.md +++ b/README.md @@ -112,16 +112,16 @@ Add `@adyen/react-native` plugin to your `app.json`: ## Manual Integration -
-iOS Setup - > [!NOTE] > -> For Objective-C integration, see the [legacy documentation](https://github.com/Adyen/adyen-react-native/tree/2.9.0?tab=readme-ov-file#ios-integration). +> For Objective-C and Java integration, see the [legacy documentation](https://github.com/Adyen/adyen-react-native/tree/2.9.0?tab=readme-ov-file#ios-integration). + +
+iOS Setup 1. Run `pod install` -2. Add return URL handler to your `AppDelegate.swift`: +2. Add `returnURL` handler to your `AppDelegate.swift`: ```swift import Adyen @@ -129,7 +129,7 @@ import Adyen // ... func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool { - RedirectComponent.applicationDidOpen(from: url) + retrurn RedirectComponent.applicationDidOpen(from: url) } ``` @@ -188,7 +188,7 @@ override fun onCreate(savedInstanceState: Bundle?) { ``` -3. Add return URL handler for standalone redirect components in `MainActivity.kt`: +3. Add `returnURL` handler for standalone redirect components in `MainActivity.kt`: ```kotlin import android.content.Intent From 119fbd3015cef3c9110e48ef803756414cfae15e Mon Sep 17 00:00:00 2001 From: Vladimir Abramichev <2648655+descorp@users.noreply.github.com> Date: Mon, 26 Jan 2026 11:05:58 +0100 Subject: [PATCH 5/6] Apply suggestions from code review Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 521ff33e..3f1f57e8 100644 --- a/README.md +++ b/README.md @@ -197,7 +197,7 @@ import android.content.Intent override fun onNewIntent(intent: Intent) { super.onNewIntent(intent) - intent.let { AdyenCheckout.handleIntent(it) } + AdyenCheckout.handleIntent(intent) } ``` @@ -408,9 +408,9 @@ result = await ApiClient.paymentDetails(data); ## Contributing We strongly encourage you to join us in contributing to this repository so everyone can benefit from: -* New features and functionality -* Resolved bug fixes and issues -* Any general improvements +- New features and functionality +- Resolved bug fixes and issues +- Any general improvements Read our [**contribution guidelines**](CONTRIBUTING.md) to find out how. From dc8c12ad553f77be2e61bce0012b045750ca5a78 Mon Sep 17 00:00:00 2001 From: vladimir Date: Mon, 26 Jan 2026 15:19:24 +0100 Subject: [PATCH 6/6] chore: remove unnececery methods from MainActivity --- README.md | 13 ++----------- .../src/main/java/com/adyenexample/MainActivity.kt | 13 ++----------- 2 files changed, 4 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index 3f1f57e8..263a617f 100644 --- a/README.md +++ b/README.md @@ -129,7 +129,7 @@ import Adyen // ... func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool { - retrurn RedirectComponent.applicationDidOpen(from: url) + return RedirectComponent.applicationDidOpen(from: url) } ``` @@ -201,16 +201,7 @@ override fun onNewIntent(intent: Intent) { } ``` -4. For GooglePay, add `onActivityResult` handler in `MainActivity.kt`: - -```kotlin -override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { - super.onActivityResult(requestCode, resultCode, data) - AdyenCheckout.handleActivityResult(requestCode, resultCode, data) -} -``` - -5. Ensure your app theme extends `Theme.MaterialComponents`: +4. Ensure your app theme extends `Theme.MaterialComponents`: ```xml